# Integration and multiplexing of positional and contextual information by the hippocampal network

Lorenzo Posani, Simona Cocco, Remi Monasson

<figure><img src="image_1.png" /></figure>

## To cite this version:

Lorenzo Posani, Simona Cocco, Remi Monasson. Integration and multiplexing of positional and contextual information by the hippocampal network. PLoS Computational Biology, 2018, 14 (8), pp.e1006320. 10.1371/journal.pcbi.1006320. hal-01880128

HAL Id: hal-01880128

https://hal.sorbonne-universite.fr/hal-01880128

Submitted on 24 Sep 2018

HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
<figure><img src="image_3.png" /></figure>

# Integration and multiplexing of positional and contextual information by the hippocampal network

Lorenzo Posani¹*, Simona Cocco¹*, Rémi Monasson²*

1 Laboratory of Statistical Physics, Ecole Normale Supérieure and CNRS UMR 8550, PSL Research, Paris Sorbonne UPMC, 24 rue Lhomond, 75005 Paris, France, 2 Laboratory of Theoretical Physics, Ecole Normale Supérieure and CNRS UMR 8549, PSL Research, Paris Sorbonne UPMC, 24 rue Lhomond, 75005 Paris, France

* lorenzo.posani@gmail.com (LP); cocco@lps.ens.fr (SC); monasson@lpt.ens.fr (RM)

## Abstract

The hippocampus is known to store cognitive representations, or maps, that encode both positional and contextual information, critical for episodic memories and functional behavior. How path integration and contextual cues are dynamically combined and processed by the hippocampus to maintain these representations accurate over time remains unclear. To answer this question, we propose a two-way data analysis and modeling approach to CA3 multi-electrode recordings of a moving rat submitted to rapid changes of contextual (light) cues, triggering back-and-forth instabilities between two cognitive representations ("teleportation" experiment of Jezek et al). We develop a dual neural activity decoder, capable of independently identifying the recalled cognitive map at high temporal resolution (comparable to theta cycle) and the position of the rodent given a map. Remarkably, position can be reconstructed at any time with an accuracy comparable to fixed-context periods, even during highly unstable periods. These findings provide evidence for the capability of the hippocampal neural activity to maintain an accurate encoding of spatial and contextual variables, while one of these variables undergoes rapid changes independently of the other. To explain this result we introduce an attractor neural network model for the hippocampal activity that process inputs from external cues and the path integrator. Our model allows us to make predictions on the frequency of the cognitive map instability, its duration, and the detailed nature of the place-cell population activity, which are validated by a further analysis of the data. Our work therefore sheds light on the mechanisms by which the hippocampal network achieves and updates multi-dimensional neural representations from various input streams.

## Author summary

As an animal moves in space and receives external sensory inputs, it must dynamically maintain the representations of its position and environment at all times. How the hippocampus, the brain area crucial for spatial representations, achieves this task, and manages possible conflicts between different inputs remains unclear. We propose here a

<figure><img src="image_4.png" /></figure>

OPEN ACCESS

**Citation:** Posani L, Cocco S, Monasson R (2018) Integration and multiplexing of positional and contextual information by the hippocampal network. PLoS Comput Biol 14(8): e1006320. https://doi.org/10.1371/journal.pcbi.1006320

**Editor:** Daniel Bush, University College London, UNITED KINGDOM

**Received:** April 17, 2018

**Accepted:** June 21, 2018

**Published:** August 14, 2018

**Copyright:** © 2018 Posani et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

**Data Availability Statement:** Data used in this work are the CA3 microarray recordings published in the https://www.nature.com/articles/nature10439 study. Interested readers may obtain the data by contacting the authors of the original paper, referring to Nature's availability policy for data & materials (https://www.nature.com/authors/policies/availability.html). The source code for the inverse-Ising inference is available at https://github.com/johnbarton/ACE. Supporting code for CANN simulations is available at https://github.com/lposani/CANN-multiplexing.
**Funding:** This work was partly supported by the HFSP project RGP0057-2016 and PSL-Data Science "Plasticity in functional neural networks inferred from large in vivo optical recordings in behaving rodents" project. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

**Competing interests:** The authors have declared that no competing interests exist.

comprehensive attractor neural network-based model of the hippocampus and of its multiple input streams (including self-motion). We show that this model is capable of maintaining faithful representations of positional and contextual information, and resolves conflicts by adapting internal representations to match external cues. Model predictions are confirmed by the detailed analysis of hippocampal recordings of a rat submitted to quickly varying and conflicting contextual inputs.

## Introduction

Following the discovery of place cells, which specifically fire at determined positions in space [1], the hippocampus was recognized as an essential brain area for spatial representations and memories. These cognitive representations, or maps, actually code for more than position in physical space, and are also strongly informative about context [2], including physical features of the background, such as visual landmarks, light, odors, auditory stimuli, as well as more abstract conditions, such as the emotional state or the task to be performed [3–8].

A fundamental property of the hippocampus is its capacity to memorize multiple cognitive maps [1, 9–11]. This property may result from specific recurrent synaptic connectivity in the hippocampal CA3 region [12, 13], and can be theoretically understood in the framework of continuous attractor neural networks (CANN) [14, 15]. Thanks to the remapping properties of place cells, multiple maps can be memorized in the same connectivity matrix with almost no interference between them [16–19].

Cognitive maps may be retrieved when the animal explores again the corresponding environments, or be quickly and intermittently recalled depending on the most relevant behavioral information at that moment [20]. Different sources of inputs to the hippocampus concur to form, recall, and dynamically maintain cognitive maps [21]. Changes in visual cues and landmarks may substantially affect place field shape and positioning [5]. The Path Integrator (PI), capable of integrating proprioceptive, vestibular and visual flow inputs and possibly supported by the grid-cell network in the medial-entorhinal cortex (mEC) [22], allows the animal to update the neural representation during navigation [23]. The path integrator is itself sensitive to other sources of inputs, and undergoes reset in case of large disagreement with external landmarks or sensory information [24].

Insights about how these different inputs contribute to hippocampal representations were recently obtained by studying the effects of mismatches between path-integration and visual sensory information, in particular in virtual reality settings [25, 26]. In another study Jezek et al showed how abrupt changes in visual context (light conditions) during active exploration by a rodent resulted in fast flickering between context-associated maps in CA3 on the theta time scale [27] (Fig 1A). Though they are largely artificial, these conditions offer a rare window on the fast dynamics of the place-cell population, and on how this dynamics is shaped by the various inputs.

Despite these studies, how contextual and PI inputs are combined by the hippocampal network to produce cognitive maps and accurate positional encoding is not fully understood yet. In this work, we carefully reanalyze and model the experiment of Jezek et al to address this issue. We first introduce a dual inference method capable of extracting reliably and independently the encoded map [28] and the encoded position [29, 30] from the recorded spiking activity alone (Fig 1B). Our dual decoder allows us to robustly show that the hippocampal activity always encodes the correct location in the retrieved map, even during the fast, unstable dynamics of the cognitive maps, as put forward in [27]. To explain this robust encoding, we
<figure><img src="image_5.png" /><figcaption>**Fig 1.** Neural encoding and decoding of cognitive maps and position. **A.** Schematic description of Jezek et al.'s experiment. As a rodent is moving in an environment, its position **r** = (x, y) is tracked over time, and a population of place cells is recorded (see raster plot). The activity of each cell is then binarized (0: silent cell, 1: active cell) to define the activity pattern **s**_t_ in theta cycle **t**. One out of two cognitive maps, established during the training sessions, is recalled at any time; change of maps are located by vertical dashed arrows. Place cells may have place fields in both cognitive maps (red, orange, and blue cells) or in one map only (green and purple cells). In addition, pair of neurons may be active simultaneously or not depending on the map; for instance the red and blue neurons have overlapping place fields in map **B**, but not in **A**. Hence, pairwise correlations are a fingerprint of the map. **B.** Sketch of the dual decoder. The neural activity alone is used to decode the retrieved map **m**_t_ as a function of time, and then to infer the position of the animal based on the place fields in the decoded cognitive map. Mismatches between the decoded maps and the external light cues define flickers over time. The distance between the predicted and real positions defines the positional error ϵ_t.</figcaption></figure>

https://doi.org/10.1371/journal.pcbi.1006320.g001

propose a CANN model of the hippocampal circuitry, capable of storing multiple cognitive
maps; the model is fed by visual-cue and path-integration inputs projecting on the place-cell
populations supporting those maps [31]. The path integrator is, in turn, influenced by the hip-
 pocampal activity, closing an interaction loop between the hippocampus and the mEC [32].
Our model not only reproduces the flickering phenomenology and the stable encoding of posi-
tion, but also makes several precise predictions on the dynamics of cognitive maps, the relative
strength of inputs, and the intricate activation of place-cell populations supporting the two
maps. These predictions are corroborated by a further detailed analysis of Jezek et al's data.
Our work therefore proposes explicit mechanisms by which the hippocampus could be capable of encoding various contextual and self-locomotion information in multi-dimensional representations, and of updating them accurately on fast time scales.

## Results

Jezek et al trained a rodent in two environments (square boxes), equal in size and shape, but differing by their light conditions [27]. A population of 34 CA3 place cells was recorded during reference sessions with fixed light conditions, and shown to define environment-specific maps, denoted by A and B. In a subsequent test session, taking place in a single box, instantaneous switches between environmental light conditions triggered the instability of the recalled cognitive map, which flickered back and forth between the two corresponding environments.

The neural activity $s_t$ of the population in any theta cycle $t$ encodes information on the context (the set of rules that connects position to activity, i.e. the place fields defining the cognitive map) as well as on the specific position within the environment (Fig 1A). We first introduce a dual decoder, able to independently infer the cognitive map and the position, at high temporal resolution. By comparing the inferred position to the true animal location, we then assess how precisely the position is represented in the population activity, irrespectively of the cognitive map in which it is neurally encoded (Fig 1B).

## Functional network-based decoding of the cognitive map dynamics

Due to the global remapping properties of CA3, the intensities and mutual superpositions of place fields are specific to each environment (Fig 1A). Consequently, the average firing rates and pairwise correlations of the place-cell population define a fingerprint of the corresponding cognitive map [33, 34]. We use the reference session recordings in each environment $m$ (A or B) to compute this fingerprint statistics. We then build a model $P_m(s)$ that approximates the probability of observing the neural activity $s$ when the cognitive map $m$ is recalled. This model relies on the inference of a functional network of couplings between the place cells, reproducing the fingerprint statistics of map $m$ [34, 35] (Methods).

Given the activity $s_t$ recorded in theta bin $t$ during the test session, we then compare the two probabilistic models $P_A$ and $P_B$ to estimate which map $m$ is more likely to have generated $s_t$. The log-ratio

$$ \Delta\mathcal{L}(s_t) = \log \left[ \frac{P_A(s_t)}{P_B(s_t)} \right] \quad (1) $$

indicates whether the neural activity $s_t$ is more similar to the neural patterns encountered in map A than to the ones of map B (large and positive $\Delta\mathcal{L}$), or typical of B and not of A (large in absolute value and negative $\Delta\mathcal{L}$). Comparing $\Delta\mathcal{L}$ to a statistical significance threshold allows us to infer the map $m_t$ (Methods). If the decoded map $m_t$ is discordant with the imposed light conditions the theta bin is identified as a *flicker*.

As a control, we check that $\Delta\mathcal{L}$ is mostly positive in reference sessions for environment A and negative for B, see Fig 2A. Applying the decoder to the test session, we observe the presence of flickers, see Fig 2B (yellow bins); flickers were first found in [27] with correlation-based methods requiring knowledge of the true position of the animal. An analysis of the temporal correlation of these flickers reveals that they typically persist over ~ 6 theta bins (Methods and Fig 2C); hence, cognitive maps show some inertia extending beyond the theta scale.
A

reference session A

<figure><img src="image_6.png" /></figure>

reference session B

<figure><img src="image_7.png" /></figure>

C

<figure><img src="image_8.png" /></figure>

B

test session - B to A teleportation

<figure><img src="image_9.png" /></figure>

**Fig 2. Decoding the cognitive map from neural activity.** A. Map-decoding procedure applied to constant-environment reference sessions. The log-ratio $\Delta\mathcal{L}_t$, Eq (1), which is the difference of likelihoods of map A and B given the recorded neural pattern in theta bin *t* (Methods), is mostly positive in the reference session with constant light-cue evoking A (blue) and mostly negative in the reference session B (grey). B. Time course of $\Delta\mathcal{L}$ in a portion of the test session around one light switch (red vertical line). The emergence of flickers (disagreement between the recalled map and the light cue) is clearly visible after the light switch. Yellow horizontal dashed lines show the statistical threshold applied in map decoding and flicker identification ($|\Delta\mathcal{L}| > L_0$ = log 10, Methods). Yellow bars represent the identified flicker instabilities, i.e. significative discordances ($\Delta\mathcal{L} < -L_0$) between the decoded cognitive map (here, B) and the post-switch light conditions (here, A). C. time correlation of flickers, computed with significance threshold $L_0$ = log 10. The exponential fit shows that correlations extend over ~6 theta bins, highlighting the tendency of the cognitive map to persist beyond the theta cycle.

https://doi.org/10.1371/journal.pcbi.1006320.g002

## Position is accurately encoded even during flickering instabilities of the cognitive map

To assess if the fast dynamics of cognitive maps affects the quality of positional encoding we next re-use the neural activity pattern $s_t$ in theta bin $t$, this time to infer the position of the animal. A naive Bayesian decoder [29, 30] takes as an input the above-decoded map $m_t$ (Fig 1B) and uses its place fields to estimate the position. The distance between the inferred position, $\hat{r}_t$, and the true position, $r_t$, defines the positional error $\epsilon_t$. As shown in Fig 3A, the positional error $\epsilon_t$ (blue line) is independent of the time elapsed after the light switch, and has a value comparable to the one obtained in fixed-environment conditions (blue dashed line). This result crucially depends on the fact that position is estimated according to the decoded map $m_t$, which varies with time $t$. For comparison, in Fig 3B we show the error if we decode the
<figure><img src="image_10.png" /></figure>

<figure><img src="image_11.png" /></figure>

<figure><img src="image_12.png" /></figure>

<figure><img src="image_13.png" /></figure>

**Fig 3. Positional error as a function of time from the teleportation light switch. A. Recorded data.** Positional error computed as a function of time from the teleportation (in units of theta cycle). In each theta bin *t*, the map decoder is used to select which map *m*<sub>*t*</sub> (set of place fields) to use to infer the position from the neural activity (Fig 1A). When using the decoded map *m*<sub>*t*</sub>, the positional error (blue line) is comparable to the one found in constant-environment conditions (blue dashed line). The orange line shows the positional error if the opposite map (alternative to *m*<sub>*t*</sub>) is used for inferring position. The positional error is significantly reduced with respect to constant-environment conditions (orange dashed line) in the vicinity of the teleportation, and reaches comparable values after ~ 80 theta bins. Shaded areas represent the standard error computed over 15 teleportation events. **B. Recorded data.** Same as in panel A but using a fixed map of reference for position inference, irrespectively from the decoded map. Red and green lines show results with, respectively, the ‘old’ (pre-teleportation) and the ‘new’ (post-teleportation) maps. **C & D. Simulations of CANN model:** same analysis as in panels A & B, computed over 15 simulated teleportation events, with the same trajectory of the rodent as in the experimental data. Model parameters: *N* = 400 neurons, γ<sub>J</sub> = 0.0025, γ<sub>V</sub> = γ<sub>PI</sub> = 0.4, γ<sub>W</sub> = 6.25, β = 15, see Methods and Figs. B&C in S1 Text for detailed discussion of the choice of parameters.

https://doi.org/10.1371/journal.pcbi.1006320.g003

position according to the new, post-switch map (green line) or to the old, pre-switch one (red line) at all times. Both procedures result in similar, higher errors right after the light-switch, where flickers are frequent. The error with the post-switch map eventually decrease to fixed-environment value after few seconds, due to the rarity of flickers long after the light switch.

In summary, the output of our map decoder, *m*<sub>*t*</sub>, can be interpreted as the correct cognitive state to read the positional code, see Fig 2A. Even in the presence of fast dynamical flickers of the cognitive map, the location of the animal is robustly and coherently represented at all times. Our findings show that the hippocampus representation encodes both positional and contextual information in an independent and accurate way. Interestingly, the positional error
computed with the map opposed to the decoded one (orange line in Fig 3A) shows a signifi-
cant reduction in the first seconds after the light switch; this non-trivial effect will be explained
in detail in the next sections.

Continuous attractor neural network model for the interplay between
path integrator, visual cues, and memory

The findings above suggest that the stream of positional information to the hippocampus is
maintained despite the presence of rapid changes of cognitive representations following the
abrupt modification of visual cue (V) after the light switch. A natural hypothesis is that the
path-integrator (PI) sends to the hippocampus information relative to the position in the ‘old’
map [11, 31], competing with the visual cue input associated to the ‘new’ map. To formalize
this assumption, we introduce a continuous attractor neural network (CANN) model that con-
tains the minimal ingredients to understand the effect of conflicting PI and V stimuli onto the
hippocampal activity. In the CANN paradigm for memory storage and retrieval of cognitive
maps [15–17, 36], the animal location at a certain time is represented as a self-sustained bump
of neural activity. The bump is localized in the current position within a two-dimensional
manifold, where place cells are embedded according to the positions of their place field centers
in the real environment. We generalize this classical model by including two informational
inputs on the memory network, from allothetic (visual cues) and idiothetic (path integrator)
stimuli. The proposed interaction model is composed of the following four ingredients, see
Fig 4A and Methods:

1. A CANN *memory*, including excitatory recurrent connections of strength $\gamma_j$ and global inhibition, designed to store and support two cognitive maps *m*, denominated *A* and *B*, which mimics the status of the CA3 place-cell network after learning of the two 'environments'. This model of stochastic neurons was described and studied in [19, 36, 37].

2. A *visual-cue input* of amplitude $\gamma_V$ onto place cells whose place fields match the current position of the rat, $\mathbf{r}_t$, in the cognitive map corresponding to the external light cue. The latter is denoted by $V = A$ or $B$.

3. A *path-integrator input* of amplitude $\gamma_{PI}$ that projects onto place cells whose place fields match the current position in the cognitive map corresponding to its own internal cognitive state [11], denoted by the variable $PI = A$ or $B$.

4. An *effective feedback* from the hippocampal network to the path integrator, which stochastically maintains coherence between the recalled cognitive map and the path-integrator state.

From a functional point of view, the CANN model mostly behaves, for a fixed position **r** of the rodent, as an effective two-state model for the hippocampal activity, as sketched in Fig 4B. These two states correspond to the activity localized in map *A* or *B*; their probabilities are controlled by the intensity of, respectively, the path-integrator and visual-cue inputs. Note that the emergence of two well separated collective states from the microscopic CANN model is intrinsically due to the presence of recurrent connections, see Fig 4B; A characterization of the effective barrier between the states is reported in S1 Text (see Fig. A in S1 Text). The height of the barrier, controlled by the parameter $\gamma_j$, and the amount of stochasticity in the individual neural dynamics are crucial ingredients to determine the dynamics of the model. In particular, these variables control the time-correlation of flickers (Methods); For the chosen simulation parameters, the time correlation decays over ~ 7 theta bins (Fig 4C) in accordance with data (Fig 2C).
<figure><img src="image_14.png" /><figcaption>**Fig 4.** CANN model for interplay between path integrator, external stimuli, and memory. A. Phenomenology of the CANN model. The model is composed of a recurrent hippocampal network that has memorized two cognitive maps (place fields dispositions) denominated A and B, a path integrator input (PI), and a visual input (V). In the left panel both PI and V are activating place cells whose place-field centers (shown by blue dots) correspond to the position of the rodent (red cross X) in the cognitive map A. The activity is said to be localized in a bump around X in t map A, while it appears as sparse and uninformative if interpreted with respect to the place-field locations in map B. A feedback projection (blue arrows) from the hippocampal state (bump) to the path-integrator state (purple) maintains the stability of the system by enforcing that the retrieved hippocampal map and the PI state agree. After the light conditions have been switched (teleportation, red line), V projects on</figcaption></figure>
place cells encoding position X in map B. The two hippocampal cognitive maps are therefore in conflict, and the bump of activity is alternatively localized in A (center-top) or in B (center-bottom). When the hippocampal activity is localized in the cognitive map B, the feedback projection tries to realign the internal state of PI along the corresponding map. Once the realignment has succeeded (green line), both inputs are back to a coherent state, and stability is reached in the cognitive map relative to the post-teleportation external light conditions. B. Representation of the effective model for the activity bump and effects of parameters. The input strengths, $\gamma_{PI}$ and $\gamma_V$, contribute to push the hippocampal activity towards the corresponding cognitive states. Increasing the strength of recurrent connections, $\gamma_r$, results in an effective barrier separating the two collective hippocampal states, giving rise to well formed bumps in either map A (left) or in map B (right). Due to this effective trap the bump state remains localized in either map for more than a single theta bin. C. Temporal correlation of flickering events (theta bins with cognitive state opposite to external light conditions) decay over c.a. 7 theta bins in simulated data. Same model parameters as in Fig 3. D. Time trace of the log-likelihood difference $\Delta\mathcal{L}$ (Eq 13) in Methods) in a simulated teleportation session; flickers can be observed during the conflicting phase following teleportation (shaded region). Prior to teleportation, and after the PI is realigned, inputs are coherent, and the system is stable: the sign of $\Delta\mathcal{L}$ is constant, mirroring the localization of the bump in one map. Screenshots of the activity projected on the two cognitive maps are shown for five different times. From left to right: bump localized in map A, bump localized in map A during the conflicting phase, mixed state during the conflicting phase, bump localized in map B during the conflicting phase, bump localized in map B. The video of the simulation can be found in SI.

https://doi.org/10.1371/journal.pcbi.1006320.g004

The typical outcome of a simulated experiment is shown in Fig 4D. During the exploration phase preceding the light switch, the visual (b) and path-integrator (c) inputs jointly contribute to the stability of the internal representation of the position. A localized bump of activity, sustained by the recurrent connections (a), can be observed in the pre-switch map (Fig 4A, left), say, $m = PI = V = A$. Right after the switch, the hippocampal network receives conflicting streams of information: $PI = A$ differs from $V = B$. The path integrator is still activating place cells coding for the current position of the animal in the ‘old’ map, while the visual stream points to neurons coding for the same position in the ‘new’ map (Fig 4A, center). This results in a conflict between the two bump representations, which are mutually incompatible due to the orthogonality of global remapping. Flickering is produced as an alternance between these two possible states, $m = PI = A$ and $m = V = B$. During this conflicting phase (Fig 4D, red region), the feedback (d) from the memory network to the path integrator tries to achieve coherence between the hippocampal and path-integrator states. When the bump is in the visually-driven, post-switch map ($m = B$), incoherence is strong, and the path integrator is more likely to be reset. Realigning the path integrator state with the external cue, $PI = V = m = B$, brings the conflict phase to an end, and the hippocampal state reaches stability (Fig 4A, right).

Despite its conceptual simplicity, the model shows a rich phenomenology and reproduces in a strikingly-accurate manner the results of the analysis of the CA3 teleportation recordings. In Fig 4D we show a representative time trace of the log-ratio $\Delta\mathcal{L}$ (Eq (1)) in a simulated teleportation session. Alternate intervals of positive and negative $\Delta\mathcal{L}$ signal the presence of map instability, as in [27], following the light switch (red vertical lines) and the path-integrator realignment (green vertical lines). Applying to the simulated data the same positional-error analysis as for the recorded data (Fig 3A&3B), we observe the same qualitative picture, see Fig 3C&3D. In particular, position is coherently encoded in the recalled cognitive map at all times.

**Flickering frequency is constant throughout the conflicting phase, whose duration is exponentially distributed**

Our model predicts that (1) the duration of the conflict phase, i.e. the time elapsed from a light switch to the subsequent PI realignment, is exponentially distributed (Fig 5A, right panel); (2) during the conflict phase, the flickering frequency i.e. the percentage of theta bins identified as flickers, is constant and independent of time (Fig 5B, right panel).

In order to test these two predictions on CA3 recordings, we introduce a method to disentangle the flickering dynamics of the cognitive map and the realignment of the PI, the latter bringing an end to the former. We first infer the most likely PI-realignment time for each light-switch event, given the sequence of identified flickers (Methods). The outcomes are
<figure><img src="image_15.png" /><figcaption>**Fig 5.** *Flickering rate is homogenous within each conflicting period.* A. Distribution of the path-integrator realignment times in a simulated session (right) and inferred from the recorded data (left). B. Mean Frequency of Flickers (MFF) during the conflicting phase, binned over 8 theta bins (~ 1 second) intervals. MFF is constant during the conflicting phase, both in the model (right) and in recordings (left). Realignment times inferred from data were obtained with a Bayesian procedure (Methods); histograms show flickering frequency in each time bin *t* normalized with respect to the fraction of conflicting phases, out of 15 teleportation events, that survived at least up to time *t*. C. Convolution of the two distributions shown in panels A and B, i.e. the MFF computed on the full test session, shows an apparent exponential decay both in the model (right) and in data (left, similar to the analysis shown in [27]). D. Map decoder output $\Delta\mathcal{L}$ and inferred PI-realignment times for the experimental test session; 3 out of 15 teleportations are shown. Light switches are marked with red lines, inferred PI-realignment times are marked with green lines. Identified conflicting periods are shaded. Simulated data were obtained with the same model parameters as in Fig 3.</figcaption></figure>

https://doi.org/10.1371/journal.pcbi.1006320.g005

shown as green lines in Fig 5D, and correctly separate conflicting phases (rich in flickering events) from coherent periods (during which the hippocampal representation is much more stable). The distribution of conflicting phase durations is approximately exponential in agreement with model prediction (1), with decay time $\tau = 53$ theta bins (Fig 5A, left panel). Dividing the test session into conflicting and coherent phases, we compute the frequency of flickers in the conflicting phase only. Consistently with the model prediction (2), the frequency of flickers is independent of the delay after the switch, with about 60% of theta bins in the conflicting phase carrying flickers (Fig 5B, left panel).

Similar frequencies of flickers, close to one half, are obtained in the model when the two inputs have comparable strengths ($\gamma_{PI} \simeq \gamma_V$ in Fig 4B, see also Fig. C in S1 Text). A testable consequence of this balance is that the distributions of the sojourn times (durations of the periods in which the neural activity persists in a cognitive map, see Methods) in map A and in map B are similar. This prediction is confirmed by a further analysis of the CA3 recordings: the two distributions of the sojourn times are both exponential, with roughly the same decay times (see Fig. E in S1 Text). This common time scale is related to the correlation time of the flickers (Figs 2C & 4C), see Methods.

The combination of properties (1) and (2) explains the exponential decay in the frequency of flickers with the delay after the switch reported in [27] and [38]. While the frequency of flickers is constant and large in the conflicting phase, and constant and very low in the coherent phase, the duration of the conflicting phase is exponentially distributed. Hence the frequency of flickering theta bins, irrespectively of the phase, shows the same exponential decay, see Fig 5C (right panel: simulated experiment, left panel: analysis of CA3 recordings). A detailed analysis of the data provides overwhelming statistical support to our two-fold
explanation compared to a simple exponential decay of the flickering frequency (logarithmic likelihood-ratio test ~ 150, see Methods).

## Neural encoding of position reflects the presence of input mismatches

Our model allows us to better understand the subtle differences between the neural encodings of position in the conflicting and the coherent phases. In the latter phase, both path-integrator and visual inputs point to the neurons with place fields overlapping the rodent position **r** in map. During the conflicting phase, the two inputs excite the two place-cell populations centered in **r** in their respective maps, respectively, *m* = PI and *m* = V. Hence, while the bump of activity is mostly localized in one of the two maps (varying over time), some dispersion may be expected due to these incoherent inputs.

Mixed activity states, in which two (distinct) populations of neurons encoding the same position in the two maps are active, can be occasionally observed in the snapshots of the simulated activity in Fig 4D, e.g. around theta bin *t* = 80. The overdispersion present during the conflicting phase has two consequences. First, the accuracy in position encoding is expected to be lower in the conflicting phase that in the coherent phase, see Fig 6A, left panel. Secondly, the loss in accuracy is not due to some random noise in the neural activity, but to a transient bump-like activity in the ‘wrong’ map, opposite to the decoded one. This effect is clearly seen when we choose the opposite map to infer the rodent position. While this choice leads to very poor prediction during the coherent phase, the positional error is significantly reduced during the conflicting phase (Fig 6B, left panel).

To test these two predictions in CA3 recordings, we combine our positional analysis and our PI-realignment time inference procedure. In Fig 6A (right), we compare the distributions of positional errors computed with the decoded map (according to the sign of $\Delta L$) during conflicting and coherent phases (blue and red, respectively). Consistently with the model predictions, the positional error is significantly increased during the conflicting phase (ANOVA $p < 8 \times 10^{-8}$; conflicting: 14.7 ± 0.5 SEM, coherent: 12.3 ± 0.1 SEM). When computed with the opposite map, the positional error is obviously much higher than its counterpart computed with the decoded map, but a substantial decrease is found in the conflicting phase compared to the coherent phase, see Fig 6B, right panel (ANOVA $p < 5 \times 10^{-23}$; conflicting: 27.8 ± 0.6 SEM, coherent: 34.2 ± 0.2 SEM), in full agreement with the model prediction. This effect also explains the relatively low value of the positional error obtained with the opposite map right after the switch, i.e. deep into the conflicting phase, compared to later times, see Fig 3A&3C. While this phenomenology is clear, it could in principle be affected by the presence of visual inputs projecting onto place cells during flickering events, i.e. when the ‘opposite’ map agrees with the external cues. In order to analyze the effect of the path integrator alone, we have restricted the analysis to theta bins whose decoded maps agreed with the visual inputs, i.e. to non-flickering theta bins. Results, shown in Fig 6C&6D, are still statistically significant and in strong agreement with the model predictions (decoded map: ANOVA $p < 1 \times 10^{-12}$; conflicting: 17.1 ± 0.7 SEM, coherent: 12.3 ± 0.2 SEM; opposite map: ANOVA $p < 1 \times 10^{-7}$; conflicting: 28.9 ± 0.95 SEM, coherent: 34.2 ± 0.3 SEM). Our findings are robust against changes in the statistical threshold $L_0$ for map decoding in the identification of conflict/coherent phases (Methods), see Fig. I in S1 Text.

The over-dispersion of the neural bump during the conflicting phase can also be observed from the reduction in (the absolute value of) the log-ratio, $|\Delta L|$, see Eq (1). This quantity can be interpreted as a proxy for the completeness of the bump in one single map (Methods), larger $|\Delta L|$ corresponding to large bumps in either of the two maps and randomly scattered activity in the other map (Fig 4A&4D). We find that the absolute value of $\Delta L$ is significantly
<figure><img src="image_16.png" /><figcaption>C</figcaption></figure>

<figure><img src="image_17.png" /></figure>

<figure><img src="image_18.png" /><figcaption>B</figcaption></figure>

<figure><img src="image_19.png" /><figcaption>D</figcaption></figure>

<figure><img src="image_20.png" /></figure>

<figure><img src="image_21.png" /><figcaption>E</figcaption></figure>

<figure><img src="image_22.png" /><figcaption>F</figcaption></figure>

<figure><img src="image_23.png" /></figure>

<figure><img src="image_24.png" /></figure>

<figure><img src="image_25.png" /></figure>

**Fig 6.** Distributions of positional errors in conflicting and coherent phases. A. Distributions of positional errors in the decoded cognitive map during coherent/stable (red) and conflicting/unstable (blue) phases. The model predicts (left panel) that the mean error is significantly increased during conflicting periods, mirroring the dispersion of the neural representation induced by the conflicting input streams. The same phenomenology is observed in recordings (right panel). B. The over-dispersion of the neural code in the 'correct' cognitive state (reported in panel A) is caused by an increased precision of the positional representation in the 'opposite' map, i.e. the one where the bump is not localized. This effect is significant in the model, left panel, and in the recorded data, right panel. C, D. Same analysis after exclusion of flickering theta bins. E. The absolute value of the log-ratio ΔL, Eq (1), is significantly reduced during the conflicting phase, both in the model (left) and in the data (right panel;). |ΔL| is a proxy for the completeness and stability of the bump (Methods). F. Distributions of ΔL in the test session during the conflicting (left, blue) and the coherent (right, red) phases, compared to the distribution in the two reference sessions (black contour, same as in Fig 2A).

https://doi.org/10.1371/journal.pcbi.1006320.g006
reduced during the conflicting phase in CA3 data, see Fig 6E (left panel, ANOVA *p* < 10⁻¹⁵; conflicting: 5.51 ± 0.16 SEM, coherent: 7.19 ± 0.08 SEM). Fig 6F shows the bimodal nature of the distributions of ΔL in the conflicting and coherent phases. While the reference and coherent-phase distributions coincide, the conflicting-phase distribution is more narrow, due to the overdispersion of the bump (reference σ² = 80.7, coherent σ² = 79.2, conflict σ² = 47.3). This result provides further evidence for the predictive power of the CANN model.

Discussion

Our statistical inference-based data analysis allows us to quantify how well the CA3 neural activity encode various cognitive maps, and the position therein. Correlation-based procedures, e.g. used in [27], decode the cognitive state by comparing the instantaneous population activity to the average activity recorded in reference sessions at the same position of the rodent. Our functional-network based map decoder, instead, relies on the fact that the joint pairwise spiking activity of neurons is a fingerprint of the cognitive map [28, 34]. It does not need any knowledge of the sensory correlate (here, position), and could be used to decode generic brain states in other areas.

The fast dynamics of cognitive maps studied in [27] and here results from an unrealistic sensory situation. Imposing artificial conflicts between inputs and studying their consequences is a standard approach to unveil the circuitry underlying the processing of multimodal sensory information in the hippocampus [25, 26] as well as in other brains areas, see for instance [39] for an illustration in the primary visual cortex where mismatches involve sensory and motor inputs. However, fast retrieval of functionally relevant maps, characterized by grouping and cognitive control, has also been observed in realistic settings, in which a behaving animal is required to maintain representations of two distinct spatial frames [20].

The position of the animal was accurately inferred at all times from the spiking activity using the place fields of the retrieved cognitive map (Fig 1B). As a main finding, we show that the hippocampus maintains high-quality encoding of the position even if the contextual variable undergoes fast dynamical changes. This is explained in the model by the fact that inputs point to place cells coding for the physical position in both competing maps (Fig 4A), and that the bump of activity is most often localized around these place cells in one map, and scattered all over the other map. Similar findings were reported in main text Fig 3d and Supplementary Information Fig 8 within [27], within a statistical framework assuming a priori the consistency of positional representation during flickering events, as the cognitive map was decoded by comparing the neural activity to the mean-activity vectors at the recorded real position of the rat. The emergence of unambiguous, non-mixed representations was also underlined in [27], and shown to take place in the second half of the theta cycle. However, the detailed analysis of the CA3 recordings and of the model data shows a loss of quality of the bump state (reduction in absolute value of log-ratio |ΔL|) and an increased quality of position decoding in the opposite map (Fig 6), providing evidence for the presence of partially mixed states.

Our model for the retrieval of hippocampal cognitive maps in the presence of inputs from the path integrator and visual cues is based on CANN theory [32, 40]. Two-dimensional CANN attractors, were previously applied to networks of place [15, 17] and grid [41, 42] cells. Indirect experimental evidence supporting CANN is now accumulating in various animals and brain areas. Evidence of a ring-shaped attractor region associated to head direction representation was recently reported in the drosophila central brain [43]. Attractor dynamics has also been associated to behavioral observation in a study on the monkey prefrontal cortex [44]. As for space representation, experimental support for attractor behaviour has been found in hippocampal CA1 [45] as well in grid cell [46] recordings. Further indirect evidence is
provided by the pattern of connectivity in CA3, compatible with its functional role as an auto-
associative attractor network [13], as suggested long ago based on anatomical and computa-
tional considerations [12, 47], and by the active nature of dendrites of mEC neurons, which
enhances the robustness of attractors under environmental changes [48].

The detailed analysis of the CA3 recordings done here provides another indirect support for CANN theoretical framework, when multiple (two) cognitive maps are memorized. Memorization of the two attractors is obtained, in the model, by adding the corresponding connectivity matrices into the unique CANN connectivity matrix [16–19]. A detailed theoretical study of the mechanisms for transition from map to map was obtained in the absence of inputs, i.e. for spontaneous transitions induced by neural noise only [36]. A similar picture is found here in the presence of visual-cue inputs pointing to the ‘new’ map, while the path-integrator inputs point to the ‘old’ map in the conflicting phase. As inputs are of comparable magnitude, no single map is favored. The stochastic fluctuations resulting from the noise of the individual neurons are sufficient for the system to cross the activation barrier between the two memory states (maps) of the network, see Fig 4B and Fig. A in S1 Text. The hippocampal network jumps intermittently from one cognitive map to the other, reproducing the flickering events experimentally identified and described in [27]. Transition rates between the two maps increase with the neural noise, modeled here by the parameter $\beta$, see Eq (12) in Methods and Fig. D in S1 Text. Neural noise relative to the population activity could also be effectively increased through the introduction of periodic (theta and gamma) modulations of the activity into the model [31, 37, 49]. The presence of rhythms is known to facilitate memory formation and integration of information [50, 51]. While theta oscillations can help produce flickering events as previously reported [31, 38], our work shows that such periodic modulations are not necessary. Transitions could also be facilitated by particular ‘confounding’ landmarks or positions in space, where the maps happen to be locally similar [16, 36].

The present model reproduces accurately all the observed flickering properties, without any
need for a post-learning short-term plasticity of the CA3 network hypothesized in [38]. In par-
ticular, our model predicts that the flickering frequency is independent from the time spent
after the teleportation event in the conflicting phase (Fig 5B). This finding is at first sight in
disagreement with the exponential decay of the flickering frequency reported in [27, 38]. How-
ever, the latter was obtained as a result of an averaging over many teleportation events. For a
single event, accurate data analysis shows that our constant flickering rate hypothesis, when
combined with the exponentially distributed realignment time of the path integrator (Fig 5A),
is much more likely than an exponential decreasing scenario.

Our model is based on the existence of two streams of inputs conveying, respectively, external landmark and self-navigation information. Recent studies have pointed to the grid cells network in mEC as the possible region that supports path integration, as their firing patterns are maintained in the dark [52], and the relative phases of grid cells seem to be largely unaffected by global remapping between environments of similar shapes [11, 53]. CANN-based approaches have been proposed to model grid-cell networks [41, 42], differing from hippocampal CANN mostly by the short-range nature of the inhibitory couplings. In much the same way the microscopic hippocampal CANN proposed here can effectively be reduced to a 2-state model (Fig 4B), we expect CANN models for the grid-cell networks to be approximately described by a 2-state model, corresponding to the PI aligned with map A or B [11, 54, 55]. This motivates the simple model for the PI we have considered here.

In addition to sending projections towards the hippocampus, our model PI receives a feedback from the CANN, greatly increasing the probability of transition to the state agreeing with the instantaneous cognitive map [32, 56, 57]. Eventually, the state of the PI is realigned along the visual cue inputs, which stops the conflicting phase. Our model effectively implements a
ratchet mechanism, locking the system into the coherent phase after a conflicting transient. Realignment of the path integrator based on visual landmarks is an important functional property, intended to limit the accumulation of errors in position estimation [58], and observed for large mismatch between external and internal inputs [24]. From a physiological point of view, projections exist from CA1 to mEC [32], and have been shown to be important for the formation of grid cells [57]. Hence, the feedback from the CANN, thought here to model CA3 activity, to the PI should be understood as effective.

As recently reported in [53], the impairment of the mEC grid firing resulted in a loss of path integrator in behaving rodents. As in our model, the recall of the pre-teleportation map, and, therefore, the whole flickering phenomenology are driven by the input stream from the path integrator to the CA3 network, we conjecture that flickering instabilities would disappear upon grid-cell impairment. Simultaneous recordings of mEC and CA3, as in [11], would be extremely useful to test our predictions and better describe the effect of the path integrator on the cognitive status of CA3.

## Methods

### Cognitive map decoding from neural activity

Theta bins are identified with the Hilbert transform procedure of [27]. The activity of the N recorded neurons is binarized into each theta bin $t: s_{i,t} = 1$ if neuron i is active in bin t, 0 otherwise. For each cognitive map $m = A, B$ a *Ising-model* probability distribution $P_m(s)$ for the activity configurations $s = (s_1, s_2, \dots, s_N)$ is inferred,

$$P_m(s) = \frac{1}{\mathcal{Z}_m} \exp \left( \sum_i h_i^{(m)} s_i + \sum_{i<j} J_{ij}^{(m)} s_i s_j \right), \quad (2)$$

where $\mathcal{Z}_m$ is a normalization constant. Couplings ($J^{(m)}$) and fields ($h^{(m)}$) are determined such that the pairwise correlations and average activities in the neural population computed from $P_m$ match their experimental counterparts in the reference session of environment $m$. These *inverse Ising problems* are solved using the Adaptive Cluster Expansion algorithm [59–62]. The inferred models (2) are then used to dynamically decode the map $m_t$ during the test session ($s$) [28], based on the log-ratio of the probabilities of the activity configuration in time bin $t$ in the two environments (main text Eq [1]), with the result

$$m_t = \begin{cases} A & \text{if } \Delta\mathcal{L}(s_t) > L_0, \\ B & \text{if } \Delta\mathcal{L}(s_t) < -L_0, \end{cases} \quad (3)$$

where the threshold $L_0$ is chosen according to the required statistical confidence. We generally set $L_0 = \log 10 \approx 2.3$.

After having decoded the map $m_t$ in theta bin $t$, we define the flicker variable $f_t$, equal to 1 if $m_t$ does not match the light cue in theta bin $t$, to 0 otherwise.

### Temporal correlation of flickers and sojourn times

The time correlation of flickering events for delay $\tau$ is defined as

$$C(\tau) = \frac{1}{T_{tot}} \sum_{i=1}^{S-1} \sum_{t=T_i}^{T_{i+1}-\tau} f_t f_{t+\tau} - \left( \frac{1}{T_{tot}} \sum_{i=1}^{S-1} \sum_{t=T_i}^{T_{i+1}-\tau} f_t \right)^2 \quad (4)$$

where $S$ is the total number of switch events in the recorded data ($S = 16$ in [27]), $T_i$ is the theta
bin index of switch $i$ ($<$ $S$), and $T_{tot} = T_S$ is the total number of theta bins in the test session. The time correlation $C(\tau)$ is typically exponentially decaying, with a decay time $\tau_0$, see Fig 2C.

The correlation time $\tau_0$ is related to the sojourn time of the neural bump in the cognitive maps, defined as a sequence of contiguous theta bins decoded in the same map, see S1 Text. Theta bins whose $|\Delta\mathcal{L}|$ are lower than the threshold $L_0$ are considered as belonging to the same map as the last statistically significant time bin. The distribution of sojourn times in each map is shown in Fig. E in S1 Text.

## Position decoding from neural activity

The arena is discretized into 60 × 60 squared bins of 1 cm² each, with integer coordinates $(x, y)$ [27]. For each reference environment $m \in$ (A, B) we construct the binary rate map, $p_i^{(m)}(x, y)$, equal to the average of $s_{i,t}$ over all theta bins $t$ in which the rat is at position $(x, y)$. Position is then decoded according to the naive Bayesian framework [63]: the probability of the activity configuration $\mathbf{s}_t = \{s_1, s_2, \dots, s_n\}$ in theta bin $t$ and at fixed position $(x, y)$ reads

$$P_m(\mathbf{s}_t|x, y) = \prod_{i=1}^{N} [p_i^{(m)}(x, y) \cdot s_i + (1 - p_i^{(m)}(x, y)) \cdot (1 - s_i)] . \quad (5)$$

Once $m$ is known, e.g. either through the map decoder or due to constant experimental conditions, the position of the rodent can be reconstructed from the recorded neural activity through

$$(\hat{x}_t, \hat{y}_t) = \arg \max_{(x,y)} [P_m(\mathbf{s}_t|x, y) \times T_m(x, y)], \quad (6)$$

where the maximum is computed over the 60 × 60 possible positions. $T_m(x, y)$ is the number of theta bins spent by the rodent at position $(x, y)$ during the reference session of map $m$; we use it as a prior to favor positions where the rodent is more likely to be, irrespectively of the neural activity.

## Continuous attractor neural network model for hippocampal activity

The hippocampal population includes $N$ place cells. For each cell $i = 1...N$ the place-field centers coordinates, $\mathbf{r}_i^A$ and $\mathbf{r}_i^B$, are drawn uniformly and independently at random in the squared environments, respectively, A and B. The linear size of each square is denoted by $L$.

Neural activities are represented by binary variables: $s_{i,t} = 0$ or 1 if neuron $i$ is, respectively, silent or active in time bin $t = 1, 2, 3, ...$. The duration of a time bin is the theta cycle over $K$; results reported here were obtained with $K = 4$, which corresponds to approximately 30 ms.

The total input received by neuron $i$ at time $t$ is

$$H_{i,t} = \sum_{j \neq i} J_{ij} s_{j,t} + h_i^{(V)}(\mathbf{r}) + h_i^{(PI)}(\mathbf{r}) . \quad (7)$$

The three terms on the right hand side of Eq [7] represent, in order:

* the input due to recurrent connections in the hippocampal network. The underlying assumption is that connections have emerged from learning during the exploration of the two environments by the rodent: Place cells that turned out to be simultaneously active in either environment have developed positive couplings. Couplings are defined through

$$J_{ij} = J_{ij}^A + J_{ij}^B \quad \text{with} \quad \begin{cases} J_{ij}^A = \gamma_j \times \phi(\mathbf{r}_i^A - \mathbf{r}_j^A) \\ J_{ij}^B = \gamma_j \times \phi(\mathbf{r}_i^B - \mathbf{r}_j^B) \end{cases}, \quad (8)$$
where $\gamma_I$ controls the strength of the connections, and

$$ \phi(\mathbf{r}) = \frac{L^2}{N \times 2\pi\sigma^2} e^{-\frac{|\mathbf{r}|^2}{2\sigma^2}}. \qquad (9) $$

Parameter $\sigma$ in Eq [9] is the spatial scale corresponding to the width of the place fields. The prefactor in Eq [9] ensures that $\phi$ is dimensionless and that, on average, the sum of the Gaussian factors $\phi(\mathbf{r} - \mathbf{r}_i^m)$ over all neurons $i$ is close to unity for every possible position $\mathbf{r}$ and map $m$.

* the visual input

$$ h_i^{(V)}(\mathbf{r}) = \gamma_V \times \begin{cases} \phi(\mathbf{r}_i^A - \mathbf{r}) & \text{if } V = A, \\ \phi(\mathbf{r}_i^B - \mathbf{r}) & \text{if } V = B, \end{cases} \qquad (10) $$

depends on the position $\mathbf{r}$ of the rodent. We again assume that, during the exploration of the environment, visual-cue projections onto place cells have been strengthened through learning. For simplicity we use the same function $\phi$ as in the recurrent connections, see Eq (8), to characterize the portion of environment in which visual cues project onto a specific place cell $i$.

* the path-integrator input

$$ h_i^{(PI)}(\mathbf{r}) = \gamma_{PI} \times \begin{cases} \phi(\mathbf{r}_i^A - \mathbf{r}) & \text{if } PI = A, \\ \phi(\mathbf{r}_i^B - \mathbf{r}) & \text{if } PI = B. \end{cases} \qquad (11) $$

PI inputs have the same functional dependence over space as visual-cue related inputs. The amplitudes of both input types are tuned by the parameters $\gamma_{PI}$ and $\gamma_V$.

All neurons undergo stochastic updating of their activities from time bin $t \to t + 1$ according to their total inputs. The activity of neuron $i$ at time $t + 1$ is chosen to be

$$ s_{i,t+1} = \begin{cases} 0 & \text{with probability } \frac{1}{1 + e^{\beta(H_{i,t} - \theta)}} \\ 1 & \text{with probability } \frac{e^{\beta(H_{i,t} - \theta)}}{1 + e^{\beta(H_{i,t} - \theta)}}. \end{cases} \qquad (12) $$

To enforce global inhibition in the population activity, the value of the threshold $\theta$ is dynamically adjusted so that an average fraction $f$ of the neurons is active at any time. Parameter $\beta$ controls the amount of noise in the neural dynamics. For $\beta \to 0$ neuron activities are random and independent of their inputs, while, for $\beta \to \infty$, they deterministically follow the signs of the inputs (after subtraction of the threshold $\theta$). The average activity of cell $i$ at time $t + 1$ is therefore a monotonously increasing sigmoidal function of its total input $H_{i,t}$ at time $t$, with maximal slope equal to $\beta/4$ in $H_{i,t} = \theta$.

The properties of this CANN model in the absence of any visual and PI inputs, i.e. for $\gamma_V = \gamma_{PI} = 0$, were analytically studied in [19, 36, 37], see S1 Text for further discussion. The log-ratio $\Delta\mathcal{L}$ defined in Eq (1) for the decoding of cognitive maps has a direct counterpart in our CANN model as the difference between the contributions to the log-probability of an activity configuration $\mathbf{s}$ when the bump is localized in maps A and B,

$$ \Delta\mathcal{L}(\mathbf{s}) = \sum_{i<j} (J_{ij}^A - J_{ij}^B) s_i s_j. \qquad (13) $$
## Mechanism for path-integrator realignment

The path integrator is described as a two-state model, $PI = A$ or $B$. Its dynamics is stochastic and Markovian: in each time bin $t$, the state $PI$ can jump into state $PI'$ with transition probabilities $R(PI \to PI')$, independently of the previous states. The feedback from the hippocampal network to the path integrator is expressed in the dependence of $R$ on the hippocampal map $M_t$ at time $t$. To favor transitions to the state $PI'$ agreeing with the current map $M_t$, we introduce the following witness function for the presence of the bump in map $m = A, B$:

$$W^{(m)}(\mathbf{s}, \mathbf{r}) = \sum_{i=1}^{N} s_i \phi(\mathbf{r} - \mathbf{r}_i^m), \qquad (14)$$

where $\mathbf{s}$ and $\mathbf{r}$ are, respectively, the activity configuration and the position of the rodent at time $t$. Due to the normalization of $\phi$ in Eq [9], we expect $W^{(m)}$ to be close to one for the retrieved map $m = M_t$ and to be much smaller for the opposite map.

We impose the preference for realigning the path-integrator state in accordance with the hippocampal map through the ratio between the two reciprocal transition probabilities,

$$\frac{R(PI = B \to PI' = A)}{R(PI = A \to PI' = B)} = e^{\gamma_W (W^{(A)}(\mathbf{s}, \mathbf{r}) - W^{(B)}(\mathbf{s}, \mathbf{r}))}, \qquad (15)$$

Here, $\gamma_W$ is a positive parameter allowing us to tune the strength of the preference. If the hippocampal bump of activity is localized in, say, map $A$, the right hand side of Eq [15] will be strongly positive, and the probability of realigning the path integrator to $PI' = A$ will be much larger than the probability of the reciprocal transition.

A solution to the constraint expressed by Eq [15] is given by

$$\begin{aligned} R(PI = B \to PI' = A) &= R_0 \times e^{\gamma_W (W^{(A)}(\mathbf{s}, \mathbf{r}) - W^{(B)}(\mathbf{s}, \mathbf{r})) / 2}, \\ R(PI = A \to PI' = B) &= R_0 \times e^{-\gamma_W (W^{(A)}(\mathbf{s}, \mathbf{r}) - W^{(B)}(\mathbf{s}, \mathbf{r})) / 2}, \end{aligned} \qquad (16)$$

where $R_0$ is a positive number. In the absence of bias ($\gamma_W = 0$), the inverse of $R_0$ may be interpreted as the average time scale between two realignments of the path-integrator state.

The model for the path-integrator dynamics is entirely defined by the transition probabilities in Eq [17] and the probability conservation identities:

$$\begin{aligned} R(PI = A \to PI' = A) + R(PI = A \to PI' = B) &= 1, \\ R(PI = B \to PI' = A) + R(PI = B \to PI' = B) &= 1. \end{aligned} \qquad (17)$$

## Inference of path-integrator realignment times

Defining $\tau$ as the PI-realignment time, $t = 0$ as the time bin corresponding to the light switch and $T$ as the time bin corresponding to the next switch (end of analyzed data), we assume the probability $p(t)$ for time bin $t$ to be a flickering event to be

$$p(t) = \begin{cases} p_0, & \text{if } 1 \le t \le \tau, \\ p_e, & \text{if } \tau + 1 \le t \le T. \end{cases} \qquad (18)$$

Here, $p_0$ is the constant flickering probability, and $p_e$ is the baseline decoding error, see S1 Text for discussion of the values of parameters $p_0$ and $p_e$.
We write the log-likelihood of the parameter $\tau$ as a function of the identified flickering sequence $\mathbf{f} = \{f_t\}$ as follows:

$$ \log P(\mathbf{f} | \tau, p_0, p_e) = \log p_0 \times \sum_{t=1}^{\tau} f_t + \log(1 - p_0) \times \sum_{t=1}^{\tau} (1 - f_t) + \log p_e \times \sum_{t=\tau+1}^{T} f_t + \log(1 - p_e) \times \sum_{t=\tau+1}^{T} (1 - f_t) \quad (19) $$

We then maximize this log-likelihood over $\tau$ to infer the most likely value $\tau^*$ of the realignment time. The procedure is repeated for all light switches, see Fig. G in S1 Text.

## Independence of frequency of flickers from delay after light switch

We consider two hypotheses:

1. $H_{decay}$ = the flickering probability depends on time as a decaying function that can be inferred from data, that can be inferred from the full test session (15 light switches)

2. $H_{constant}$ = the flickering probability is constant throughout the conflicting period of varying duration, which can be inferred from data (see previous section).

Following the Bayesian information criterion [64], we parametrize each model with the same number of variables. For hypothesis $H_{decay}$, we estimate the flickering frequency as a function of time from the average frequency computed over the full test session (Fig 5C, bottom), in bins of one second-width (8 theta cycles), up to 15 seconds after the light switch. For later delays (> 15 s) the flickering frequency is set to a baseline error probability, $p_e = 0.01$. For hypothesis $H_{constant}$, we infer the most likely PI realignment times for each one of the 15 light-switch events (see Section above). The associated flickering probability $p_t$ is then set to $p_0 = 0.55$ until the inferred PI realignment time $\tau^*$, and equal to the baseline probability $p_e = 0.01$ afterwards. We then compute the likelihoods of both hypothesis given the observed data (identified flickering theta bins $\mathbf{f}$) through

