Self-healing neural codes: Hebbian and homeostatic mechanisms can track evolving neural representations

Recent studies have found that the tuning of neurons to behavioral variables “drifts” over time in many parts of the brain, even in the absence of measurable changes in behavior. This drift retains task information at the population level while allowing individual cells to change their tuning substantially. At the same time, other circuits exhibit long-term stability in tuning at the single cell level. How can unstable and stable neuronal populations interoperate reliably, and how might single cells maintain stable readout from a drifting population code? We explore how known plasticity mechanisms allow single neurons to retain learned representations without external error feedback. We nd that interactions between Hebbian learning and single-cell homeostasis can exploit redundancy in a distributed population code to compensate for gradual changes in tuning. Recurrent feedback of partially stabilized readouts allows a pool of readout cells to further correct inconsistencies introduced by representational drift without an external learning signal. This shows how relatively simple, known mechanisms can stabilize neural tuning in the short term, and provides a plausible circuit architecture for long term maintenance of neural tuning. Our ndings suggest a novel role for Hebbian plasticity in retaining existing memories as opposed to learning new associations.


September 9, 2021
Recent studies have found that the tuning of neurons to behavioral variables "drifts" over time in many parts of the brain, even in the absence of measurable changes in behavior. This drift retains task information at the population level while allowing individual cells to change their tuning substantially. At the same time, other circuits exhibit long-term stability in tuning at the single cell level. How can unstable and stable neuronal populations interoperate reliably, and how might single cells maintain stable readout from a drifting population code? We explore how known plasticity mechanisms allow single neurons to retain learned representations without external error feedback. We nd that interactions between Hebbian learning and single-cell homeostasis can exploit redundancy in a distributed population code to compensate for gradual changes in tuning. Recurrent feedback of partially stabilized readouts allows a pool of readout cells to further correct inconsistencies introduced by representational drift without an external learning signal. This shows how relatively simple, known mechanisms can stabilize neural tuning in the short term, and provides a plausible circuit architecture for long term maintenance of neural tuning. Our ndings suggest a novel role for Hebbian plasticity in retaining existing memories as opposed to learning new associations.
The cellular and molecular components of the brain change continually. In addition to synaptic turnover (1), ongoing recon guration of the tuning properties of single neurons has been seen in parietal (2), frontal (3), visual (4,5), and olfactory (6) cortices, and the hippocampus (7,8). Remarkably, the "representational drift" (9) observed in these studies occurs without any obvious change in behavior or task performance. Reconciling dynamic reorganization of neural activity with stable circuit-level properties remains a major open challenge (9,10). Furthermore, not all circuits in the brain show such proli c recon guration, including populations in primary sensory and motor cortices (11)(12)(13). How might populations with stable and drifting neural tuning communicate reliably? Put another way, how can an internally consistent 'readout' of neural representations survive changes in the tuning of individual cells?
These recent, widespread observations suggest that neural circuits can preserve learned associations at the population level while allowing the functional role of individual neurons to change (14)(15)(16). Such preservation is made possible by redundancy in population codes, because a distributed readout allows changes in the tuning of individual neurons to be o set by changes in others. However, this kind of stability is not automatic: changes in tuning must either be constrained in speci c ways (e.g. 17,18), or corrective plasticity needs to adapt the readout (19). Thus, while there are proposals for what might be required to maintain population codes dynamically, there are few suggestions as to how this might be implemented with known cellular mechanisms and without recourse to external reference signals that re-calibrate population activity to behavioral events and stimuli.
In this paper we show that neural tuning in a readout population can be made resilient to drift using well known plastic-ity mechanisms: Hebbian learning and homeostatic plasticity. Homeostasis is a feature of all biological systems, and examples of homeostatic plasticity in the nervous system are pervasive (e.g. 20, 21 for reviews). Broadly, homeostatic plasticity is a negative feedback process that maintains physiological properties such as average ring rates (e.g. 22), neuronal variability (e.g. 23), distributions of synaptic strengths (e.g. 24,25), and population-level statistics (e.g. 26). Hebbian plasticity complements homeostatic plasticity by strengthening connectivity between cells that undergo correlated ring, further reinforcing correlations (27,28). Pairwise correlations in a population provide local bases for a so-called task manifold in which taskrelated neural activity resides (29). We show that these two Signi cance The brain recon gures connections continuously while maintaining stable long-term memories and learned skills. This work examines how stable neural population codes can be maintained internally using known cellular mechanisms, despite large ongoing changes in connectivity. We show how Hebbian plasticity interacts with homeostasis in single neurons to allow a circuit to continuously repair a learned representation. This provides a plausible mechanism for retaining neural representations without reference to an external learning signal, and suggests a novel role for Hebbian plasticity in memory maintenance as opposed to learning.
Author Contributions TO: Conceptualization, Funding acquisition, Project administration, Supervision, Writing -review & editing MR: Conceptualization, Formal analysis, Investigation, Methodology, Simulation, Visualization, Writing -original draft, Writing -review & editing mechanisms can operate on a redundant neural representation to constrain drift and preserve the global structure of a population code.
We rst illustrate how single-cell feedback regulation can stabilize the information-coding capacity of a population; We then show how population-level feedback allows learned representations to be read out from unstable neural populations. This implies that long-term stability of learned associations is consistent with substantial instability in the neural codes that drive these associations, through relatively simple, known mechanisms. This implies a previously unidenti ed role for Hebbian plasticity in maintaining associations, as opposed to learning new ones.