$$ \ell(\text{hypothesis}|\text{data}) = \sum_{t=1}^{T} [\log p_t \times f_t + \log(1 - p_t) \times (1 - f_t)], \quad (20) $$

where $T$ is the total length of the test session. The above expression is then summed over all light-switch events. We define the difference of the two log-likelihoods as

$$ \Delta\ell = \ell(H_{constant}|\text{data}) - \ell(H_{decay}|\text{data}). \quad (21) $$

The constant flickering frequency hypothesis $H_{constant}$ is extremely more likely ($\Delta\ell \sim 150$) than the decaying model $H_{decay}$. The result is robust against changes in the parameters, see Fig. F in S1 Text.

## Supporting information

### S1 Text. Additional analysis and figures.

* Effective two-state model for hippocampal CANN activity

* Effects of parameters on the model properties

* Relationship between sojourn time and correlation time

* Inference of path-integrator realignment times: discussion on parameters $p_0$ and $p_e$

* Independence of frequency of flickers from delay after light switch: parameters $p_0$, $p_e$, and $L_0$

* Assessment of performances of map decoder
* Dependence of positional-error analysis with $L_0$. (PDF)

**S1 Video.** Flickering dynamics in simulated teleportation session. Blue dots represent the place field centers (left: PF in environment A, right: PF in environment B) of active neurons in each simulated time bin. The red cross marks the instantaneous position of the rat. The teleportation event and the realignment time of the path integrator are marked with a red and a green line, respectively. Blue and orange lines represent, respectively, $-\sum_{i<j} J_{ij}^A s_i^t s_j^t$ and $-\sum_{i<j} J_{ij}^B s_i^t s_j^t$, $s_i^t$ being the binary activity of neuron *i* in time bin *t*, see Main text, Methods.

Parameters used in this simulation: $\beta = 15$, $\gamma_V = \gamma_{PI} = 0.35$, *N* (number of neurons) = 500. The trajectory of the animal and teleportation times from the original experimental recordings [27] are used in all simulations.

(MP4)

## Acknowledgments

We are grateful to K. Jezek for providing us with the data of [27] and for fruitful discussions. We thank C. Schmidt-Hieber for insightful discussions and comments. We thank F. Rizzato, J. Tubiana, and S. Wolf for critical reading of the manuscript.

## Author Contributions

**Conceptualization:** Lorenzo Posani, Simona Cocco, Rémi Monasson.

**Investigation:** Lorenzo Posani, Simona Cocco, Rémi Monasson.

**Methodology:** Lorenzo Posani, Simona Cocco, Rémi Monasson.

**Software:** Lorenzo Posani, Simona Cocco, Rémi Monasson.

**Writing – original draft:** Lorenzo Posani, Simona Cocco, Rémi Monasson.

**Writing – review & editing:** Lorenzo Posani, Simona Cocco, Rémi Monasson.

## References

1. O'Keefe J. Place units in the hippocampus of the freely moving rat. Experimental neurology. 1976; 51(1):78-109. https://doi.org/10.1016/0014-4886(76)90055-8 PMID: 1261644

2. Manns JR, Eichenbaum H. A cognitive map for object memory in the hippocampus. Learning & Memory. 2009; 16(10):616-624. https://doi.org/10.1101/lm.1484509

3. O'keefe J, Conway D. Hippocampal place units in the freely moving rat: why they fire where they fire. Experimental brain research. 1978; 31(4):573-590. PMID: 658182

4. O'Keefe J, Speakman A. Single unit activity in the rat hippocampus during a spatial memory task. Experimental brain research. 1987; 68(1):1-27. PMID: 3691688

5. Muller RU, Kubie JL. The effects of changes in the environment on the spatial firing of hippocampal complex-spike cells. Journal of Neuroscience. 1987; 7(7):1951-1968. https://doi.org/10.1523/JNEUROSCI.07-07-01951.1987 PMID: 3612226

6. Anderson MI, Jeffery KJ. Heterogeneous modulation of place cell firing by changes in context. Journal of Neuroscience. 2003; 23(26):8827-8835. https://doi.org/10.1523/JNEUROSCI.23-26-08827.2003 PMID: 14523083

7. Smith DM, Mizumori SJ. Hippocampal place cells, context, and episodic memory. Hippocampus. 2006; 16(9):716-729. https://doi.org/10.1002/hipo.20208 PMID: 16897724

8. Allen TA, Salz DM, McKenzie S, Fortin NJ. Nonspatial sequence coding in CA1 neurons. Journal of Neuroscience. 2016; 36(5):1547-1563. https://doi.org/10.1523/JNEUROSCI.2874-15.2016 PMID: 26843637

9. Bostock E, Muller RU, Kubie JL. Experience-dependent modifications of hippocampal place cell firing. Hippocampus. 1991; 1(2):193-205. https://doi.org/10.1002/hipo.450010207 PMID: 1669293
10. Leutgeb S, Leutgeb JK, Barnes CA, Moser EI, McNaughton BL, Moser MB. Independent codes for spatial and episodic memory in hippocampal neuronal ensembles. Science. 2005; 309(5734):619–623. https://doi.org/10.1126/science.1114037 PMID: 16040709

11. Fyhn M, Hafting T, Treves A, Moser MB, Moser EI. Hippocampal remapping and grid realignment in entorhinal cortex. Nature. 2007; 446(7132):190–194. https://doi.org/10.1038/nature05601 PMID: 17322902

12. Rolls ET. An attractor network in the hippocampus: theory and neurophysiology. Learning & Memory. 2007; 14(11):714–731. https://doi.org/10.1101/lm.631207

13. Guzman SJ, Schlögl A, Frotscher M, Jonas P. Synaptic mechanisms of pattern completion in the hippocampal CA3 network. Science. 2016; 353:1117–1123. https://doi.org/10.1126/science.aaf1836 PMID: 27609885

14. Amari Si. Dynamics of pattern formation in lateral-inhibition type neural fields. Biological cybernetics. 1977; 27(2):77–87. https://doi.org/10.1007/BF00337259 PMID: 911931

15. Tsodyks M, Sejnowski T. Associative memory and hippocampal place cells. International journal of neural systems. 1995; 6:81–86.

16. Samsonovich A, McNaughton BL. Path integration and cognitive mapping in a continuous attractor neural network model. Journal of Neuroscience. 1997; 17(15):5900–5920. https://doi.org/10.1523/JNEUROSCI.17-15-05900.1997 PMID: 9221787

17. Battaglia FP, Treves A. Attractor neural networks storing multiple space representations: a model for hippocampal place fields. Physical Review E. 1998; 58(6):7738. https://doi.org/10.1103/PhysRevE.58.7738

18. Hopfield JJ. Neurodynamics of mental exploration. Proceedings of the National Academy of Sciences. 2010; 107(4):1648–1653. https://doi.org/10.1073/pnas.0913991107

19. Monasson R, Rosay S. Crosstalk and transitions between multiple spatial maps in an attractor neural network model of the hippocampus: Phase diagram. Physical review E. 2013; 87(6):062813. https://doi.org/10.1103/PhysRevE.87.062813

20. Kelemen E, Fenton AA. Dynamic grouping of hippocampal neural activity during cognitive control of two spatial frames. PLoS biology. 2010; 8(6):e1000403. https://doi.org/10.1371/journal.pbio.1000403 PMID: 20585373

21. Geva-Sagiv M, Romani S, Las L, Ulanovsky N. Hippocampal global remapping for different sensory modalities in flying bats. Nature neuroscience. 2016; 19(7):952. https://doi.org/10.1038/nn.4310 PMID: 27239936

22. McNaughton BL, Battaglia FP, Jensen O, Moser EI, Moser MB. Path integration and the neural basis of the 'cognitive map'. Nature Reviews Neuroscience. 2006; 7(8):663–678. https://doi.org/10.1038/nrn1932 PMID: 16858394

23. Mittelstaedt ML, Mittelstaedt H. Homing by path integration in a mammal. Naturwissenschaften. 1980; 67(11):566–567. https://doi.org/10.1007/BF00450672

24. Gothard KM, Skaggs WE, McNaughton BL. Dynamics of mismatch correction in the hippocampal ensemble code for space: interaction between path integration and environmental cues. Journal of Neuroscience. 1996; 16(24):8027–8040. https://doi.org/10.1523/JNEUROSCI.16-24-08027.1996 PMID: 8987829

25. Chen G, King JA, Burgess N, O'Keefe J. How vision and movement combine in the hippocampal place code. Proceedings of the National Academy of Sciences. 2013; 110(1):378–383. https://doi.org/10.1073/pnas.1215834110

26. Haas O, Henke J, Lebold C, Thurley K. Distinct Subpopulations of Locomotion- and Vision-Induced Place Fields in the Hippocampus. Submitted. 2019; 16(24):8027–8040.

27. Jezek K, Henriksen EJ, Treves A, Moser EI, Moser MB. Theta-paced flickering between place-cell maps in the hippocampus. Nature. 2011; 478(7368):246–249. https://doi.org/10.1038/nature10439 PMID: 21964339

28. Posani L, Cocco S, Ježek K, Monasson R. Functional connectivity models for decoding of spatial representations from hippocampal CA1 recordings. Journal of Computational Neuroscience. 2017; p. 1–17.

29. Zhang K, Ginzburg I, McNaughton BL, Sejnowski TJ. Interpreting neuronal population activity by reconstruction: unified framework with application to hippocampal place cells. Journal of neurophysiology. 1998; 79(2):1017–1044. https://doi.org/10.1152/jn.1998.79.2.1017 PMID: 9463459

30. Brown EN, Frank LM, Tang D, Quirk MC, Wilson MA. A statistical paradigm for neural spike train decoding applied to position prediction from ensemble firing patterns of rat hippocampal place cells. Journal of Neuroscience. 1998; 18(18):7411–7425. https://doi.org/10.1523/JNEUROSCI.18-18-07411.1998 PMID: 9736661
31. Stella F, Treves A. Associative memory storage and retrieval: involvement of theta oscillations in hippocampal information processing. Neural plasticity. 2011; 2011. https://doi.org/10.1155/2011/683961 PMID: 21961072

32. Barry C, Burgess N. Neural mechanisms of self-location. Current Biology. 2014; 24(8):R330–R339. https://doi.org/10.1016/j.cub.2014.02.049 PMID: 24735859

33. Cocco S, Monasson R, Posani L, Rosay S, Tubiana J. Statistical physics and representations in real and artificial neural networks. Physica A: Statistical Mechanics and its Applications. 2017; p. https://doi.org/10.1016/j.physa.2017.11.153.

34. Cocco S, Monasson R, Posani L, Tavoni G. Functional networks from inverse modeling of neural population activity. Current Opinion in Systems Biology. 2017; https://doi.org/10.1016/j.coisb.2017.04.017

35. Schneidmann E, Berry MJ, Segev R, Bialek W. Weak pairwise correlations imply strongly correlated network states in a population. Nature. 2006; 440:1007–1012. https://doi.org/10.1038/nature04701

36. Monasson R, Rosay S. Transitions between spatial attractors in place-cell models. Physical review letters. 2015; 115(9):098101. https://doi.org/10.1103/PhysRevLett.115.098101 PMID: 26371684

37. Monasson R, Rosay S. Crosstalk and transitions between multiple spatial maps in an attractor neural network model of the hippocampus: Collective motion of the activity. Physical review E. 2014; 89(3): 032803. https://doi.org/10.1103/PhysRevE.89.032803

38. Mark S, Romani S, Jezek K, Tsodyks M. Theta-paced flickering between place-cell maps in the hippocampus: A model based on short-term synaptic plasticity. Hippocampus. 2017; 27. https://doi.org/10.1002/hipo.22743 PMID: 28558154

39. Keller GB, Bonhoeffer T, Hübener M. Sensorimotor mismatch signals in primary visual cortex of the behaving mouse. Neuron. 2012; 74(5):809–815. https://doi.org/10.1016/j.neuron.2012.03.040 PMID: 22681686

40. Bush D, Barry C, Burgess N. What do grid cells contribute to place cell firing? Trends in neurosciences. 2014; 37(3):136–145. https://doi.org/10.1016/j.tins.2013.12.003 PMID: 24485517

41. Fuhs MC, Touretzky DS. A Spin Glass Model of Path Integration in Rat Medial Entorhinal Cortex. Journal of Neuroscience. 2006; 26(16):4266–4276. https://doi.org/10.1523/JNEUROSCI.4353-05.2006 PMID: 16624947

42. Burak Y, Fiete IR. Accurate path integration in continuous attractor network models of grid cells. PLoS computational biology. 2009; 5(2):e1000291. https://doi.org/10.1371/journal.pcbi.1000291 PMID: 19229307

43. Kim SS, Rouault H, Druckmann S, Jayaraman V. Ring attractor dynamics in the Drosophila central brain. Science. 2017; 356(6340):849–853. https://doi.org/10.1126/science.aal4835 PMID: 28473639

44. Wimmer K, Nykamp DQ, Constantinidis C, Compte A. Bump attractor dynamics in prefrontal cortex explains behavioral precision in spatial working memory. Nature neuroscience. 2014; 17(3):431–439. https://doi.org/10.1038/nn.3645 PMID: 24487232

45. Wills TJ, Lever C, Cacucci F, Burgess N, O'keefe J. Attractor dynamics in the hippocampal representation of the local environment. Science. 2005; 308(5723):873–876. https://doi.org/10.1126/science.1108905 PMID: 15879220

46. Yoon K, Buice MA, Barry C, Hayman R, Burgess N, Fiete IR. Specific evidence of low-dimensional continuous attractor dynamics in grid cells. Nature neuroscience. 2013; 16(8):1077–1084. https://doi.org/10.1038/nn.3450 PMID: 23852111

47. Treves A, Rolls ET. Computational analysis of the role of the hippocampus in memory. Hippocampus. 1994; 4(3):374–391. https://doi.org/10.1002/hipo.450040319 PMID: 7842058

48. Schmidt-Hieber C, Toleikyte G, Aitchison L, Roth A, Clark BA, Branco T, et al. Active dendritic integration as a mechanism for robust and precise grid cell firing. Nature neuroscience. 2017; 20(8):1114. https://doi.org/10.1038/nn.4582 PMID: 28628104

49. Stella F, Cerasti E, Si B, Jezek K, Treves A. Self-organization of multiple spatial and context memories in the hippocampus. Neuroscience & Biobehavioral Reviews. 2012; 36(7):1609–1625. https://doi.org/10.1016/j.neubiorev.2011.12.002

50. Colgin LL, Denninger T, Fyhn M, Hafting T, Bonnevie T, Jensen O, et al. Frequency of gamma oscillations route flow of information in the hippocampus. Nature. 2009; 462(7271):353. https://doi.org/10.1038/nature08573 PMID: 19924214

51. Igarashi KM, Lu L, Colgin LL, Moser MB, Moser El. Coordination of entorhinal-hippocampal ensemble activity during associative learning. Nature. 2014; 510(7503):143. https://doi.org/10.1038/nature13162 PMID: 24739966

52. Hafting T, Fyhn M, Molden S, Moser MB, Moser El. Microstructure of a spatial map in the entorhinal cortex. Nature. 2005; 436(7052):801–806. https://doi.org/10.1038/nature03721 PMID: 15965463
53. Gil M, Ancau M, Schlesiger MI, Neitz A, Allen K, De Marco RJ, et al. Impaired path integration in mice with disrupted grid cell firing. Nature neuroscience. 2018; 21(1):81. https://doi.org/10.1038/s41593-017-0039-3 PMID: 29230055

54. Savelli F, Luck J, Knierim JJ. Framing of grid cells within and beyond navigation boundaries. eLife. 2017; 6. https://doi.org/10.7554/eLife.21354 PMID: 28084992

55. Monaco JD, Abbott LF. Modular realignment of entorhinal grid cell activity as a basis for hippocampal remapping. Journal of Neuroscience. 2011; 31(25):9414-9425. https://doi.org/10.1523/JNEUROSCI.1433-11.2011 PMID: 21697391

56. Van Strien NM, Cappaert N, Witter MP. The anatomy of memory: an interactive overview of the parahip-pocampal-hippocampal network. Nature Reviews Neuroscience. 2009; 10(4):272-282. https://doi.org/10.1038/nrn2614 PMID: 19300446

57. Bonnevie T, Dunn B, Fyhn M, Hafting T, Derdikman D, Kubie JL, et al. Grid cells require excitatory drive from the hippocampus. Nature neuroscience. 2013; 16(3):309-317. https://doi.org/10.1038/nn.3311 PMID: 23334581

58. Hardcastle K, Ganguli S, Giocomo LM. Environmental boundaries as an error correction mechanism for grid cells. Neuron. 2015; 86(3):827-839. https://doi.org/10.1016/j.neuron.2015.03.039 PMID: 25892299

59. Cocco S, Monasson R. Adaptive cluster expansion for the inverse Ising problem: convergence, algorithm and tests. J Stat Phys. 2012; 147(2):252-314. https://doi.org/10.1007/s10955-012-0463-4

60. Barton JP, Cocco S. Ising models for neural activity inferred via selective cluster expansion: Structural and coding properties. J Stat Mech. 2013; p. P03002. https://doi.org/10.1088/1742-5468/2013/03/P03002

61. Barton J, De Leonardis E, Coucke A, Cocco S. ACE: adaptive cluster expansion for maximum entropy graphical model inference. Bioinformatics. 2016; https://doi.org/10.1093/bioinformatics/btw328

62. Cocco S, Monasson R. Adaptive cluster expansion for inferring Boltzmann machines with noisy data. Physical review letters. 2011; 106(9):090601. https://doi.org/10.1103/PhysRevLett.106.090601 PMID: 21405611

63. MacKay DJ. Information Theory, Inference and Learning Algorithms. Cambridge University Press; 2003.

64. Akaike H. A new look at the statistical model identification. IEEE transactions on automatic control. 1974; 19(6):716-723. https://doi.org/10.1109/TAC.1974.1100705