Background
We brie y review representational drift and the broader context of the ideas used in this manuscript. Representational drift refers to seemingly random changes in neural responses during a habitual task that are not associated with learning (9). For example, in Driscoll et al. (2) mice navigated to one of two endpoints in a T-shaped maze (Fig. 1a), based on a visual cue. Population activity in Posterior Parietal Cortex (PPC) was recorded over several weeks using uorescence calcium imaging. Neurons in PPC were tuned to the animal's past, current, and planned behavior. Gradually, the tuning of individual cells changed: neurons could change the location in the maze in which they red, or become disengaged from the task (Fig.  1b). The neural population code eventually recon gured completely (Fig. 1c). However, neural tunings continued to tile the task, indicating stable task information at the population level. These features of drift have been observed throughout the brain (4,5,8).
Downstream readouts could track gradual drift using external error feedback to re-learn how to interpret an evolving neural code, e.g. during ongoing rehearsal (19). Indeed, simulations con rm that learning in the presence of noise can lead to a steady state, in which drift is balanced by error feedback (30)(31)(32)(33). Previous studies have also shown that stable functional connectivity could be maintained despite synaptic turnover (30,34,35). Recent work has also found that discrete representations can be stabilized using neural assemblies that exhibit robust, all-or-nothing reactivation (36,37).
Our work extends these results as follows. Rather than using external learning signals (19,(30)(31)(32), we show that drift can be tracked using internally generated signals. We allow the functional role of neurons in an encoding population to recon gure completely, rather than just the synaptic connectivity (30,34,35). We extend ideas based on neuronal assemblies (36,37) to address the low-dimensional manifold dynamics observed in sensorimotor tasks (38) and spatial navigation (2,7). The geometry of these representations is consistent over time, although the way it is re ected in neuronal ring changes (39,40). Engineers have applied online recalibration and transfer learning and to track drift in brain-machine interface decoders (e.g. 41; 42 for review). Could neural circuits in the brain do something similar? We argue that neuronal homeostasis and Hebbian plasticity driven by internally generated prediction errors allows neural networks to "self heal".

Results
We explore how neural networks could track drift in lowdimensional manifold representations. There are two important general principles to keep in mind throughout. First, distributed neural representations are redundant. To create ambiguity at the macroscopic level, many smaller disruptive changes must occur in a coordinated way. Neurons can exploit this to improve their robustness to drift. Second, learning creates recurrent connections that allow neural populations to model and predict the world. Even if learning has ceased, these connections continue to constrain activity. This could allow a downstream readout to correct errors caused by by drift, and use this corrected readout as a training signal.
We rst describe a model of representational drift, in which homeostasis stabilizes the capacity of a "drifting" population to encode information despite instability in single-neuron tunings. We then explore how a single neuron could stabilize its own readout in the presence of this upstream drift. In the latter half of the manuscript, we show that these rules imply a form of Hebbian learning that achieves homeostasis. We extend these ideas to neural populations, and show that recurrent dynamics can stabilize a readout of an unstable neural code.

A model for representational drift
We have previously used the data from Driscoll et al. (43) to assess how much plasticity would be required to track drift in a linear readout (19). However, these data contain gaps of several days, and the number of high signal-to-noise units tracked for over a month is limited. To explore continual, long-term drift, we therefore construct a model inspired by the features of representational drift seen in spatial navigation tasks (2,7).
We focus on key properties of drift seen experiments. In both (2) and (7), neural populations encode continuous, lowdimensional behavioral variables (e.g. location). Neurons exhibit localized, 'bump-like' tuning to these variables. Tuning curves overlap, creating a redundant code. Over time, neurons change their preferred tunings. Nevertheless, on any given day there is always a complete 'tiling' of a behavioral variable, indicating stability at the population level.
To model this, we consider a population of neurons that encode a behavioral variable, . We assume lies on a low-dimensional manifold, and is encoded in the vector of ring rates in a neural population with tuning curves x ( )={ ,1 ( ), .., , ( )} . These tunings change over time (day ).
We abstract away some details seen the experimental data in Fig. 1c. We focus on the slow component of drift, and model excess day-to-day tuning variability via a con gurable parameter. We assume uniform coverage of the encoded space, which can be ensured by an appropriate choice of coordinates. We consider populations of 100 units that encode , and whose tunings evolve independently. Biologically, noise correlations and uctuating task engagement would limit redundancy, but this would be o set by the larger number of units available.
To model drift, we rst have to model an encoding 'feature' population whose responses depend on , and from which it is possible to construct bump-like tuning with a weighted readout. To keep our assumptions general, we do not assume that the encoding population has sparse, bump-like activity, and simply de ne a set of random features (tuning curves), sampled independently from a random Gaussian process on . These features have an arbitrary but stable relationship to the external world, from which it is possible to reconstruct by choosing su ciently large : In the above equations, Σ( , ) denotes the covariance between the values of ( ) at two states and .
We next de ne an encoding of driven by these features with a drifting weight matrix U ={u ,1 , .., u , }, where u , ={ , ,1 , .., , , } re ects the encoding weights for unit , ( ) on day . Each weight , , evolves as a discrete-time Ornstein-Uhlenbeck (OU) process, taking a new value on each day (Methods: Simulated drift). The ring rate of each encoding unit is given as a nonlinear function of the synaptic activation where and are vectors that set the sensitivity and threshold of each unit. To model the nonlinear response of the readout and prevent negative ring rates, we use an exponential nonlinearity (·) = exp(·).
In this model, the mean ring-rate and population sparsity of the readout can be tuned by varying the sensitivity and threshold in Eq. (2). In vivo, these single cell properties are regulated by homeostasis (23). Stabilizing mean rates , ( ) ≈ 0 ensures that neurons remain active. Stabilizing rate variability var [ , ( )] ≈ 2 0 controls population code sparsity, ensuring that x ( ) carries information about (44). This is achieved by adapting the bias and gain of each unit , ( ) based on the errors , between the statistics of neural activity and the homeostatic targets 0 , 0 : Fig. 1 shows that this model qualitatively matches the drift seen in vivo (2). Tuning is typically stable, with intermittent changes (Fig. 1e). This occurs because the homeostatic regulation in Eq. (3) adjusts neuronal sensitivity and threshold to achieve a localized, bump-like tuning curve at the location of peak synaptic activation, 0 . Changes in tuning arise when the drifting weight matrix causes the encoding neuron to be driven more strongly at a new value of . The simulated population code recon gures gradually and completely over a period of time equivalent to several weeks in the experimental data ( Fig.  1f).
Hebbian homeostasis improves readout stability without external error feedback Neural population codes are often redundant, with multiple units responding to similar task features. Distributed readouts of redundant codes can therefore be robust to small changes in the tuning of individual cells. We explored the consequences of using such a readout as an internal error signal to retrain synaptic weights in a readout population, thereby compensating for gradual changes in a representation without external feedback. This re-encodes a learned readout function y( ) in terms of the new neural code x ( ) on each "day" . Such "selfhealing" plasticity improves the tuning stability of neurons that are driven by unstable population codes, even in single neurons. We rst sketch an example of this plasticity, and then explore why this works.
Using our drifting population code as input, we model a readout population of neurons with tuning curves y ( ) = { ,1 ( ), .., , ( )} (Fig. 1d). We model this decoder as a linear-nonlinear function, using decoding weights W and biases (thresholds) b (leaving dependence on the day implicit): On each simulated "day", we re-train the decoding weights using an unsupervised Hebbian learning rule (c.f. 45). This potentiates weights , whose input ( ) correlates with the postsynaptic ring rate ( ). We modulate the learning rate by an estimate of the homeostatic error in ring-rate variability (˜ ). Thresholds are similarly adapted based on the homeostatic error in mean-rate (˜ ). We include a small baseline amount of weight decay ( ) and a larger amount of weight decay ( ) that is modulated by˜ . For a single readout neuron ( ), the weights and biases evolve as: We apply Eq. (5) for 100 iterations on each simulated "day", sampling over all on each iteration. We assume that the timescale of Hebbian and homeostatic plasticity is no faster than the timescale of representational drift. The error terms ,˜ are leaky integrators of instantaneous errors (Eq. (3)) for each cell, , , respectively:˜ +1 = 0.5˜ + (analogously for , ). For the readout y( ), the homeostatic targets ( 0 , 0 ) are set to the ring-rate statistics in the initial, trained state (before drift has occurred). Eq. (5) therefore acts homeostatically. Rather than scale weights uniformly, it adjusts the component of the weights most correlated with the postsynaptic output, y( ). Plasticity occurs only when homeostatic constraints are violated. Further discussion of this learning rule is given in Methods: Synaptic learning rules. To test whether the readout can tolerate complete recon guration in the encoding population, we change encoding features one at a time. For each change, we select a new, random set of encoding weights u and apply homeostatic compensation to stabilize the mean and variability of ( ). Eq. (5) is then applied to update the decoding weights of the readout cell. This procedure is applied 200 times, corresponding to two complete recon gurations of the encoding population of =100 cells (Methods: Single-neuron readout).
With xed weights, drift reduces the readout's ring rate without changing its tuning (Fig. 2a),. This is because the initial tuning of the readout requires coincident activation of speci c inputs to re for its preferred 0 . Drift gradually destroys this correlated drive, and is unlikely to spontaneously create a similar conjunction of features for some other . For small amounts of drift, homeostasis Eq. (3) can stabilize the readout by compensating for the reduction in drive (Fig. 2b). Eventually, however, no trace of the original encoding remains. At this point, a new (random) will begin to drive the readout more strongly. Homeostasis adjusts the sensitivity of the readout to form a new, bump-like tuning curve at this location. Fig. 2c shows the consequences of Hebbian homeostasis. Drift in the encoding x( ) decreases the excitatory drive to the readout, activating Hebbian learning. Because small amounts of drift have minimal e ect on tuning, the readout's own output provides a self-supervised teaching signal. It re-learns the decoding weights for inputs that have changed due to drift. Applying Hebbian homeostasis periodically improves stability, despite multiple complete recon gurations of the encoding population. In e ect, the readout's initial tuning curve is transported to a new set of weights that estimate the same function from an entirely di erent input (for further discussion see Supplement: Weight ltering). In the long term the representation degrades, for reasons we dissect in the next section.  Figure 2: Homeostatic Hebbian plasticity enables stable readout from unstable populations. (a) Simulated drift in a redundant population causes a loss of excitability, but little change in tuning, to a downstream linearnonlinear readout neuron. Since the cell is selective to a conjunction of features, it loses excitatory drive when some of its inputs change. Since most drift is orthogonal to this readout, however, the preferred tuning 0 does not change. The right-most plot shows that the excitability diminishes as a larger fraction of inputs change. Two complete recon gurations of an encoding population of 100 cells is shown. (b) Homeostatic adjustments to increase the readout's sensitivity can compensate for small amounts of drift. As more inputs recon gure, the cell compensates for loss of excitatory drive by increasing sensitivity ("gain", ). However, the readout changes to a new, random location once a substantial fraction of inputs have recon gured (right). This phenomenon is the same as the model for tuning curve drift in the encoding population (c.f. Fig. 1e). (c) Hebbian homeostasis increases neuronal variability by potentiating synaptic inputs that are correlated with post-synaptic activity, or depressing those same synapses when neuronal variability is too high. This results in the neuron re-learning how to decode its own tuning curve from the shifting population code, improving the stability of the readout despite complete recon guration (right). (Methods: Single-neuron readout)

Hebbian homeostasis with network interactions
In the remainder of the manuscript, we show how Hebbian homeostatic principles combine with population-level interactions to make readouts more robust to drift. Generally, a mechanism for tracking drift in a neural population should exhibit three features: I The readout should use redundancy to mitigate error caused by drift.
II The readout should use its own activity as a training signal to update its decoding weights.
III The correlations in input-driven activity in the readout neurons should be homeostatically preserved.
We explore three types of recurrent population dynamics that could support this: (1) Population ring-rate normalization; (2) Recurrent dynamics in the form of predictive feedback; (3) Recurrent dynamics in the form of a linear-nonlinear map. Fig.  3 summarizes the impact of each of these scenarios on a nonlinear population readout, and we discuss each in depth in the following subsections.

Population competition in unsupervised Hebbian learning
In Fig. 2c, we saw that Hebbian homeostasis improved stability in the short term. Eq. (5) acts as an unsupervised learning rule, and pulls the readout ( ) towards a family of bump-like tuning curves that tile (33). Under these dynamics, only drift Δx( ) that changes the peak of ( ) to some new, nearby 0 can persist. All other modes of drift are rejected. If the encoding population is much larger than the dimension of , there is large null space in which drift does not change the preferred tuning. However, in the long run Hebbian homeostasis drives the neural population toward a steady-state which forgets the initial tuning (Fig. 3c). This is because Hebbian learning is biased towards a few salient 0 that capture directions in x( ) with the greatest variability (28,46,47). Models of unsupervised Hebbian learning address this by introducing competition among a population of readout neurons (46,47). Such rules can track the full covariance structure of the encoding population, and lead to a readout population of bump-like tuning curves that tile the space (48)(49)(50)(51). In line with this, we incorporate response normalization into a readout population (52). This serves as a fast-acting form of ring-rate homeostasis in Eq. (3), causing neurons to compete to remain active and encouraging diverse tunings (50,53).
Because it is implemented via inhibitory circuit dynamics, we assume that this normalization acts quickly relative to plasticity, and model it by dividing the rates by the average ring rate across the population. If y ( ) is the forward (unnormalized) readout from Eq. (4), we de ne the normalized readout y ( ) by dividing out the average population rate, y ( ) M , and multiplying by a target mean rate : Response normalization improves stability (Fig. 3d). However, it does not constrain individual readout neurons to any speci c preferred 0 . The readout remains sensitive to noise and perturbations, which can cause neurons to swap preferred tunings ( Fig. 3d; Methods: Population simulations).

Error-correcting recurrent dynamics
The error-correction mechanisms explored so far use redundancy and feedback to reduce errors caused by incremental drift. However, there is no communication between di erent readouts ( ) to ensure that the correlation structure of the readout population is preserved. Could stability be improved by using population dynamics to maintain these correlations, and actively correct decoding mistakes caused by drift? Neural populations can compute prediction errors based on learned internal models (54), and experiments nd that neural population activity recapitulates (55) and predicts (56) input statistics. Theories of distributed learning predict that local populations should coordinate by exchanging prediction errors (57), and models of e cient coding posit that neural populations cancel the predictable components of their input via negative feedback (58,59). We propose that these same error signals could provide error-correction to improve the stability of neural population codes in the presence of drift.
To explore this, we consider two kinds of recurrent dynamics. We keep these models abstract. In particular, we do not specify a physiological means for how the structure of the xed recurrent connectivity emerges. Our results thus serve as hypotheses for how recurrent dynamics could interact synergistically with the simpler mechanisms we have examined so far. We rst consider a network that uses inhibitory feedback to cancel the predictable aspects of its input. This is in line with models of predictive coding (58)(59)(60). We then consider a linear-nonlinear mapping that provides a prediction of y( ) from a partially corrupted readout, using this signal to retrain readout weights.

Recurrent feedback of prediction errors
Some theories propose that neural populations retain a latent state that is used to predict future inputs (58)(59)(60). Inhibitory interneurons compare this prediction to incoming information to generate a prediction error, which is fed back through recurrent interactions to update the latent state. Here, we assume that the network contains a latent state "z" and predicts error-corrected estimates of the readout's activity,ŷ = (z), with as de ned previously. Inputs provide a feed-forward estimate y , which is corrupted by drift. The prediction error is the di erence between y andŷ. The dynamics of z are chosen as: We set the weight matrix A to the covariance of the activations z = W x during initial training (motivation for this choice is in Supplement: Predictive coding as inference). In making this choice, we assume that part of the circuit can learn and retain the covariance of z. This could in principle be achieved via Hebbian learning (45,46,61).
Assuming that a circuit can realise the dynamics in Eq. (7), the readoutŷ will be driven to match the forward predictions y . We assume that this converges rapidly relative to the timescale at which y ( ) varies. This improves the tracking of a drifting population code when combined with Hebbian homeostasis and response normalization (Fig. 3e). The readout continuously re-aligns its xed internal model with the activity in the encoding population. We brie y discuss intuition behind why one should generally expect this to work.
The recurrent weights, A , determine which directions in population-activity space receive stronger feedback. Feedback preprint (which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission.
The copyright holder for this this version posted September 9, 2021. ; https://doi.org/10.1101/2021.03.08.433413 doi: bioRxiv preprint  Figure 3: Self-healing in a nonlinear rate network. Each plot shows (left) a population readout y( ) from a drifting code x( ) of =100 cells; (middle) a schematic of the readout dynamics; and (right) a plot of readout tuning after applying each learning rule if 60% of the encoding cells were to change to a new tuning (Methods: Population simulations). (a) For xed weights, drift destroys the correlated activity readout degrades with increasing drift. Drift is gradual, with =100. The simulated time frame corresponds to ≈10 complete recon gurations. (b) Homeostasis increases the sensitivity to compensate for loss of drive, but cannot stabilize tuning ( 2 : ring-rate variance, 2 0 : target variance, : homeostatic error, Δ : gain adjustment). (c) Hebbian homeostasis (Eq. 5) restores drive using the readout's output as a learning signal. Error correction is imperfect and Hebbian learning biases tuning toward that drive more variability in the encoding population. (ΔW: weight updates) (d) Response normalization (Eq. 7) stabilizes the population statistics, but readout neurons can swap preferred tunings. (ŷ: normalized response). (e) An additional linear-nonlinear map (Eq. 8) pools information over the population, providing better error correction (y : feed-forward estimates, A: recurrent weights). (f) Predictive coding (Eq. 6) uses a learned internal model of y( ) to correct errors caused by drift ( indicates dynamics in time). through larger eigenmodes of A is ampli ed, and these modes are more rapidly driven to track y . Due to the choice of A as the covariance of z, the dominant modes re ect directions in population activity that encode . Conversely, minor eigenmodes are weakly in uenced by y , and ignored by the readout. This removes directions in population activity that are unrelated to , thereby correcting errors in the readout activity caused by drift.
In summary, Eq. (7) captures qualitative dynamics implied by some theories of predictive coding. If neural populations update internal states based on prediction errors, then only errors related to tracking variations in should be tracked aggressively. This causes the readout to ignore "o manifold" activity inŷ( ) caused by drift. However, other models of recurrent dynamics also work, as we explore next.

Low-dimensional manifold dynamics
Recurrent dynamics with a manifold of stable (or nearly stable) solutions distributed over could also support error correction. We model this by training the readout to make a predictionŷ of its own activity based on the feed-forward activity y , via a linear-nonlinear map, (c.f. 62): with timestep, , and recurrent weights and biases A and v (Methods: Learning recurrent weights). We chose this discrete mapping for computational expediency, and Eq. (8) was applied once for each input ( ) alongside response normalization. In simulations, the recurrent mapping is also e ective at correcting errors caused by drift, improving readout stability (Fig. 3f). We brie y address some caveats that apply to both models of recurrent dynamics. The combination of recurrent dynamics and Hebbian learning is potentially destabilizing, because leaning can transfer biased predictions into the decoding weights. Empirically, we nd that homeostasis (Eq. 3) prevents this, but must strong enough to counteract all destabilizing in uences. Additionally, when the underlying has continuous symmetries, drift can occur along these symmetries. This is evidenced by a gradual, di usive rotation of the code for e.g. a circular environment. Other manifolds, like the T-shaped maze in (2), have no continuous symmetries and are not susceptible to this e ect (Supplemental Figure S4). Overall, these simulations illustrate that internal models can constrain network activity. This provides ongoing error correction, preserves neuronal correlations, and allows neural populations to tolerate substantial recon guration of the inputs that drive them.

Discussion
In this work, we outlined homeostatic principles that could allow stable and plastic representations to coexist in the brain. We argue that self-healing codes should have three components: (I) Neuronal responses should be robust to small amounts of drift; (II) Neurons should use their own output as a training signal to update their decoding weights, and (III) Stable codes should homeostatically preserve internal models, which are re ected in stable population statistics.
Hebbian plasticity is synonymous with learning novel associations in much of contemporary neuroscience. Our ndings o er the complementary hypothesis that Hebbian mechanisms can also reinforce learned associations in the face of ongoing change. This view is compatible with the observation that Hebbian plasticity is a positive feedback process, where existing correlations become strengthened, in turn promoting correlated activity. At an abstract level, positive feedback is a key ingredient of any memory retention mechanism because it rejects external disturbances by reinforcing existing states.
Homeostasis, by contrast, is typically seen as antidote to possible runaway Hebbian plasticity (63). However, this idea is problematic due to the relatively slow timescale at which homeostasis acts (25). Our ndings posit a richer role for homeostatic (negative) feedback in maintaining and distributing responsiveness in a population. This is achieved by regulating the mean and the variance of neural activity (23).
We considered two populations, a drifting population that encodes a variable, and another that extracts a drift-resilient 6 preprint (which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission.
The copyright holder for this this version posted September 9, 2021. ; readout. This could re ect communication between stable and plastic components of the brain, or the interaction between stable and plastic neurons within the same circuit. This is consistent with experiments that nd consolidated stable representations (12,16), or with the view that neural populations contain a mixture of stable and unstable cells (64).
By itself, Hebbian homeostasis preserves population codes in the face of drift over a much longer timescale than the lifetime of a code with xed readout (Fig. 2). Even though this mechanism ultimately corrupts a learned tuning, the time horizon over which the code is preserved may be adequate in a biological setting, particularly in situations where there are intermittent opportunities to reinforce associations behaviourally. In the absence of external feedback, extending the lifetime of this code still further required additional assumptions about circuit structures that remain to be tested experimentally.
We found that a readout population can use an internal model to maintain a consistent interpretation of an unstable encoding population. Such internal models are widely hypothesized to exist in various guises (54,59,60). We therefore did not address how these internal models are learned initially, or how they might be updated. We conjecture that the error signals used in the internal models are the same ones that would be used for initial (or ongoing) learning. Since changes in weights are driven by correlations between presynaptic and postsynaptic activity, modulating the relative in uence of internal dynamics and external inputs could regulate the balance between homeostatic repair and new learning. By setting xed recurrent weights, we are also assuming that some connectivity in the circuit is una ected by drift. This may be reasonable, given that functional connectivity in some circuits is found to be stable (13).
The recurrent architectures we studied here are reminiscent of mechanisms that attenuate forgetting via replay (e.g. 65,66). The internal models must be occasionally re-activated through rehearsal or replay to detect and correct inconsistencies caused by drift. If this process occurs infrequently, drift becomes large, and the error correction will fail. The brain supports both stable and volatile representations, typically associated with memory retention and learning, respectively. Arti cial neural networks have so far failed to imitate this, and su er from catastrophic forgetting wherein new learning erases previously learned representation (67). Broadly, proposed strategies to mitigate this segregate stable and unstable representations into distinct subspaces of the possible synaptic weight changes (c.f. 18). These learning rules therefore prevent disruptive drift in the rst place. The mechanisms explored here do not restrict changes in weights or activity: the encoding population is free to recon gure arbitrarily. However, any change in a neural code leads to an equal and opposite change in how that code is interpreted-The brain must publish new translations of its changing internal language. This preserves the functional relationships between neurons.
To integrate stable and plastic representations, changes anywhere in the brain should be accompanied by compensatory changes throughout the brain. The learning rules explored here emphasized Hebbian homeostasis and the role of predictive models in generating robust representations. In the long term, these processes could support widespread reallocation or reconsolidation of neuronal function. Further exploration of these principles may clarify how the brain can be simultaneously plastic and stable, and provide clues to how to build arti-cial networks that share these properties.

Materials and Methods
Data and analysis Data shown in Fig. 1b,c were taken from Driscoll et al. (2), and are available online at at Dryad (43). Examples of tuning curve drift were taken from mouse four, which tracked a sub-population of cells for over a month using calcium uorescence imaging. Normalized log-uorescence signals (ln[ / ]) were ltered between 0.3 and 3 Hz (4 th Butterworth, forward-backward ltering), and individual trial runs through the T maze were extracted. Traces from select cells were aligned based on task pseudotime (0: start, 1: reward). On each day, log-uorescence was averaged over all trials and exponentiated to generate the average tuning curves shown in Fig. 1b.  For Fig. 1c, a random sub-population of forty cells was sorted based on their peak ring location on the rst day. For further details, see (2,19).
Simulated drift We modeled drift as a discrete-time Ornstein-Uhlenbeck (OU) random walk on encoding weights U, with time constant (in days) and per-day noise variance . We set the noise variance to =2/ to achieve unit steady-state variance. Encoding weights for each day are sampled as: These drifting weights propagate the information about available in the features s( ) (Eq. 1) to the encoding units x( ), in a way that changes randomly over time. This random walk in encoding-weight space preserves the population code statistics on average: It preserves the geometry of in the correlations of a ( ), and the average amount of information about encoded in the population activations (Supplement: Stability of encoded information). This implies that the di culty of reading out a given tuning curve ( ) (in terms of the L2 norm of the decoding weights, w 2 ) should remain roughly constant over time. This assumption, that x( ) encodes a stable representation for in an unstable way, underlies much of the robustness we observe. We discuss this further in Methods: Synaptic learning rules.
Because the marginal distribution of the encoding weights on each day is Gaussian, U ∼ N (0, ), the synaptic activations a ( ) = U s( ) are samples from a Gaussian process on , with covariance inherited from s( ) (Supplement: Gaussian-process tuning curves). In numerical experiments, we sampled the synaptic activation functions a ( ) from this Gaussian process directly. We simulated ∈ [0, 1) over a discrete grid with 60 bins, sampling synaptic activations from a zero-mean Gaussian process on with a spatially-low-pass squaredexponential kernel ( = 0.1). The gain and threshold (Eq. 2) for each encoding unit was homeostatically adjusted for a target meanrate of 0 = 5 and rate variance of 2 0 = 25 (in arbitrary units). This was achieved by running Eq. (3) for 50 iterations with rates = 0.1, = 0.2 for the gain and bias homeostasis, respectively. To show that the readout can track drift despite complete recon guration of the neural code, we replace gradual drift in all features with abrupt changes in single features in Fig. 2. For this, we re-sampled the weights for single encoding units one-at-a-time from a standard normal distribution. Self-healing plasticity rules were run each time 5 out of the 100 encoding features changed. Supplemental Fig. S1 con rms that abrupt drift in a few units is equivalent to gradual drift in all units. Unless otherwise stated, all other results are based on an OU model of encoding drift.
We modeled excess variability in the encoding population that was unrelated to cumulative drift. This scenario resembles to the drift observed in vivo (9; Supplemental Fig. S3). We sampled a unique "perday" synaptic activation˜ , ( ) for each of the encoding units, from the same Gaussian process on used to generate the drifting activation functions , ( ). We mixed these two functions with a parameter = 0.05 such that the encoding variability was preserved (i.e. 5% of the variance in synaptic activation is related to random variability): Supplemental Fig. S2a shows that the readout can tolerate up to 30% excess variability with modest loss of stability. Supplemental Fig. S3 shows that neuronal recordings from Driscoll et al. (43) are consistent with 30% excess variability, and that the qualitative conclusions of this paper hold for this larger amount of day-to-day variability (Supplement: Calibrating the model to data).
We also applied drift on the decoding synapses W. This is modeled similarly to Eq. (10), with the parameter controlling the percentage of variance in synapse weight that changes randomly at the start of each each day: , , = , , where is the empirical standard-deviation of the the decoding weights on day . Unless otherwise stated, we use = 1%. Larger values of drift on the decoding weights is destabilizing for Hebbian homeostasis (with or without response normalization), but readouts with stable internal recurrent dynamics can tolerate larger (∼ 8%) amounts of readout-weight drift (Supplemental Fig. S2b).
Synaptic learning rules The learning rule in Eq. (5) is classical unsupervised Hebbian learning, which is broadly believed to be biologically plausible (45,46,61). However, it has one idiosyncrasy that should be justi ed: The rates of learning and weight decay are modulated by a homeostatic error in ring-rate variability. The simplest interpretation of Eq. (5) is a premise or ansatz: learning rates should be modulated by homeostatic errors. This is a prediction that will need to be experimentally con rmed. Such a learning might be generically useful, since it pauses learning when ring-rate statistics achieve a useful dynamic range for encoding information. The fact that weight decay is proportional to learning rate is also biologically plausible, since each cells has nite resources to maintain synapses.
. (5) may also emerge naturally from the interaction between homeostasis and learning rules in certain scenarios. When Hebbian learning is interpreted as a supervised learning rule, it is assumed that other inputs bias the spiking activity of a neuron toward a target * . This alters the correlations between presynaptic inputs x and postsynaptic spiking. Hebbian learning rules, especially temporally asymmetric ones based on spike timing (68), adjust readout weights w to potentiate inputs that correlate with this target. In the absence of external learning signals, homeostatic regulation implies a surrogate training signal˜ * . This˜ * is biased toward a target mean-rate an selectivity. For example, recurrent inhibition could regulate both population ring rate and population-code sparsity. This could restrict postsynaptic spiking, causing Hebbian learning to adjust readout weights to achieve the desired statistics. Cells may also adjust their sensitivity and threshold homeostatically. Hebbian learning could then act to adjust incoming synaptic weights to achieve the target ring-rate statistics, but in a way that is more strongly correlated with synaptic inputs.
In Supplement: Hebbian homeostasis as an emergent property, we verify the intuition that Eq. (5) should arise through emergent interactions between homeostasis and Hebbian learning in a simpli ed, linear model. In the remainder of this section, we us a linear readout to illustrate why one should expect Eq. (5) to be stabilizing.
The decoder's job is to generate a stable readout from the drifting code x( ). This is a regression problem: the decoding weights W should map x( ) to a target y( ). Since small amounts of drift are akin to noise, W should be regularized to improve robustness. The L2-regularized linear least-squares solution for W is: The regularization 2 I corresponds to the assumption that drift will corrupt the activity of x( ) by an amount Δx ∼ N (0, 2 I).
Can drift be tracked by re-inferring W on each day? We lack the ground-truth covariance Σ to re-train W, but could estimate it from decoded activity y ( ): Since y ( ) is decoded from x ( ) through weights W , the estimated covariance isΣ = Σ W , where Σ = x ( )x ( ) is the covariance of the inputs x ( ). The regularized lead-squares weight update is therefore: This update can be interpreted as recursive Bayesian ltering of the weights (Supplement: Weight ltering). Because x( ) continues to encode information about , we know that variability in the decoded y( ) should be conserved. Each readout ( ) homeostatically adjusts its sensitivity to maintain a target variability 2 0 . As introduced earlier, this multiplies the ring rate by a factor = 0 / 1 = 1 + , where is a small parameter. and 1 is the standard deviation of the readout's ring rate after drift but before normalization. Accounting for this in Eq. (14) and considering the weight vector w for a single readout neuron yields: To translate this into a plausible learning rule, the solution Eq. (15) can be obtained via gradient descent. Recall the loss function L (w) for optimizing regularized linear least-squares: Gradient descent −∇ w L (w) on Eq. (16) implies the weight update After matching terms between Eqs. (13)(14)(15) and Eq. (17) and simplifying, one nds the following Hebbian learning rule: Eq. (18) is equivalent to Eq. (5) for a certain regularization strength 2 (now taking the form of weight decay). The optimal value of 2 depends on the rate of drift. Since drift drives homeostatic errors, it follows that 2 ∝ for small . Here, we set 2 = , corresponding to = 1 in Eq. (18).
Single-neuron readout In Fig. 2, we simulated a population of 100 encoding neurons x ( ) that changed one at a time (Methods: Simulated drift). We initialized a single readout ( ) = [w x( )] to decode a Gaussian bump 0 ( ) ( = 5% of the track length) from the activations x 0 ( ) on the rst day. We optimized this via gradient descent using a linear-nonlinear Poisson loss function.
with regularizing weight decay = 10 −4 . In this deterministic ringrate model, the Poisson error allows the squared-norm of the residuals to be proportional to the rate. We simulated 200 time points of drift, corresponding to two complete recon gurations of the encoding population. After each encoding-unit change, we applied 100 iterations of either naïve homeostasis ( Fig. 2b; Eq. 3) or Hebbian homeostasis ( Fig. 2c; Eq. 5). For naïve homeostasis, the rates for gain and threshold homeostasis were = 10 −3 and = 10 −5 , respectively. For Hebbian homeostasis, the rates were = 10 −1 and = 10 −3 . Homeostatic regulation requires averaging the statistics over time (44). To model this, we calculated the parameter updates for the gain and bias after replaying all and computing the mean and variance of the activity for each neuron. Since the processes underlying cumulative changes in synaptic strength are also slower than the timescale of neural activity, weight updates were averaged over all on each iteration. We applied additional weight decay with a rate = 1 × 10 −4 for regularization and stability, and set =1 in Eq. (5) such that the rate of weight decay was also modulated by the online variability error˜ .
Learning recurrent weights For recurrent dynamics modeled as feedback in Eq. (7), supervised, linear Hebbian learning implies that the recurrent weights should be proportional to the covariance of the state variables z. To see this, consider a linear Hebbian learning rule, where z has been entrained by an external signal, and serves as both the presynaptic input and postsynaptic output: where is a weight decay term. This has a xed point at A = zz / . In our simulations, we ensure that z is zero-mean such that the second moment, zz , is equal to the covariance. For the linear-nonlinear map model of recurrent dynamics Eq. (8), neurons could learn A by comparing a target y 0 to the predicted y at the same time that the initial decoding weights W 0 are learned. For example, y 0 could be an external (supervised) signal or the forward predictions in Eq. (4) before drift occurs, and y could arise though recurrent activity in response to y 0 . A temporally-asymmetric plasticity rule could correlate the error between these signals with the recurrent synaptic inputs to learn A (68). This plasticity rule should update weights in proportion to the correlations between inputs y and a prediction error y 0 − y : where = 10 −4 sets the amount of regularizing weight decay. Eq. (8) is abstract, but captures the two core features of error correction through recurrent dynamics. It describes a population of readout neurons that predict each-other's activity through recurrent weights. Eq. (21) states that these weights are adapted during initial learning to minimize the error in this prediction. We assume A is xed once learned.
Population simulations In Fig. 3, we simulated an encoding population of 100 units. Drift was simulated as described in Methods: Simulated drift, with = 100. In all scenarios, we simulated = 60 readout cells tiling a circular divided into = 60 discrete bins. Learning and/or homeostasis was applied every 5 iterations of simulated drift. The readout weights and tuning curves were initialized similarly to the single-neuron case, but with tuning curves tiling .
For the predictive coding simulations (Eq. 7), we simulated a second inner loop to allow the network activity z to reach a steady state for each input x( ). This loop ran for 100 iterations, with time constant of = 100. The recurrent weights A were initialized as the covariance of the synaptic activations on the rst day (Σ where z( ) = W x( )) and held xed over time. The nal valueẑ was used to generate a training signal,ŷ = (ẑ), to update the readout weights. For the recurrent map, recurrent weights were learned initially using Eq. (21) and held xed through the simulations. For both the linear-nonlinear map and the recurrent feedback models, weights were updated as in Eq. (5), where the output of the recurrent dynamics was used to compute homeostatic errors and as the signalŷ in Hebbian learning. For naïve homeostasis (Fig. 3b) and Hebbian homeostasis (with and without response normalization; Fig. 3cd), learning rates were the same as in the single-neuron simulations ( Fig.  2; Methods; Single-neuron readout). For the linear-nonlinear map (Fig  3e), learning rates were set to = 10 −4 and = 10 −1 . For recurrent feedback (Fig 3f), the learning rates were = 5 × 10 −3 and = 5. Learning rates for all scenarios were optimized via grid search.
Response normalization was added on top of Hebbian homeostasis for Fig. 3d, and was also included in Fig. 3ef to ensure stability. The population rate target for response normalization was set to the average population activity in the initially trained state.
Di erent parameters were used to generate the right-hand column of Fig. 3, to show the e ect of a larger amount of drift. After training the initial readout, 60% of the encoding features were changed to a new, random tuning. Rates were increased by 50× for naïve homeostasis to handle the larger transient adaptation needed for this larger change. The other methods did not require any adjustments in parameters. Each homeostatic or plasticity rule was then run to steady-state (1000 iterations).
Code availability Source code for all simulations is available online at github.com/michaelerule/selfhealingcodes. preprint (which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission.

Supplemental Information
Gaussian-process tuning curves Equation (10) in the main text (Methods: Simulated drift) de nes an Ornstein-Uhlenbeck (OU) random walk on the encoding weights U. This is equivalent to assuming that the synaptic activations of the encoding population undergo a random walk, and are samples from a stationary distribution of functions on . Assume that individual encoding weights vary randomly over time, sampling from a stationary distribution that can be approximated as Gaussian. Without loss of generality, choose units such that this distribution is a standard normal distribution ∼ N (0, 1). Denote the time-varying vector of synaptic weights for a single encoding neuron as u . Now, consider the synaptic activation for an encoding neuron driven by features s: ( ) = u s( ). If u ∼ N (0, I), then the second moment Σ ( , ) = ( ) ( ) is: which is constant since s( ) do not change over time. A similar logic holds for the other moments, con rming that the OU drift on the encoding weights samples from a stationary distribution of activation functions.
If the encoding features s( ) are sampled from a Gaussian process on , then OU drift on the encoding weights amounts to OU drift over a Gaussian-process distribution of activation functions. Let the encoding weights change as u The increments Δ ( ) are samples from a Gaussian Process Δ ( ) ∼ GP (0, Σ Δ ( , )), with second moment: If units are chosen such that the encoding features s( ) are zero-mean, then the second moments in Eqs. (22)(23)(24) can be interpreted as covariances. The randomly-drifting encoding weights u are therefore equivalent to an OU random walk through the space of possible activation functions on . We use this to simplify computations. If the synaptic activations ( ) are samples from a stationary distribution of functions over , then the tuning curves ( ) = [ ( )] are also samples from a stationary distribution over possible tuning curves. Adding homeostasis scales and shifts the activation to achieve the target ring rate statistics. This regulates the amount of information about encoded in the ring-rate variations of the population x( ) (Supplement: Stability of encoded information).
Stability of encoded information The model of drift described in Methods: Simulated drift and Supplement: Gaussian-process tuning curves conserves the information-coding capacity of x( ). Because individual encoding neurons evolve independently in this model, the population of encoding cells represents independent samples from the distribution of tuning curves on . If we consider the large ( →∞) population limit, the average population variability related to is given by the expected variability caused by for the typical tuning curve: lim where a ( )=U s( ) is the vector of synaptic activations for all encoding units at location . The expected amount of population variability driven by is conserved, and is a function of the covariance of the activation functions Σ ( , ): The second step in Eq. (26) follows from the linearity of the trace and the identity q 2 = tr[qq ]. The operator ∇ refers to di erentiating Σ (·, ·) in its second argument. This is in turn relates to the amount of variability in the features s( ) that is driven by : This shows that a( ) inherits the correlation structure of s( ), and that, in the large population limit, the variation in a( ) driven by is approximately conserved. Additional assumptions about the nonlinearity [·] are needed to show that stable information in a( ) implies stable information in x( ) = [a( )]. In the special case of an exponential nonlinearity = exp, the trace of Fisher information I ( ) of x , ( ) = exp[u , s( )] is proportional to the average variation in a( ) driven by : (Formally, the Fisher information is in nite when the noise in x is zero, but Eq. (28) can be viewed as the zero-variance limit of homogeneous and IID Gaussian noise with suitable normalization.) With a threshold nonlinearity, the dynamic range of each ( ) must remain in a certain range to ensure that information is not lost due to the saturation in the ring-rate response. This can be ensured by homeostasis (23,44,69).
Hebbian homeostasis as an emergent property Here we explore a simpli ed linear model to make concrete the intuition that Eq. (5) in the main text should emerge through interactions between homeostasis and Hebbian learning. Consider a linear readout with inputs x, weights w, and output ring rate : Let X and Y be a training dataset of presynaptic inputs x ∈ X and postsynaptic outputs ∈ Y. Assume that and x are both zero-mean over this dataset. Consider a learning rule with a Hebbian term and other unknown contributions ( ) (e.g. homeostatic terms). Since weight changes occur slowly, we consider the average weight update over the training data: Above, ( ) re ects unknown contributions to the weight changes. We assume that ( ) can be treated as constant over all (x, ), for a given weights and training dataset = (w, X, Y). If our neuron is in an initial, trained state 0 = (w 0 , X 0 , Y 0 ), then learning has reached an equilibrium and Δw =0. This implies that the term (·) must balance Hebbian contribution to synaptic plasticity: De ne the homeostatic target 2 0 to be the variance of the ring-rate in this initial state 0 (if is zero mean, this is the second moment): Now, assume that a small amount of drift in the input encoding has occurred, X 1 = X 0 + Δ X . This changes the readout's ring to 1 = 0 + Δ , where Δ = w 0 Δ x is small. This alters the activity statistics of 1 , changing the rate variability 2 1 ≠ 2 0 . Assume that the variance of 1 has been restored by homeostatic processes that multiply the ring rate by a factor = 0 / 1 = 1 + , where is a small parameter: Let's examine the impact of this adjusted activity on the Hebbain rule in Eq. (30).
The unknown terms ( 1 ) could also change their values due to drift. We can approximate this change to rst order as: where O (. 2 ) denotes all terms at second order and higher. Since the learned state is at equilibrium, we can substitute Eq. (31) for ( 0 ) : If ( ) is constant in (x, ) for a given = (w, X, Y), the second and third terms reduce to Δ x ∇ x ( 0 ) and Δ ( 0 ), respectively. Since x and are constrained to be zero-mean, Δ x and Δ must also be zero, and these terms vanish. With these assumptions, Eq. (35) reduces to . This can be expressed as a function of (x 1 , 1 ) at rst order: We can use Eq. (33) and Eq. (37) to write Eq. (34) as: Expanding and canceling, and neglecting second-order terms, yields: Substituting Δ = Δ x w and 1 = x 1 w gives: The terms x 1 Δ x and Δ x x 1 are zero if the drift Δ x is uncorrelated with the encoding x 0 . This reduces Eq. (40) to: This is similar to the Hebbian term in Eq. (5), if ∝ at rst order. This is easily veri ed: Eq. (39) is therefore equivalent to the Hebbian contribution to the Hebbian homeostatic rule in Eq. (5) in the main text, with = / 0 . What about the weight decay terms?
We assume that the norm of the weight vector, w 2 , is conserved. Hebbian learning will generally disrupt this. If we assume that the norm of the weight vector is restored by weight decay − w, what value of would keep the norm of the weight vector constant? Consider a weight update as in Eq. (39), with an unknown weight decay term − w: Assume that ∼ O ( ). What value would need to take to ensure that w 1 2 = w 0 2 ? The norm of the updated weight vector is: We see that w 1 2 = w 0 2 if w 0 x 1 1 = w 0 2 + O (. 2 ), implying that Since w 0 x 1 = 1 , the term w 0 x 1 1 = w 0 x 1 1 = 2 1 = 2 1 is equal to the ring-rate variability after perturbation by drift. This implies that This suggests that the optimal value of weight decay is = 2 1 / w 0 2 . In practice this value is not critical (we found that and setting = 1 still led to good stability in simulations).
This derivation is not intended to prove that Hebbian homeostasis should arise in any speci c physiological model, but rather to illustrate that a learning rule of this form could emerge from the interplay of Hebbian and homeostatic plasticity.

Weight ltering
The action of the Hebbian homeostatic rule (Eq. 5 in the main text) can be interpreted as a form of ltering. Consider a linear readout trained initially on day = 0 with weights W 0 (leave dependence of x and y on implicit to simplify notation): The encoding x changes on each day . Tracking these changes entails translating the population code-words x into the code originally used on day 0. Using this translationx 0| , one might achieve an approximately stable readout.ŷ How might one estimatex 0 | ? Consider estimating the code-words on day from those on day + 1. Let drift Δx be sampled from a known distribution Δx ∼ N (0, ∆ ). An estimate ofx | +1 can be obtained via linear least-squares: where Σ is the covariance of the code x on the previous day. Eq. (49) provides the minimum squared error estimate ofx . In the linear, Gaussian case this is also the Bayesian maximum a posteriori estimate. Applying Eq. (49) iteratively yields an estimate of the original codex 0 , thereby translating the current representation x back through time to when the readout was rst learned: Now, consider the e ect of Eq. (49) on a decodedŷ by substituting Eq. (49) into Eq. (48): The expression [(Σ + ∆ ) −1 Σ W in Eq. (51) is the same one used to re-train the readout from its own output (Eq. (14) in the main text, Methods: Synaptic learning rules, with ∆ estimated as I): This illustrates that Hebbian homeostasis can be viewed (loosely) as ltering the current code-words x to recover the original code x 0 against which the readout was rst trained.
Topology of latent variable θ Example encoding feature Figure S1: Self-healing stabilizes readout population codes for diverse types of representational dri . Left: An example of a single drifting encoding feature ( ) sampled for a circular for di erent hypothetical drift scenarios. The horizontal axes for all plots are expressed in terms of the number of complete recon gurations of the encoding population-code (or equivalent, for scenarios b-d). All simulations were run for =1000 time-steps, corresponding to 10 complete recon gurations in the encoding population. For continuous drift (b-d), time-constants were set to match the rate of population drift corresponding to changing encoding features one-at-a-time for a population of = 100 encoding neurons. Right: Normalized Root-Mean-Squared-Error (NRMSE; 0=perfect match, 1=chance) of the readout population code over time. Lines indicate the median over 10 random seeds, and shaded regions the inter-quartile range. Simulation parameters are the same as for scenarios b-f in Fig. 3 in the main text. We ran "self-healing" reconsolidation every Δ = 5 iterations. We explored three topologies for : circular, linear, and T-maze (compare to Supplemental Figure S4). The rate of decay of the readout population code does not depend on the style of drift in the encoding population. (a) "One-at-a-time" drift changes one out of = 100 encoding neurons on each iteration of the simulation. 100 simulated timesteps corresponds to one complete recon guration of the encoding population. (b) "Random drift" applies Ornstein-Uhlenbeck (OU) drift with a time constant = 100 (Methods: Simulated drift). (c) "Non-sparse drift" samples the encoding curves directly from a linear, Gaussian process, and does not apply the ring-rate nonlinearity ( ·). These features lack the sparse, bump-like tuning curves present in the other scenarios. The variance has been scaled to match that of the other drift scenarios. The correlation time is = 100. (d) "Directed" drift simulates a second-order OU process evolving as two stages of Eq. (9) in the main text chained in series, such that consecutive changes are correlated in time. Each stage has a time constant = 50.
15 preprint (which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission.  Figure S2: Encoding variability and readout-weight dri a ect stability. Each plot shows the survival time for a self-healing readout as in Fig. 3 of the main text, measured as the time until the normalized root-meansquared error of the readout exceeded 0.5. = 4000 timepoints are simulated for an encoding population of =100 cells with a drift time constant of =100. Time (vertical axis) is expressed in multiples of the drift time constant. Boxes show the median (black) and inter-quartile range. Whiskers indicate the 5 th -95 th percentiles over 10 random seeds. We explored three topologies for : circular, linear, and T-maze (compare to Supplemental Figure S4). All simulations used the same parameters as in Fig. 3 in the main text, with the exception of the noise parameter ( or ) which is varied along the horizontal axis. Drift is gradual as described in Methods: Simulated drift. "Self-healing" reconsolidation is applied every Δ = 5 time-steps. (a) We varied the amount of daily variability in the code x( ) that is unrelated to cumulative drift. This is expressed as the percentage of the variance in synaptic activation for the encoding neurons that is unique to each day ( , horizontal axis; Eq. (10) in the main text). The "response normalization", "recurrent feedback", and "linear-nonlinear map" scenarios all show good stability up until ≈40% (c.f. Fig. 3 d-f in the main text). (b) We varied the amount of drift applied to the readout's decoding weights W on each day ( , horizontal axis; Eq. (11) in the main text). Recurrent dynamics can tolerate small amounts of readout-weight drift, but stability degrades if drift exceeds ≈8% per time-step. 16 preprint (which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission.  Cell # Figure S3: The statistics of dri observed in vivo are compatible with long-term stability. (a) The rate of drift can be measured using the cosine of the angle between two tuning curves ("alignment"), estimated on di erent days for the same cell (1: identical; 0: unrelated). Plots show tuning-curve alignment for a population tracked for over a month, taken from three subjects in Driscoll et al. (43). Each point re ects the average alignment across the population for a pair of recordings separated by Δ days. Measurement noise exaggerates apparent tuning di erences, so alignment was normalized via a bootstrap estimator such that tuning curves estimated from di erent trials on the same day were fully aligned (teal '•'). Alignment decays exponentially, with a similar timescales across subjects (" "). Extrapolating the day-to-day alignment (black '+') to a separation of zero days ( 0 ) does not yield perfect alignment, indicating that not all day-to-day tuning variability is explained by drift. This excess variability also cannot be attributed to systematic drift during the recording session (measured as the alignment between the rst and second half of the recording session; red '×'). (b) We modeled tuning curves as samples from a log-Gaussian process over the latent space , with drift modeled as an Ornstein-Uhlenbeck random walk in tuning over time (Methods: Simulated Drift). We used a time-constant of = 45 days and applied = 30% excess per-day variability to match the model to experimental data. (c) Tuning curves sampled from the model (bottom left) qualitatively resemble those in the experimental data. Tuning curves in vivo, however, exhibited nonuniform statistics in (top left). The statistics of drift (right) are also similar, with both model and data exhibiting day-to-day variability superimposed over long-term drift. (d) Evolution of readout population tuning curves under simulated drift. The drift timescale and day-to-day variability were calibrated as in (b). All other parameters were the same as in Fig. 3. Readouts with a stable internal model ("linear-nonlinear map" and "recurrent feedback") exhibit long-term stability.
17 preprint (which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission.
The copyright holder for this this version posted September 9, 2021. ; https://doi.org/10.1101/2021.03.08.433413 doi: bioRxiv preprint  Figure S4: Self-healing plasticity stabilizes various geometries. We simulated representational drift under various self-healing plasticity scenarios as in Fig.  3 of the main text, applied to di erent geometries (left: ring, middle: line, right: T-maze). The covariance kernel of the Gaussian-process synaptic activations for x( ) was adapted to each geometry, keeping the correlation as a function of distance the same as in Fig. 3 in the main text (Methods: Simulated drift). We simulated 1000 iterations of drift with time-constant = 100. Results are similar across all three topologies. Black-and-white plots show the con guration of the readout population code at various times. Colored plots show the result of applying unsupervised dimensionality reduction to the nal readout population tuning curves (Python sklearn SpectralEmbedding (70); c.f. (39)). We applied this embedding to points sampled from ve random 'walkthroughs' of with additive Gaussian noise = 1.2 × 10 −2 to emphasize the degradation in the signal-to-noise ratio. (a) Without compensation, the amount of variability in y( ) that is related to decays, lowering the signal-to-noise ratio. Both the original tunings, and the capacity to encode , is lost. (b) With homeostasis, the original readout tuning curves are lost. However, homeostasis stabilizes the information-coding capacity of the readout. Nonlinear dimensionality reduction recovers the underlying topology of . (c) Hebbian homeostasis provides some stability, but causes the readout population code to collapse around a few salient preferred 0 . (d) Response normalization compensates for the destabilizing impact of Hebbian homeostasis. However, noise causes readout neurons to swap their preferred tunings. (e, f) Long-term stability is possible in readouts with a stable internal model. Sharing of information among the readout population, modeled here as either a linear-nonlinear map or recurrent feedback, allows for more robust error correction.
18 preprint (which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission.
The copyright holder for this this version posted September 9, 2021. ; https://doi.org/10.1101/2021.03.08.433413 doi: bioRxiv preprint Figure S5: Larger amounts of dri between reconsolidation sessions reduces stability. Changing the rate of drift relative to the frequency of reconsolidation a ects the stability of the readout population code. In these simulations, all parameters are the same as in Fig. 3 in the main text, with the exception of the frequency of reconsolidation Δ. In the main text, Δ = 5. We explore up to Δ = 45, equivalent to nine times faster drift. The rate of degradation for Hebbian homeostasis scales with the rate of drift, with (a) and without (b) response normalization. Error correction via linear-nonlinear map (c) also degrades with increasing Δ, but less so. The error levels o to a steady-state, suggesting long-term stability. With recurrent feedback (d), the population readout is stable for modest rates of drift, but loses stability above a certain rate (Δ ≈ 25).
19 preprint (which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission.