WorksComputer Science
Two Timescales of Forgetting in Fine-tuning of Language Models: Fast Behavioral Suppression and Slow Representational Drift
Abstract
Today, a core pipeline of artificial intelligence systems is pretraining on a broad range of text corpora and then fine-tuning on specific tasks or desired behaviors. Yet we still have limited understanding of how fine-tuning on a restricted data distribution modifies representations acquired during pretraining. In particular, it remains unclear whether surface behavioral suppression happens together with the erasure of latent representations that support it. In this work, we study supervised fine-tuning (SFT) by pretraining transformers on a controlled context-free grammar with hierarchical latent structure, the Random Hierarchy Model (RHM), and fine-tuning with a restricted subset of its generative rules. While during pretraining the model's ability to generate with the correct grammar rules coincides with building the internal representations of the corresponding latent, we find that SFT exhibits a very different dynamics: (i) the generation of deleted rules changes on a fast timescale inversely proportional to the magnitude of the token-latent correlation; meanwhile, their corresponding representations stay intact; (ii) the hidden representations of the deleted rules become forgotten on a much longer timescale, associated with a slow drift of the network parameters. Finally, we observe analogous results in a realistic setup with natural language, suggesting that this timescale separation in forgetting is a more general phenomenon of fine-tuning language models.
Introduction
Large language models (LLMs) are pretrained on broad text corpora and then adapted through supervised fine-tuning (SFT) for downstream tasks, instruction following, or safety alignment. Fine-tuning typically uses a narrower data distribution and can impair capabilities acquired during pretraining, a phenomenon known as forgetting [24, 28, 32]. Yet a drop in an evaluation metric of the model based on its behavioral outputs does not imply that the information supporting it has been erased from its internal representations [7, 36, 16, 22]. Understanding this distinction is essential for determining what fine-tuning changes and what evaluations of model behavior can establish.
Despite these observations, a quantitative account of the relationship between behavioral and representational forgetting remains limited. How quickly does fine-tuning suppress previously learned behavior? How long do the underlying representations persist, and what determines their eventual change? Addressing these questions requires a setting in which the relevant latent structure is known and its role in generation can be distinguished from its use in interpreting context.
We study these questions using the Random Hierarchy Model (RHM), a probabilistic context-free grammar with a known hierarchy of latent variables [4]. We pretrain decoder-only transformers by next-token prediction and then fine-tune them on sequences generated after deleting a subset of the grammar’s production rules. This restriction changes which sequences the model should generate without introducing new rules to learn. The known generative structure lets us separately track the use of deleted rules in model outputs and the ability to use deleted rules in context to predict allowed continuations.
Our central finding is a separation between two timescales of forgetting. Generation using deleted rules is rapidly suppressed, while the model retains representations that allow it to interpret those rules in context and use them for prediction. This representational and predictive ability deteriorates only after much longer fine-tuning. Our analysis supports an explanation in which early behavioral adaptation occurs with little change to learned features, whereas continued noisy parameter drift gradually alters the representations that support the suppressed behavior.
Our contributions
We identify two timescales of forgetting in a transformer trained on hierarchically structured data: a rapid suppression of behavior and a slow drift of representations.
We show that the timescale of suppression increases with the hierarchical level of the rules and with the number of rules retained. We propose a theoretical explanation of this scaling with a linear model on fixed features: for the first fine-tuning step, the gradient signal is proportional to the difference in token–latent correlations between the fine-tuning and the pretraining grammar, and the inverse magnitude of this signal is consistent with the measured timescales.
We show that the forgetting of representations is caused by a drift driven by accumulated noise in the parameter updates, which continues long after behavior has been suppressed. The time to this forgetting scales with the inverse square of the learning rate, as expected for noise accumulated over the updates of Adam, whereas the time to behavior suppression scales with the inverse of the learning rate. We further show that the forgetting of representations can be advanced by weight decay, and delayed or prevented by a pull toward the pretrained parameters with explicit regularization.
We observe an analogous timescale separation between behavioral and representational forgetting in a transformer pretrained on bilingual text and fine-tuned on one language, extending the phenomenon beyond the synthetic grammar setting.
These findings show why evaluating forgetting requires examining both generated outputs and latent representations of previously learned structure. They also motivate a distinction relevant to safety fine-tuning: suppressing an unwanted behavior alone does not ensure that the representations supporting it have been removed, and the two phenomena occur through distinct dynamics.
Related work
Continual learning. A bulk of continual learning literature studied catastrophic forgetting, where the performance of neural networks deteriorates as new tasks are learned [12, 18, 29, 2]. It has also been shown that large weights after the initial learning period can be one of the causes for a loss of plasticity [8, 26, 21]. Yet a decrease in task accuracy does not imply a comparable loss of information from hidden representations, and substantial retrieval of the information is plausible even after the model seems to forget in its output [7, 22, 16]. In fact, selective-unlearning research has distinguished suppression of observable behavior from removal of information retained in network weights [10 b]. Malladi et al. [23] characterize fine-tuning of pretrained language models with the Neural Tangent Kernel (NTK). We similarly observe that the faster timescale of behavioral change happens while latent representations stay intact. Blanc et al. [1]; Li et al. [19] show that noisy gradient updates near the minimizer manifold drive a slow drift, consistent with noise-induced drift of hidden representations [27]. Our work connects these dynamics to forgetting in restricted fine-tuning, where such drift erodes the representation of deleted rules after their generation has been suppressed.
Learnability of the Random Hierarchy Model. The RHM is a synthetic generative grammar whose hierarchical latent structure allows the study of representation learning and its sample comperplexity [4]. For autoregressive models, Cagnetta & Wyart (2024); Cagnetta et al. [5] relate the stepwise acquisition of successive rule levels in RHM to the amount of data needed to resolve correlations over longer contexts. Favero et al. [9] study the acquisition of hierarchical compositional structure in training diffusion models, finding an analogous result. These works describe how hierarchical structure is acquired from randomly initialized networks and its corresponding sample complexities. In this work, we focus on how the previously learned hierarchical latent structure changes throughout the fine-tuning with restricted data distribution.
Random Hierarchy Model
Pretraining and fine-tuning setup
Data model. The Random Hierarchy Model (RHM) is a probabilistic context-free grammar that generates sequences through a hierarchy of production rules [4]. A sequence is obtained by starting from a root node and expanding a regular tree from it, with constant branching factor . The generation proceeds for levels, until obtaining leaf nodes which correspond to the observed tokens. We call this observable level , while the levels are unobserved latent levels (Figure 1(a) and (Figure 1c)). Each node carries one of symbols. One instance of the RHM corresponds to drawing at each level distinct ordered -tuples uniformly without replacement from the possible tuples and assigning to each parent symbol. These alternative expansions are called synonyms. The resulting rule book is shared by all nodes at the same level. No -tuple is assigned to two different parent symbols, so each valid sequence has a unique latent tree. Once the rule books are drawn, they define a grammar and remain fixed. The grammar generates data by drawing one root symbol uniformly and iteratively sampling one of the synonymic lower-level representations with equal probability. The number of grammatical sequences is , therefore exponential in the sequence length .

Figure 1. The Random Hierarchy Model and our setup. (a) The rule books, one per level, prescribe how each symbol can be expanded in lower-level synonymic representations. They define the pretraining grammar . (b) The restriction that defines the grammar used in fine-tuning, : for every symbol on every level, only rules stay valid while the others get deleted. (c) An example of a sequence with its latent tree structure generated by an RHM with depth and branching factor . (d) to (f) The schematic diagram of the generation probe, the representation probe, and how the sequences in the three test families are generated to measure prediction loss. The gray nodes use the kept rules to generate their children, while the red nodes use the deleted rules.
We write for the th node from the left at level . Negative indices count from the right at the same level: is the rightmost node and the second from the right. For example, in the , tree. The grammar generates the training sequences. The leaf tokens are one-hot encoded in the possible symbols and used to train a transformer.
Pretraining. For a fixed grammar , we train decoder-only transformers (Karpathy, [14]) by next-token prediction. Each batch contains 128 freshly sampled sequences, corresponding therefore to an online learning regime. Training minimizes the mean cross-entropy over the sequence positions with a successor, using Adam (Kingma & Ba, [15]) at a constant learning rate of . Architecture, training durations and other settings are given in Appendix § 10.§ 1.
In our experiments, we use and vary combinations of other values like , , and , , .
Restricted fine-tuning. For the fine-tuning data, we construct by retaining synonymic representations of every symbol in every rule book and deleting the other rules from (Figure 1(b)). The retained rule subset is fixed, and the resulting sequences are generated by sampling from the retained synonyms uniformly. Thus, the fine-tuning sequences from form a narrower distribution of , while each node still takes one of the possible values (although its marginal distribution is modified by ). Training uses no explicit penalty on deleted rules and no replay of data. Starting from the final pretrained weights, we continue next-token prediction on freshly sampled sequences, with the same optimizer settings and reset Adam moments. The fine-tuning learning rate is unless stated otherwise.
Metrics for forgetting
Prediction loss. We measure the last-token test cross-entropy , conditioning on all preceding tokens. For pretraining, we compare it with the Bayes-optimal losses , , obtained when only the previous context tokens are available. These references are computed by belief propagation on (Cagnetta et al., [5]; Sclocchi et al. [31]); uses no context and uses the full sequence context.
For fine-tuning, we evaluate on three fixed test families, all valid under (Figure 1(f)). In the kept-grammar family, every internal node uses a kept rule. In the deleted-grammar family, every internal node uses a deleted rule. In the deleted-grammar-in-context family, the ancestors of the last token use kept rules and all other internal nodes use deleted rules. The last family tests whether the model can interpret deleted rules in the context to predict a kept continuation.
Generation probe. We adapt the rule-based evaluation of generated sequences in Favero et al. [9]. At each checkpoint, we sample the first token from the marginal and generate the remaining tokens autoregressively at temperature 1 (Figure 1(d)). We parse the sequences with and measure the fraction of all nodes at each level that use a deleted rule. For a given , the reference deleted-rule rate under is .
Representation probes. Following Cagnetta et al. [5], we measure the similarity of the transformer hidden representations from input and a transformed input .
First, we sample from unmodified .
Then, transformation replaces the rule from at the chosen latent node with a deleted synonym while keeping all other nodes to generate the same rules and symbols as (Figure 1(e)).
For and , we take , a coordinate-wise standardized -dimensional hidden representation after the final normalization layer at the second-to-last token position.
We measure the representation similarity as
at each checkpoint throughout fine-tuning.
Thus, the metric measures the difference in hidden representations between kept rules and deleted rules when they are supposed to predict the same next token. In fact, for a transformer trained on , since latent synonyms have the same hidden representations. A decrease in indicates that a deleted rule acquired a different hidden representation with respect to its original group of synonyms.
To set the baseline of , we evaluate the same overlap after a symbol replacement: the transformation replaces the symbol at the chosen node by a uniformly drawn different symbol and regenerates its subtree with kept rules. We call this value the symbol reference. It is the overlap between inputs whose latents differ, so a decrease of toward it indicates that the representation separates a deleted rule from its kept synonyms as it separates different symbols.
In Appendix § 10.§ 4, we also introduce linear probes as an equivalent measure for the representations of synonymous rules. They bear the same information as .
Results
Hierarchical learning in next-token prediction pretraining
Cagnetta & Wyart (2024); Cagnetta et al. [5] studied pretraining on the RHM for the last-token prediction task, and Favero et al. [9] studied it for discrete diffusion models. They showed that deep generative models learn to generate sequences consistent with the -level grammar rules when the amount of training data reaches the level (or depending on specific architecture and task). Specifically, the value of is obtained from a signal-to-noise argument, where the signal strength is given by the correlation strength between -level latent tuples and visible tokens, while the sampling noise strength is given by the law of large numbers. Since we consider online learning, the number of pretraining time steps is proportional to seen training samples, and the corresponding training timescales to learn level rules follow .
In Figure 5 of Appendix § 10.§ 2, we confirm that the next-token prediction task follows the stage-wise learning shown in Cagnetta et al. [5]; Favero et al. [9]. The transformer’s last-token loss decreases through the plateaus , with transitions happening at learning times whose scaling is consistent with
Figure 5. Pretraining at . (a) for networks with 1 to 5 blocks, and a two-block network with hidden width 720 (dashed, labeled in the legend), approximately matching the parameter count of the four-block network; mean std over 4 seeds. Horizontal dashed lines: the seed-averaged plateau losses . Vertical dashed lines: the sample scales of equation (6). Their common prefactor is fixed by the geometric mean, over the five network depths, of the sample count where the mean loss crosses . (b) for the four-block network at , and ; mean std over 8 seeds, with the same vertical lines.
Fine-tuning: two timescales of forgetting
Restriction fine-tuning rapidly suppresses the generation of deleted rules, while their representations and their predictive use in context persist for much longer.
Rapid suppression of generation. Figure 2(a) shows that the deleted-rule rate falls from near to near zero at every level and remains low throughout fine-tuning. Suppression proceeds from the bottom rule book () to the root (), with the same ordering across seeds. Unparseable sequences due to grammatical errors occur during the initial fine-tuning but become rare later, so the decrease in deleted-rule use is accompanied by grammatically valid generations.
Figure 2. The two timescales of forgetting in the restriction at (); mean std over 4 seeds. We reproduce the same results for and (Figure 7). (a) The deleted-rule rate at levels to , against the fine-tuning step , falls from the reference value (dotted), with the curves ordered from the bottom level to the root. Inset: the curves of the four levels, without error bars, collapse against the rescaled step of Equation (3) (full size in Figure 8). (b) The representation probe at , and stays close to 1 long after generation is suppressed, and starts decreasing toward each node’s symbol reference (dotted) only orders of magnitude of steps later. (c) on the three test families; dashed line: the Bayes-optimal loss of , seed mean. The deleted-grammar loss rises during the suppression, while the deleted-grammar-in-context loss stays close to the Bayes-optimal loss until decreases.
In the inset of Figure 2(a) and in Figure 9, we plot the generation curves against , where counts fine-tuning steps. Figure 8 shows the rescaled curves at full size for and . The collapse shows that the fine-tuning timescale for the generation drop is consistent with
Figure 8. Deleted-rule rate at levels to against the rescaled step in the restriction fine-tuning at (a) , , (b) , and (c) , ; mean std over 4 seeds; dotted line: . Under this rescaling, the curves of the four levels, which start to fall at different steps in Figure 2(a) and Figure 7(a), (Figure 7d), collapse, consistent with equation 3.
Figure 9. Restriction fine-tuning for RHM grammar with , , and ((a), (d)), ((b), (e)), ((c), (f)); mean std over 4 seeds. (a) to (c) Deleted-rule generation rates at levels against fine-tuning step ; dotted line: . (d) to (f) The same curves against , with the same axes in the three panels. The probability of generating deleted rules starts decreasing at different timescales depending on and rule level . Rescaling the fine-tuning time step by collapses the point where the curves start decreasing ((d) to (f)).
which is inversely proportional to the magnitude of the correlations between a token and its level- latent ancestor for an RHM with (Cagnetta & Wyart (2024)). In § 4.3 and Appendix § 11, we show that these correlations set the magnitude of the first fine-tuning gradient update, therefore suggesting that this signal strength determines the timescale for generation change during fine-tuning.
Delayed change in representations. The representation probe remains close to 1 after generation has been suppressed at every level (Figure 2(b)). During this period, replacing a kept rule in context with a deleted synonym has little effect on the representation used for prediction. The model therefore retains approximate invariance to deleted expressions of the same latent despite rarely generating them.
Only after orders of magnitude more fine-tuning does decrease toward the symbol reference. The probe at starts to decrease at similar times, in contrast to the clear sequential ordering of learning each hierarchical latent level during pretraining (Figure 5(b)).
Predictive use of deleted rules in context. In Figure 2(c), the three test families distinguish suppression of deleted continuations from the loss of the ability to interpret deleted rules in context. The kept-grammar loss decreases smoothly toward its Bayes-optimal value. The deleted-grammar loss rises during the initial suppression of generation and continues to increase.
The deleted-grammar-in-context sequences require the model to interpret deleted rules in the context while predicting a continuation in kept rules. Their loss initially decreases together with the kept-grammar loss and remains close to the Bayes-optimal value for a much longer period after the rapid increase of the deleted-grammar loss. This indicates that the deleted rules remain useful for prediction even after the behavioral suppression. At a much longer timescale, instead, we see the loss of deleted-grammar-in-context increase, indicating that the predictive use of deleted rules deteriorates. We observe that the timescale where this increase begins coincides with the decrease of the representation probe (Figure 2(b)).
Hierarchical correlations and the fast behavioral suppression
In this section, we propose an origin for the observed fine-tuning timescales of suppressed generation (§ 4.2), summarized in Equation (3). In line with existing theories of RHM learnability, we relate the strength of the learning signal to the magnitude of token–latent correlations, observing that they are simply related to Equation (3).
Building on the observation in § 4.2 that the internal representations stay unchanged in the early fine-tuning dynamics, in Appendix § 11.§ 1 we consider a linear model on fixed features that learned to encode the latent data structure during pretraining. In this simplified setting, the first fine-tuning gradient step, which we call fine-tuning (f.t.) signal, has size
f.t. signal ,
where and are respectively the pretraining and fine-tuning distributions of next-token conditioned on context .
Hierarchical scaling of the fine-tuning signal. In the RHM, because of its tree structure, the conditional probabilities , where , are mediated by the hidden latents identified by the context : . Therefore, changing the generation probabilities corresponding to a latent rule at level corresponds to changing the output in the direction of , where is the lowest common ancestor between the context and the next-token .
In Appendix § 11.§ 2, we compute the magnitude of with respect to the RHM parameters and and hierarchical level . We obtain , that for has the scaling
Assuming that the fine-tuning timescales follow
one obtains consistently with the observations of equation (3).
Limitations and tests of the assumption of equation 5. Equation 5 assumes that (i) the model initially behaves as a linear readout from existing features, and that (ii) its first step persists across the first part of the fine-tuning dynamics, until the output reaches a margin where the loss and its gradients eventually start changing. This assumption is justified only for the case , i.e., changing the token probability w.r.t. its nearest neighbor token, because (i) this conditional probability can be represented by a linear readout and (ii) before the linear model learns this change, the average loss and its gradients are effectively constant. However, for higher hierarchical levels, both conditions (i) and (ii) are not valid: (i) output probabilities depend non-linearly on combinations of latent variables and (ii) the loss has started evolving after changing .
In Appendix § 11.§ 3, we report the behavior of fine-tuning dynamics for the linearized model , where is the Jacobian of the transformer after pretraining. In Figure 18, we observe that, consistently with this discussion, the behavior timescale for is the same as that of the full non-linear model, and eventually starts changing after the drop in for the deleted rules. Therefore, understanding why equation (5) is consistent with the observations (Equation (3)) beyond the initial fine-tuning dynamics requires a better understanding of the full non-linear dynamics, which remains an open problem.

Figure 18. Comparison of behavioral forgetting during fine-tuning for non-linear vs linearized model. The linearized model corresponds to a first order linearization around the pretrained weights . Panels (a), (b), (c) show that only the adaptation timescale to forbidden rules at the bottom level is effectively described by the linearized model (i.e., the blue curves start to decay at the same time), while for higher hierarchical levels the linearized model is slower w.r.t. the non-linear one. Panels (d), (e), (f) show that the scaling works across all levels only for the non-linear model (solid lines), while it captures some of the linear behavior only for increasing values of and (panel (f)).
Difference with pretraining complexity argument. Since we are considering online training with fixed batch size, the number of training steps is proportional to the number of observed samples. Therefore, the training steps necessary for learning are (at least) proportional to the sample complexity. Theoretical arguments for RHM pretraining sample complexity (Cagnetta & Wyart, 2024; Favero et al., 2025) compare the learning signal magnitude, i.e., the latent–token correlations, with their sampling noise in their empirical estimates, obtaining Equation (2), which scales differently from Equation (3). We think the main difference between pretraining and fine-tuning dynamics is that fine-tuning reuses the latent representations acquired during pretraining, and therefore adaptation does not need to first reconstruct the latent hierarchy. A more precise understanding of the observed different timescale behaviors requires a deeper analysis of the learning dynamics of both pretraining and fine-tuning.
Noisy representational drift and the slow timescale
§ 4.3 relates the timescale of behavioral suppression to the fine-tuning gradient. As discussed in § 4.2, the fast behavioral suppression is followed by a later regime of representational forgetting. Here we show that this slow change in representations is consistent with representational drift caused by noise in the parameter updates.
Our hypothesis is that the average gradient of the fine-tuning optimization has no component that impairs or conserves the deleted-rule representations. Instead, their degradation at large times is due to the accumulation of random displacements in the weight updates caused by the variance in the batch updates.
Test 1: Varying learning rate The hypothesis above predicts a different dependence on the learning rate for the fast behavioral timescale and the slow representational one. Adam normalizes each update by a running estimate of its gradient magnitude [15], so that the magnitude of each update is approximately of order , whatever the magnitude of the gradient. If successive updates of each parameter have the same sign, as under a persistent gradient, its displacement after steps is proportional to . If their signs fluctuate, as under noise, the displacement grows as . Therefore, a given displacement takes a number of steps proportional to when caused by a persistent gradient, and to when caused by accumulated noise.
We test this prediction by varying the learning rate Figure 3. The curves of the deleted-rule rate at the three learning rates coincide when plotted against (Figure 3a); all levels in Figure 10. The curves of coincide when plotted against (Figure 3b); both scalings in Figure 12. A linear probe that reads the symbol of the probed node from the hidden representation (Appendix § 10.§ 4) gives the same result (Figure 11). Figure 3c shows the displacement of the parameters relative to their pretrained values . In the later stage, the increase is approximately proportional to , and the curves of the three learning rates coincide when plotted against (see also Figure 12), consistent with the behavior of .
Figure 3. Restriction fine-tuning at , with learning rates , (the learning rate of all other experiments) and ; mean std over 3 seeds. The insets show the curves averaged over seeds vs the fine-tuning step . (a) Deleted-rule rate at level : the curves decrease from the starting value (dotted line) at different times depending on (inset), and they collapse when plotted vs . This is consistent with a suppression of generation driven by the mean weight updates. (b) Probe at : also the time-scale of representational forgetting depends on the learning rate (inset), but curves collapse when plotted vs , differently from panel (a). This is consistent with representational forgetting being driven by accumulated noise in the weight updates. (c) Distance from the pretrained parameters relative to their norm, : consistently with panel (b), the late time displacement depends on (inset) and the curves collapse when plotted vs , converging to an asymptotic displacement (dashed line).
Figure 10. Deleted-rule rate at levels to (columns) in the restriction fine-tuning at , with learning rates , and , against the fine-tuning step (top row), (middle row) and (bottom row), ; dotted line: ; mean std over 3 seeds. The middle row shows that the curves collapse on each other when plotted against , consistently with the hypothesis of Section 4.4 that fine-tuning generation behavior is controlled by the average loss gradient.
Figure 11. Linear probe accuracy (Appendix § 10.§ 4) at , and (columns) for the learning rates of Figure 10, against the fine-tuning step (top row), (middle row) and (bottom row); dotted line: chance ; mean std over 3 seeds. The middle row shows that the curves collapse on each other when plotted against , consistently with the hypothesis of § 4.4 that representational forgetting is controlled by the variance of the loss gradients.
Figure 12. Representation probe at ((a) to (c)) and distance from the pretrained parameters relative to their norm, ((d) to (f)), against the fine-tuning step , for the learning rates of Figure 10. Curves represent the mean std over 3 seeds. Panels (a) and (d) show that larger corresponds to faster weight displacement, which in turn results in faster representational forgetting. Panels (b) and (e) show that rescaling the x-axis as collapses both the representational forgetting and the weight displacements, which align to a single curve proportional to (dotted line). This is consistent with the discussion in § 4.4 that representational forgetting is driven by accumulated noise in the gradient updates. Panels (c) and (f) show that is not the variable controlling this stage of dynamics (cf. Figure 10).
Test 2: Isolating the gradient variance Another test for our hypothesis is removing the gradient average after the behavioral forgetting, so that only its variance can drive the late-stage dynamics. For this test, we use a modified loss that clips low probabilities to zero, which we call bounded suppression: a token other than the target is discarded from the cross-entropy once its logit lies more than a fixed margin below the largest logit at its position. In this way, tokens that are suppressed beyond a margin do not contribute to the loss and its gradients.
With this loss, in Figure 13(a) to (Figure 13d) of Appendix § 10.§ 6, we observe that the deleted-rule rate stops decreasing at a small value, consistent with a vanishing average update. Instead, in Figure 13(e), follows the same curve as the baseline training, consistent with a dynamics that is driven by the gradient variance. The linear probe gives the same result (Figure 13(f)). The slow change in representations is therefore not caused by the continued suppression of deleted rules but by the variance of the weight updates.
Figure 13. Restriction fine-tuning at , for the baseline and for bounded suppression (§ 4.4), against the fine-tuning step ; mean std over 4 seeds. (a) to (d) Deleted-rule rate at levels to 4; dotted line: . (e) at . (f) Linear probe accuracy at (Appendix § 10.§ 4); dotted line: chance . With bounded suppression the deleted-rule rate stops decreasing at a small value, while and the linear probe accuracy follow the baseline: the slow change in representations is not caused by the continued suppression of deleted rules.
The role of explicit regularizations Finally, we also show that two explicit regularizations can alter the slow timescale while keeping the initial suppression of generation unchanged (Appendix § 10.7). An regularization toward the pretrained parameters , applied separately from the Adam update, restricts the late motion of the parameters, and can even retain the representation of the deleted rules (Figure 14(d) to (Figure 14f)). Instead, weight decay (Loshchilov & Hutter [20]) with coefficient is mathematically equal to the same regularization toward zero, and hence moves the parameters away from over a time of order . When this time is shorter than the timescale of the change without decay, the representations are lost after a time of order (Figure 14(a) to (Figure 14c)).
Figure 14. Restriction fine-tuning at , with decoupled weight decay of coefficient (top row) or an regularization of coefficient toward the pretrained parameters (bottom row), both applied separately from the Adam update; legend in (a); is the same baseline in both rows. (a), (d) Distance from the pretrained parameters relative to their norm, ; dotted line: . (b), (e) Deleted-rule rate at ; dotted line: . (c), (f) Linear probe accuracy at (Appendix § 10.§ 4); dotted line: chance . Mean std over 4 seeds. Both regularizations leave the time-scale for the decrease of the deleted-rule rate unchanged ((b), (e)). Weight decay moves the parameters away from over a time of order , and the linear probe accuracy falls earlier for larger ((a), (c)). The regularization toward stops the increase of the distance and, when strong enough, keeps the accuracy close to 1 ((d), (f)).
Experiments with natural language data
We primarily use RHM as a controlled synthetic setup to discover and understand the dissociation between the timescales of behavioral and latent forgetting. To connect these findings to more naturalistic data, we devise experiments with a decoder-only transformer trained with a bilingual natural language corpus.
For pretraining, we train an 8-layer decoder-only transformer on a corpus in which each topically coherent passage is written in either English (EN) or French (FR) sentences, chosen at random. This is a naturalistic reflection of RHM where the latent contains the grammatical rules for generating English or French text. We then fine-tune on a monolingual (EN or FR) corpus, mirroring the fine-tuning on restricted generative rules in RHM. Finally, we evaluate the same measures of behavioral and latent forgetting in this model. Details of the pretraining and fine-tuning corpus generation, training setup, and evaluation are in Appendix § 12.
We focus on the model fine-tuned on EN-only text here, but the results are consistent with the FR-only fine-tuned model (Figure 19). After fine-tuning on EN-only text, we replicate the measurement setting used for RHM in Figure 2. In Figure 4(a), we find that the generation rate of FR drops rapidly long before steps. To test whether the latent representations of one language in the model are intact, we measure the representational similarity between coherent sentences and incoherent versions with randomly shuffled tokens. High similarity indicates that the model lost capacity to encode coherent meaning of the language, a sign of representational forgetting (Figure 4(b)), which happens only after steps. In Figure 4(c), we replicate the measurement of Figure 1(f) in the bilingual model, again marking the transition in generation suppression and representational forgetting at steps. Finally, we also observe a slight crossover in the increase of the norm of relative weight change (Figure 4(d)), showing that also in this setting the model weights keep drifting even when the output has adapted to the fine-tuning distribution. A further control experiment on context ablation shows that after the onset of representational forgetting, the language removed during fine-tuning obtains almost zero loss gap between the informative context and uninformative context while the kept language gains a significantly lower loss given the informative context (Figure 24(b)). Including the removed language after the fine-tuning also shows that the relearning ability significantly drops after the onset of representational forgetting while beforehand, the model immediately recovers the removed language even after the behavioral forgetting (Figure 24(c)). We reproduce a similar observation with the English-Turkish language pair (Figure 22 and Figure 23). They have substantially different syntax and less shared structured than English-French and this supports that our result does not rely on highly shared latent structure.
Figure 4. Bilingual pretraining followed by EN-only fine-tuning. (a) FR generation rate drops rapidly before the fine-tuning steps, both for the first sentence and all sentences in the context window. (b) Cosine similarity between representations of coherent and token-shuffled sentences in FR and EN; higher similarity indicates loss of latent linguistic capability. Rapid rise of FR happens after steps. (c) Reproducing the three test families (Figure 1(f)). Prediction losses for EN targets with EN context (gray), FR targets with FR context (red), and EN targets with FR context (blue) show a similar trend, characterized by a further drop of the loss for gray (kept rules), a faster rise of the loss in red (deleted rules) and a slower timescale of blue (deleted rules in context). (d) Parameter distance relative to the pretrained norm; the vertical line marks steps, approximately coinciding with the transition in the behavioral and representational forgetting.
Figure 19. The measurements of Figure 4 for French-only fine-tuning. (a) English generation rate. (b) Coherent–shuffled representation similarity for English (red) and French (gray). (c) Prediction loss for French targets with French context (gray), English targets with English context (red), and French targets with English context (blue). (d) Relative parameter distance, as in Figure 4(d).
Figure 22. EN-TR bilingual pretraining and English-only fine-tuning. Panels (a) to (d), colors and reference line as in Figure 4: Turkish generation, coherent–shuffled representation similarity, prediction loss and relative parameter distance.
Figure 23. EN-TR bilingual pretraining and Turkish-only fine-tuning. Panels (a) to (d), colors and reference line as in Figure 19: English generation, coherent–shuffled representation similarity, prediction loss and relative parameter distance.
Figure 24. Bilingual pretraining and English-only fine-tuning additional control experiments. (a) The same three test families from Figure 4(c) to recap the generation and representation forgetting timescales. (b) Context ablation experiment. At the onset of representational forgetting, removed language (FR) does not benefit from coherent, informative context. Before that, it benefits as much as the kept language (EN), and at the end of the fine-tuning it almost reaches the baseline level similar to the model which was never trained with French. (c) Recoverability experiment shows how much training is required to relearn the removed language after each fine-tuning. Before the onset of representational forgetting (), the model almost immediately recovers to the level of the bilingual pretrained model (gray line). Relearning takes significantly more after the onset of representational forgetting ( ∼), almost similar to the model that was never trained with FR but only EN (black solid line). EN knowledge requires less relearning data than training from scratch indicating EN provides structural similarity to FR and enables the faster learning (black dashed line).
Finally, to show that our observations persist in models at scale, we perform targeted fine-tuning on open-source code generation LLMs, Qwen2.5-Coder (Hui et al., [13]) 0.5B and 1.5B. We fine-tune on specific formatting syntax (indentation, string formatting) among many plausible ones, and show similar timescale separations in limited cases. See Appendix § 13 for the results and the experimental details.
Overall, these experiments show that the separation of timescales between behavioral and representational forgetting is not restricted to the synthetic RHM but is a general phenomenon in fine-tuning with natural language.
Discussion
Our results show that the outcome of fine-tuning on restricted data is governed by two timescales: a fast timescale of behavioral forgetting in outputs, consistent with the latent–token correlations, and a slow timescale of representational forgetting, stemming from the noise accumulated over the fine-tuning updates. This separation of timescales provides an explanation for observations in LLMs where capabilities suppressed by fine-tuning or unlearning can still be elicited through alternative prompts or recovered from hidden representations ([16, 36, 22]): such models are in an intermediate regime between the two timescales, in which behavior has adapted while the underlying representations remain largely intact. Beyond this initial regime, our findings highlight how the accumulation of noise in the parameter updates can drive a slow representational drift ([1, 19]), eventually leading, on much longer timescales, to the loss of representations supporting the suppressed capabilities.
In this work, the considered setting is constrained to a specific form of fine-tuning, that is a narrower distribution of the training data. In Appendix § 10.10, we show that fine-tuning with out-of-distribution data generated from new sets of rules shows forgetting-relearning dynamics. We leave a thorough analysis of this case for future work.
While here we focus exclusively on SFT, Reinforcement Learning (RL) is another important and widely used fine-tuning method in modern training pipelines. Studying how knowledge and skills from pretraining can continue to be relearned, composed, and reused throughout RL post-training ([17, 35]) is an exciting future direction.
Acknowledgments
We thank Francesco Cagnetta, Matthieu Wyart, Yedi Zhang and Nishil Patel for valuable discussions. JHL, AS and AMS thank the Sainsbury Wellcome Centre Core Grant from Wellcome (219627/Z/19/Z) and the Gatsby Charitable Foundation (GAT3850). All authors thank the Coefficient Giving for Technical AI safety grant.
Ethics Statement
While our work aims for a fundamental understanding of language models and their fine-tuning process, we do not anticipate any immediate societal impact from this research.
Reproducibility Statement
We report detailed experimental setup to reproduce all the results in the Appendix. The code to reproduce the main experiment on the Random Hierarchy Model (Figure 2) is available at https://github.com/yilin-luo/two-timescales-of-forgetting.
Additional results and experimental details on the Random Hierarchy Model
Experimental details
The settings below apply to the restriction experiments with , , , and . We retain the last entries of each symbol’s rule list. Since the entries are exchangeable under the grammar draw, this is equivalent to selecting a uniformly random subset. Table 1 supplements the training setup in § 3.1.
| blocks | 4, with layer normalization before each attention and feed-forward operation |
| hidden width , heads | 512, 16 |
| feed-forward layers | hidden width , Gaussian-error linear unit (GELU) |
| positional embedding | learned, absolute |
| readout | linear, tied to the token embedding, after a final layer normalization |
| biases, dropout | none |
| parameters | |
| Adam coefficients | , |
| weight decay | none in baseline runs; decay in Appendix A.7 applies to matrices and embeddings, not layer-normalization gains |
| fine-tuning learning rate | ; and in Figure 3 and Appendix A.5 () |
| gradient clipping | none |
| test set | held-out sequences |
| pretraining steps | at ; at and 10 |
| fine-tuning steps | up to , continuing beyond the initial convergence of the kept-grammar loss |
| fine-tuning checkpoints | nominal 280-point logarithmic grid, rounded to integer steps with duplicates removed; weights only |
| seeds | 4 per , each with its own grammar and network initialization; 3 in the learning-rate comparison |
| generation probe | 8192 sequences per checkpoint |
| representation probe | 4096 original sequences per node and checkpoint |
| linear probe | 4096 training and 4096 test sequences per node and checkpoint |
| test families | 8192 sequences per family and seed |
Table 1. Network, training and evaluation settings supplementing § 3.1 for the restriction experiments.
For the representation probes of § 3.2, both inputs are standardized using the coordinate-wise mean and standard deviation of the untransformed samples at the same checkpoint. After replacing a rule, we regenerate its descendants using kept rules; tokens outside the selected subtree are unchanged. The symbol reference uses the same original samples as . In the generation probe, unparsable nodes remain in the denominator and count as neither kept nor deleted.
Pretraining: network depth and scaling across grammar sizes
We supplement § 4.1 with a network-depth comparison and a test across grammar sizes. The loss curves show against the number of sampled training sequences . For the plateau references defined in § 3.2, belief propagation marginalizes all leaves outside the specified context, following Eq. 22 of Cagnetta et al. [5]. Each reference is evaluated using the seed’s own grammar and 8192 held-out sequences.
The figures mark the sample scales of § 4.1 with their prefactor,
The bottom book is the exception to the form . No latent below it has to be inferred, and learning it only requires observing its admissible -tuples (Favero et al. [9]); is the first scale of Eq. (13) in Cagnetta & Wyart (2024).
During pretraining, we evaluate the overlap defined in equation (1) under the symbol replacement that defines the symbol reference in § 3.2, sampling from and regenerating the replaced subtree with . We denote this probe by . It is close to 1 when the representation does not depend on the latent at that node and decreases as this dependence develops. At the end of pretraining at , its values are close to those of the symbol reference at the start of fine-tuning in Figure 2(b).
The depth comparison uses the same grammars and training settings, with steps for each network. Reducing the number of blocks delays the later loss decreases, and the one-block network does not reach the full-context reference within the training duration. Increasing the width of the two-block network leaves its learning curve close to that of the narrower two-block network. Thus, the delay in these runs cannot be attributed solely to their smaller parameter count.
The comparison across grammar sizes uses $10^6$ pretraining steps at and at $m = 8, 10. Under the rescaling in Figure 6, the departures from successive plateaus approximately align across . The agreement concerns the transition locations; the losses reached after each transition remain grammar-dependent.
Figure 6. Last-token learning curves of the four-block network at ; mean std over 8 seeds. Panels (a) to (d) correspond to the transitions . Each plots , using the seed’s own plateau reference, against divided by the -dependent factor of in equation (6). Dotted horizontal line: 1. Dashed vertical line: the common prefactor fixed in Figure 5, expressed on the rescaled axis.
Additional results
Figure 7 extends Figure 2 to and . Representational change occurs earlier at than at these two grammar sizes, whose timescales are similar. However, their base networks were pretrained for longer (Table 1) and have larger parameter norms. This comparison therefore does not isolate the dependence of the slow timescale on .
Figure 7. Restriction fine-tuning at , (top row), and , (bottom row); mean std over 4 seeds. (a), (d) Deleted-rule generation rates at levels against fine-tuning step ; dotted line: . The same curves against are shown in Figure 8(b), (Figure 8c). (b), (e) at , and , with each node’s symbol reference (dotted). (c), (f) on the three test families; gray dashed line: the seed-averaged Bayes-optimal loss of . Colors follow Figure 2.
Figure 8 shows the deleted-rule rates of Figure 2(a) and Figure 7(a), (Figure 7d) against the rescaled step of equation (3), at full size and with the variation across seeds, for , and . Figure 9 shows the same comparison for the grammar with at three values of .
Linear probe
As complementary evidence to the representation probe in the main text, we fit linear probes to the hidden representations [7] to test whether the symbol of a node can still be read from the representation when this node uses a deleted rule. The results are shown in Figure 11, Figure 13 and Figure 14. The probe is a linear classifier that predicts the symbol of one latent node from the hidden representation at one position. We probe the three nodes of , with . The probe is fitted on sequences sampled from , in which every node uses a kept rule, and it tested on transformed sequences : the rule of the probed node is replaced by a uniformly drawn deleted rule of the same symbol, the subtree of the node is generated again with kept rules, and all other tokens are unchanged. The probe therefore never sees a deleted rule during fitting, and its test accuracy is high only if the representations of the deleted rules are intact and represent the symbol in the same way as those of the kept rules. We call this test accuracy the linear probe accuracy.
The classifier is a multinomial logistic regression over the symbols, fitted with an penalty of coefficient on its weights. Each coordinate of the representation is standardized with the mean and standard deviation of the fitting inputs. The test sequences are built from other samples than the fitting sequences, so that fitting and testing share no sequence; the numbers of sequences are given in Table 1.
For each probed node, the representation is read at the last token of the node’s subtree. The symbol of a node is determined by the tokens of its subtree, and the network at a given position has seen only the tokens up to that position. The last token of the subtree is therefore the first position at which the representation can contain the symbol of the node. We count token positions from the end of the sequence, as for the node indices: is the last token and the second to last. The subtree of ends at the th token from the end, that is, at , and for . The probe is instead read at , the position that predicts the last token. We fit one probe at the input embedding and after each layer of the network, and report the largest test accuracy. Thus, if any representation of the deleted rules is still intact after any layer, it can be picked out.
Learning-rate dependence
Both the deleted-rule rate and the linear probe accuracy collapse when plotted against a rescaled time. Figure 10 shows that, at every level, the deleted-rule rates at the three learning rates coincide under the scaling . The linear probe accuracies of the latent nodes at the different levels instead coincide under the scaling (Figure 11). This difference supports the argument for two different regimes of behavioral suppression and representational drift in § 4.4. In each figure, the last row shows the other scaling under which the curves do not coincide.
Figure 12 shows the same comparison for the two quantities of Figure 3(b) and (Figure 3c), the representation probe at and the distance of the parameters from their pretrained values. Both coincide under the scaling and not under ; for the distance, this is in the later stage, in which it increases approximately as .
Bounded suppression
Figure 13 compares the baseline with the bounded suppression of § 4.4, in which a token other than the target is dropped from the cross-entropy once its logit is more than 8 nats below the largest logit of its position, so that the loss stops pushing tokens that are already suppressed. With bounded suppression, the deleted-rule rate stops decreasing at a small value at every level (Figure 13(a) to (d)), while at follows the same curve as in the baseline (Figure 13(e)), and so does the linear probe accuracy at the same node (Figure 13(f), Appendix § 10.§ 4).
Two regularizations in the fine-tuning
§ 4.4 relates the slow timescale to the drift of the parameters away from their pretrained values . Here we change this drift with two explicit regularizations that act on it in opposite ways: one moves the parameters back toward , the other moves them away from , toward zero.
Setup. The regularization toward the pretrained parameters moves each parameter a fraction of the way toward its pretrained value at every step, . Decoupled weight decay (Loshchilov & Hutter [20]) is the same regularization toward zero, . Acting alone, either regularization brings the parameters close to its target over a time of order . Both are applied separately from the Adam update, to the matrices and embeddings but not to the layer-normalization gains. All other settings are unchanged.
The behavioral suppression is unchanged. The suppression is completed long before a time of order . Over this interval the deleted-rule rate and the distance from follow the same curves for every , under both regularizations (Figure 14(a), (b), (d) and (e)). Afterwards the deleted-rule rate stays low, with only a slightly higher residual for larger , including under the strongest regularization toward . The behavioral suppression thus requires only a small displacement from , which the fine-tuning gradient maintains against the regularization.
Regularization toward delays or prevents the loss of the representations. This regularization counteracts the drift: the distance from stops increasing, at a value that is smaller for larger (Figure 14(d)). When this value is small enough, the linear probe accuracy stays close to 1 over the whole run, so the representations of the deleted rules are retained. Under the weakest regularization the accuracy still decreases, but later than in the baseline (Figure 14(f)).
Weight decay accelerates the loss of the representations. Weight decay adds a systematic motion of the parameters away from , toward zero, over a time of order (Figure 14(a)). When this time is shorter than the slow timescale of the baseline, the linear probe accuracy decreases after a time of order , earlier for larger . When it is longer, the noise drift comes first, and the accuracy decreases only slightly earlier than without decay (Figure 14(c)).
Recovering the deleted rules
We test whether a fine-tuned network generates the deleted rules again when it is trained again on , and how the time that this takes depends on the duration of the fine-tuning.
Setup. We take the network at fine-tuning step , for checkpoints taken throughout the fine-tuning, reset the Adam moments, and train it on freshly sampled sequences with the fine-tuning settings. During this training we measure the deleted-rule rate at each level with the generation probe. Under this rate is . The relearning time of level is the number of training steps until its deleted-rule rate first reaches 0.45. As a reference, we train the same architecture on from random initialization with the same settings, which repeats the pretraining, and measure the same times.
Dependence on the duration of the fine-tuning. At every level, the relearning time increases with the fine-tuning step from which the relearning starts (Figure 15). This increase begins while the linear probe accuracy is still close to 1 (Figure 11), so the loss of the representations is not its only cause. Over the same interval, the loss on the deleted grammar keeps increasing (Figure 2(c)): the fine-tuning makes the deleted rules less and less probable, and more steps are needed to undo this suppression.
Figure 15. Retraining on from the restriction fine-tuning at step (, ): steps until the deleted-rule rate of level is back above 0.45 (1/2 under ), against ; dashed lines: the same network trained on from random initialization, same color per level. Seed 0.
Comparison with random initialization. From the checkpoints taken after the fast suppression and before the slow timescale, the levels to are relearned faster than they are learned from random initialization (dashed lines in Figure 15), by a larger factor at higher levels. This advantage decreases for later starts. From the latest start, at which the representations of the deleted rules are lost (Figure 11), only the root is still relearned faster than from random initialization, and the levels to are relearned more slowly. The bottom level differs from the others at every start: it is learned within very few steps from random initialization, and relearning it from a fine-tuned network takes longer, because the suppression has to be undone.
In summary, between the two timescales the suppressed rules at the levels to are relearned much faster than they are learned from random initialization, and after the slow timescale this advantage is lost.
Continuations after deleted-rule context
We test whether a context that contains deleted rules leads the fine-tuned network to generate deleted rules again. This is the analogue in the RHM of prompting a fine-tuned model with text that it no longer generates.
Setup. We sample a sequence from and give its first half to the fine-tuned network as context. Under , each of the seven latent nodes of the first half uses a deleted rule with probability . The network then generates the second half by sampling at temperature 1. We parse the whole sequence with and assign each node of the second half to one of three cases: it uses a kept rule, it uses a deleted rule, or it is invalid, which means that its children are not a rule of or that a node below it is invalid. We use 8192 first halves per checkpoint and seed.
We assign the root to the same three cases. The rule at the root joins the two halves: its left child is the top node of the first half, whose symbol is fixed by the context, and its right child is the top node of the generated half. A valid root therefore requires a second half whose top symbol forms a rule of with . The root thus tests whether the network still identifies the symbol from a context written partly with deleted rules.
Inside the generated half. At the levels , once generation is suppressed, nearly every node of the generated half uses a kept rule (Figure 16(b)), and the deleted-rule rate keeps decreasing for the rest of the fine-tuning (Figure 16(a)). Deleted rules in the context therefore do not lead the network to generate deleted rules.
Figure 16. Free continuation of the second half after a first half drawn from , in which each node uses a deleted rule with probability (, ). Rate of deleted rules (a), of kept rules (b) and of invalid nodes (c) at each level of the parsed continuation: inside the second half, the rule at the root, which joins the two halves. A node is invalid when its children are not a rule of or a node below it is invalid. Dotted lines: , the value under in (a) and (b). Rates pooled over five consecutive checkpoints; mean std over 4 seeds.
At the root. After the fast suppression, the large majority of the roots use a kept rule (Figure 16(b), ). The network identifies the symbol of the first half, including when it is written with deleted rules, and continues the sequence with a kept rule. There are two exceptions. For a small fraction of first halves, no kept rule at the root has as its left child, so the sequence cannot be completed with a kept rule, and the network generates a deleted rule or an invalid root. For the other first halves, the root uses a deleted rule in a few percent of the generated sequences.
Much later in the fine-tuning, the fraction of invalid roots increases strongly (Figure 16(c)), over the interval in which the deleted-grammar-in-context loss increases (Figure 2(c)). Invalid roots occur when the first half contains deleted rules, and are nearly absent when it contains none. The network thus no longer identifies the symbol of a first half written with deleted rules, and the second half that it generates no longer forms a rule with . The deleted-rule rate at the root increases over the same interval (Figure 16(a)). This is not a return of the deleted rules: a second half generated without regard to gives an invalid root in most cases, and by chance a deleted rule in some.
Fine-tuning after resampling one rule book
We redraw the rule book at one level independently from the same RHM ensemble, leaving the other books unchanged. Some tuples or rules can therefore recur. Unlike the restriction in § 3.1, this intervention introduces new parent–child associations. We consider at and fine-tune for steps, with four seeds per level and the optimization settings of § 3.1. Here denotes the resampled grammar. We evaluate the loss and plateau references defined in § 3.2 and the symbol-replacement probe of Appendix A.2, using this grammar for both the original inputs and the transformed subtrees. The plateau references are averaged over held-out sequences per seed.
In Figure 17(a) to (Figure 17d), after the initial adjustment, the loss approaches the reference associated with the resampled level: for the root book, for level 3, for level 2, and approximately the random-guess loss for the bottom book. The unchanged books below the edit retain their conditional expansions, allowing prediction from local structure. Their symbol margins can nevertheless change, so resampling need not preserve the old local prediction probabilities.
Figure 17. Fine-tuning after resampling one rule book at ; columns run from the root book (level 4) to the bottom book (level 1). Curves and uncertainties show mean std over 4 seeds. (a) to (d) on sequences from the resampled grammar ; gray dashed lines: and the seed-averaged plateau losses of . (e) to (h) at , and , using . All panels share the fine-tuning-step axis.
For the probed nodes with , rises toward 1 (Figure 17(e) to (Figure 17h)), indicating reduced dependence on these latents of the new grammar. Lower nodes show smaller, transient changes. Since the probe uses , it measures adaptation to the new associations and does not establish complete loss of the old representations.
The subsequent loss decreases pass through successive plateau references, accompanied by decreases in the corresponding probes. Resampling a lower book requires relearning more levels and takes longer. This relearning is much slower than the initial adjustment, whose duration also varies with the resampled level.
Generation fine-tuning and correlations
Fine-tuning with fixed features
Consider predicting a token from a context in an RHM sequence. Let denote the hidden latent at the lowest common ancestor connecting the context to the target.
We consider an idealized -dimensional fixed encoder learned during pretraining which recovers this latent from the context:
The predictor is a trainable linear readout,
with . Its predictions depend on the context only through the encoded ancestor . Training minimizes cross-entropy, with held fixed.
Pretraining. We initialize the readout at pretrained weights that approximately fit the pretraining distribution:
Fine-tuning. Following the restriction procedure in § 3.1, only production rules are retained per restricted parent. This changes the ancestor frequencies and conditional targets to
Writing
the population fine-tuning loss becomes
Initial readout update. The first population gradient update with learning rate reads
At the pretrained initialization,
By orthogonality of the features, the corresponding logit change for each ancestor is exactly
The ancestor marginals are random quantities of typical size . Approximating , we get
showing that the initial readout update is proportional to the change in the ancestor-conditioned target distribution.
Computation of the correlation difference
We estimate the RMS change in the conditional prediction,
where averages over RHM rules. As in the main text (§ 4.3), denotes the context node and the depth of its lowest common ancestor with the target. For simplicity, we consider the case of a binary RHM tree () and retain of the original rules per parent at every relevant level. We use a balanced, large-vocabulary approximation: node marginals have typical size , and their fluctuations are neglected in the leading estimate.
Case . For , the context is a visible token and the target is its sibling. Let be the set of originally allowed successors, and let be the retained set. Unambiguity ensures that each pair occurs in at most one production. Under uniform parent frequencies, the conditional is therefore uniform on the corresponding set of successors. There are on average such successors before restriction and afterward. Replacing the counts by these values gives
Thus a retained successor changes by , whereas a deleted successor changes by . Summing the squared changes gives
Dividing by yields the mean squared change per output token:
General depth . For , the context identifies a latent on one side of the LCA, and the target descends from its other child through further levels. There are therefore approximately predictive paths before restriction and afterward, where each path counts sequences of rule choices.
Let and denote these path sets. Let be one if path ends at and zero otherwise. This indicator has disorder mean and variance . Suppressing the fixed arguments , the conditional probabilities are approximated by
Neglecting correlations between distinct paths, each additional level reduces the variance by a factor or , respectively:
The two averages are not independent: all retained paths also contribute to the pretrained prediction. Keeping their shared contribution gives
Both conditional probabilities have disorder mean . Their mean squared difference therefore equals the sum of their variances minus twice this covariance, giving
This recovers the one-level calculation and vanishes when no rules are deleted. For a fixed retained fraction, the leading dependence on is . Using , the balanced approximation relates the correlation difference to the conditional difference by an additional factor . Hence
Comparison of fine-tuning with non-linear vs linearized model
To isolate the role of feature evolution during fine-tuning, we compare the full nonlinear model with its first-order linearization around the pretrained parameters . In the linearized experiment, the logits are approximated as , with the Jacobian held fixed while is optimized using Adam on the same restricted fine-tuning distribution. By contrast, the nonlinear model updates directly, allowing both its representations and Jacobian to evolve. In Figure 18, we consider grammars with , retain half of the rules at every hierarchy level, and compare the level-wise forbidden-generation rates over the first fine-tuning steps, averaged across four seeds. We observe that only for the hierarchical level the forbidden generation rate starts decreasing at the same timescale, while for larger the decreasing timescale is longer for the linearized model. This shows that, despite the fixed synonymic representations, feature adaptation is important for changing the forbidden rate generation.
Additional results and experimental details on bilingual small language model experiment
Pretraining and fine-tuning of bilingual small language model
Translation. We considered English-French (EN-FR) and English-Turkish (EN-TR) pairs. We primarily built the training corpus from uonlp/CulturaX (Nguyen et al. [25]), a widely used multilingual web text collection after cleaning and deduplication. Among 2.21M respective documents of English, French and Turkish from the CulturaX corpora, we randomly sample 450,000 documents per language. Each document is split into sentences. For simplicity, we assume new sentences when followed by line breaks, then terminal punctuation followed by whitespace and an upper-case letter, digit or opening quote, with an abbreviation list. We keep a document if it consists of at least 3 sentences and at least half of its sentences survive the criteria (at least 60% letters are among non-space characters, no URL or e-mail address, at most 256 tokens, and a token-unigram language classifier that agrees with the document language), resulting in 427,631 English, 419,171 French documents, 422,975 Turkish documents. Every kept sentence is machine-translated into the other language pair, from English to French, French to English, from English to Turkish and Turkish to English with the corresponding Marian Transformer-big (Tiedemann [34]; Tiedemann & Thottingal [34]), sentence by sentence without cross-sentence context. After the translation, we apply the same criteria again to each sentence, which keeps of the sentences.
Bilingual text generation for pretraining. After the translation of each document, we rebuild the same document by randomly sampling each sentence’s language. In other words, the contents of the document are the same, but the bilingual document switches each sentence’s language between English and French randomly. Therefore, language is half native and half translated. We train our own byte-level BPE tokenizer using English and French corpora of CulturaX, with a vocabulary of 16,384 tokens that yields comparable counts for English and French (0.248 tokens/char for English and 0.259/char for French). For English-Turkish pair, the CulturaX corpora with the same vocabulary of 16,384 tokens was used which again yields comparable counts (0.254 tokens/char for English and 0.249 tokens/char for Turkish). The EN-FR bilingual document has median 548 tokens and 18 sentences. EN-TR bilingual document has median 486 tokens and 17 sentences.
Fine-tuning data. For fine-tuning, we use an unseen fraction of the data from CulturaX. After the pretraining with bilingual documents, we fine-tune the model with monolingual documents, reflecting the fine-tuning with data generated from restricted grammar in RHM.
Training setup. The model is a decoder-only nanoGPT architecture [14] with 8 pre-LayerNorm blocks, 8 heads, width 512, MLP width 2048 with GELU activation, rotary position embeddings, no biases, no dropout, tied input/output embeddings and context length of 512. This architecture resulted in M parameters. We train with the next-token prediction objective with batch size 64, for steps, corresponding to 3.28B tokens. For optimization, we used AdamW with , weight decay of , peak learning rate , 1,000 warm-up steps, cosine decay to , gradient clipping at 1.0. For fine-tuning, we take the final checkpoints from the pretraining and continue next-token prediction training for steps at batch size of 64, with the constant learning rate and same optimizer setting. We perform 3 seeds of pretraining and apply a single seed of English monolingual fine-tuning and French/Turkish monolingual fine-tuning.
Evaluation of bilingual pretrained–monolingual fine-tuned language models
Free generation. We give a single end-of-text token in-context and let the model autoregressively generate 160 tokens at single context in total 1024 samples. For each passage, we sample 160 tokens with temperature 1.0. We count each sentence by splitting at newline tokens. To classify each sentence’s language, we use a naive Bayes classifier over the vocabularies [30]. We take 50M tokens from EN and FR/TR each from the CulturaX corpus and count unigram frequency of each token in each language’s corpus to estimate a categorical distribution over the vocabulary. Then we sum log-likelihood ratio between FR/TR and EN over the tokens in a sentence. A positive value means the sentence is likely French/Turkish and vice versa. We test that held-out monolingual sentences show accuracy with a 10-token span using the classifier. We report the generation rate of the removed language during fine-tuning on both 1) the first sentence from generation and 2) the entire generated sentences.
Representational similarity. We subsample single sentences from unseen test passages. For the shuffled incoherent sentences, we keep the first and the last words of the sentence but shuffle the order of the remaining words, to minimize the effect due to a difference in the last word. We take the hidden representation after the final layer norm at the last word token of the sentence, center the hidden representation coordinate-wise and compute the absolute cosine similarity of the representations from coherent and shuffled sentences in each language.
Prediction loss. We use unseen test passages in each language that consist of more than 3 sentences. We feed in all preceding sentences of each passage as a context either in EN monolingual or FR/TR monolingual, but not the last target sentence. Then, we measure the cross-entropy loss on the first token of the target sentence either in EN or FR/TR. This metric is a reflection of the three test families of the prediction loss (Figure 1(f)). Assuming we fine-tune with EN: kept rule is equivalent to measuring loss on EN target given EN context, deleted rule is equivalent to measuring loss on FR/TR target given FR/TR context, and deleted in-context measures loss on EN target given FR/TR context.
Context ablation. We reuse the targets and contexts of the prediction loss and build, for each, an uninformative context: every context sentence is replaced by a sentence drawn at random from a different test passage, in the same language. Then, we measure the cross-entropy loss on the averaged target sentence in the kept language. We report , the loss under the uninformative context minus the loss under the original one either in the kept or in the removed language. We measure the same metric in a model that was only trained from the kept language which serves as a baseline.
Recoverability. To test whether the removed language is suppressed or erased, we train the fine-tuned models again on the bilingual pretraining task and measure how fast the removed language recovers. The relearning corpus is built from the passages used for monolingual fine-tuning, but not included in the pretraining. We train for steps with the fine-tuning hyperparameters (constant learning rate , batch of 64 sequences of 512 tokens, weight decay 0.1). We start from the monolingual fine-tuned model at steps , , and , and from three baselines: the bilingual pretrained model, which gives the level to recover; a model pretrained on the kept language alone, which has nothing to recover; and a randomly initialized model (trained from scratch). Along relearning, we measure the loss on a target sentence in the removed language given its context in the removed language, on the same 6k targets, averaged over the tokens after the first one.
Additional results on bilingual pretrained–monolingual fine-tuned language models
In the main text (§ 5), we only show the results from the EN-fine-tuned model. We report the FR/TR-fine-tuned model (Figure 19; Figure 22 and Figure 23 for the English-Turkish pair) and also the models trained without weight decay (Figure 20 and Figure 21), which show a consistent trend. The control experiments are shown in Figure 24 and Figure 25.
Figure 20. Bilingual pretraining and English-only fine-tuning without weight decay. Panels (a) to (d), colors and reference line as in Figure 4: French generation, coherent–shuffled representation similarity, prediction loss and relative parameter distance.
Figure 21. Bilingual pretraining and French-only fine-tuning without weight decay. Panels (a) to (d), colors and reference line as in Figure 19: English generation, coherent–shuffled representation similarity, prediction loss and relative parameter distance.
Figure 25. Bilingual pretraining and French-only fine-tuning additional control experiments. Panels (a)-(c) are equivalent to Figure 24, only switching kept language (FR) and removed language (EN).
Additional results and experimental details on coding language model experiment
Targeted formatting fine-tuning
Fine-tuning data We use Qwen2.5-Coder 0.5B base model Hui et al. [13]. We build the fine-tuning corpus from codeparrot/github-code-clean CodeParrot (2022), a public collection of GitHub source files. We filter Python files and we rewrite two surface formatting conventions into one canonical form each, leaving the program unchanged: indentation with tabs or with 2, 3 or 8 spaces becomes 4 spaces; % and .format() string formatting becomes f-strings. With this, for indentation formatting restriction 4-spaces becomes kept rule and all others (tabs, 2, 3, or 8 spaces) become deleted rule. For the string formatting restriction, f-strings is kept rule and % and .format() become deleted rule. We use standard tools (lib2to3, ruff, flynt, docstring-parser) which performs deterministic conversion between the formatting styles. We exclude a file if it does not parse or if any removed rule survives the conversion. This keeps 835,104 of 902,051 files (93%), makes total 1.95B tokens. We report results for the two removed indentation formats (tabs, 2 spaces) and the two removed string-formatting formats.
Model and training setup. We fine-tune all parameters of Qwen2.5-Coder-0.5B, 1.5B Hui et al. [13] base models, with either the indentation formatting restriction or string formatting restriction. We use AdamW (, , no weight decay) with learning rate , held constant after a linear warm-up of 100 steps, batch size 32 sequences of 2,048 tokens, and gradient-norm clipping at 1. We train for 30,000 steps which roughly gives one pass over the fine-tuning dataset corpus.
Evaluation We follow the same evaluation metrics used for bilingual-transformer; (i) removed rule generation rate, (ii) cosine similarity between coherent / shuffled context with kept/removed rules and (iii) prediction loss after the context with kept/removed rule.
Results on formatting fine-tuned large language models
Figure 26. Targeted syntax fine-tuning on Qwen2.5-Coder-0.5B. Panels (a)-(d) are equivalent metrics to those of bilingual transformer experiments. The text on each panel indicates removed syntax.
Figure 27. Targeted syntax fine-tuning on Qwen2.5-Coder-1.5B. Panels (a)-(d) are equivalent metrics to those of bilingual transformer experiments. The text on each panel indicates removed syntax.
References
- [1]Guy Blanc, Neha Gupta, Gregory Valiant, and Paul Valiant. Implicit regularization for deep neural networks driven by an Ornstein-Uhlenbeck like process. In Conference on Learning Theory, pp. 483–513. PMLR, 2020.
- [2]Lukas Braun, Clémentine Dominé, James Fitzgerald, and Andrew Saxe. Exact learning dynamics of deep linear networks with prior knowledge. Advances in Neural Information Processing Systems, 35:6615–6629, 2022.
- [4]Francesco Cagnetta, Leonardo Petrini, Umberto M. Tomasini, Alessandro Favero, and Matthieu Wyart. How deep neural networks learn compositional data: The Random Hierarchy Model. Phys. Rev. X, 14:031001, Jul 2024. doi: 10.1103/PhysRevX.14.031001. URL https://link.aps.org/doi/10.1103/PhysRevX.14.031001.DOI
- [5]Francesco Cagnetta, Alessandro Favero, Antonio Sclocchi, and Matthieu Wyart. Scaling laws and representation learning in simple hierarchical languages: Transformers versus convolutional architectures. Phys. Rev. E, 112:065312, Dec 2025. doi: 10.1103/qtd6-nl8p. URL https://link.aps.org/doi/10.1103/qtd6-nl8p.DOI
- [7]MohammadReza Davari, Nader Asadi, Sudhir Mudur, Rahaf Aljundi, and Eugene Belilovsky. Probing representation forgetting in supervised and unsupervised continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16712–16721, 2022. URL https://openaccess.thecvf.com/content/CVPR2022/html/Davari_Probing_Representation_Forgetting_in_Supervised_and_Unsupervised_Continual_Learning_CVPR_2022_paper.html.arxiv.org/abs/2203.13381
- [8]Shibhansh Dohare, J Fernando Hernandez-Garcia, Qingfeng Lan, Parash Rahman, A Rupam Mah-mood, and Richard S Sutton. Loss of plasticity in deep continual learning. Nature, 632(8026): 768–774, 2024.DOI
- [9]Alessandro Favero, Antonio Sclocchi, Francesco Cagnetta, Pascal Frossard, and Matthieu Wyart. How compositional generalization and creativity improve as diffusion models are trained. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 16286–16306, 2025.arxiv.org/abs/2502.12089
- [10]Aditya Golatkar, Alessandro Achille, and Stefano Soatto. Eternal sunshine of the spotless net: Selective forgetting in deep networks. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 9301–9309. IEEE, 2020a.arxiv.org/abs/1911.04933
- [12]Ian J Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. An empirical investigation of catastrophic forgetting in gradient-based neural networks. In International Conference on Learning Representations, 2014.arxiv.org/abs/1312.6211
- [13]Binyuan Hui, Jian Yang, Zeyu Cui, Jiaxi Yang, Daiheng Liu, Lei Zhang, Tianyu Liu, Jiajun Zhang, Bowen Wu, Keming Lu, et al. Qwen2.5-Coder technical report. arXiv preprint arXiv:2409.12186, 2024.arxiv.org/abs/2409.12186
- [14]Andrej Karpathy. nanoGPT: The simplest, fastest repository for training/finetuning medium-sized GPTs. https://github.com/karpathy/nanoGPT, 2022.
- [15]Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.arxiv.org/abs/1412.6980
- [16]Suhas Kotha, Jacob Springer, and Aditi Raghunathan. Understanding catastrophic forgetting in language models via implicit inference. In International Conference on Learning Representations, volume 2024, pp. 24110–24139, 2024.arxiv.org/abs/2309.10105
- [17]Jin Hwa Lee, Stefano Sarao Mannelli, and Andrew Saxe. Why do animals need shaping? A theory of task composition and curriculum learning. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pp. 26837–26855, 2024.
- [18]Sebastian Lee, Sebastian Goldt, and Andrew Saxe. Continual learning in the teacher-student setup: Impact of task similarity. In International Conference on Machine Learning, pp. 6109–6119. PMLR, 2021.arxiv.org/abs/2107.04384
- [19]Zhiyuan Li, Tianhao Wang, and Sanjeev Arora. What happens after SGD reaches zero loss? A mathematical framework. In International Conference on Learning Representations, 2022.arxiv.org/abs/2110.06914
- [20]Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019.
- [21]Clare Lyle, Zeyu Zheng, Evgenii Nikishin, Bernardo Avila Pires, Razvan Pascanu, and Will Dabney. Understanding plasticity in neural networks. In International Conference on Machine Learning, pp. 23190–23211. PMLR, 2023.arxiv.org/abs/2303.01486
- [22]Aengus Lynch, Phillip Guo, Aidan Ewart, Stephen Casper, and Dylan Hadfield-Menell. Eight methods to evaluate robust unlearning in LLMs. arXiv preprint arXiv:2402.16835, 2024. URL https://arxiv.org/abs/2402.16835.
- [23]Sadhika Malladi, Alexander Wettig, Dingli Yu, Danqi Chen, and Sanjeev Arora. A kernel-based view of language model fine-tuning. In International Conference on Machine Learning, pp. 23610–23641. PMLR, 2023.arxiv.org/abs/2210.05643
- [24]Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of Learning and Motivation, volume 24, pp. 109–165. Elsevier, 1989.DOI
- [25]Thuat Nguyen, Chien Van Nguyen, Viet Dac Lai, Hieu Man, Nghia Trung Ngo, Franck Dernoncourt, Ryan A. Rossi, and Thien Huu Nguyen. CulturaX: A cleaned, enormous, and multilingual dataset for large language models in 167 languages. In Nicoletta Calzolari, Min-Yen Kan, Veronique Hoste, Alessandro Lenci, Sakriani Sakti, and Nianwen Xue (eds.), Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024), pp. 4226–4237, Torino, Italia, May 2024. ELRA and ICCL. URL https://aclanthology.org/2024.lrec-main.377.arxiv.org/abs/2309.09400
- [26]Evgenii Nikishin, Max Schwarzer, Pierluca D’Oro, Pierre-Luc Bacon, and Aaron Courville. The primacy bias in deep reinforcement learning. In International Conference on Machine Learning, pp. 16828–16847. PMLR, 2022.arxiv.org/abs/2205.07802
- [27]Farhad Pashakhannloo and Alexei Koulakov. Stochastic gradient descent-induced drift of representation in a two-layer neural network. In International Conference on Machine Learning, pp. 27401–27419. PMLR, 2023.
- [28]Vinay Ramasesh, Aitor Lewkowycz, and Ethan Dyer. Effect of model and pretraining scale on catastrophic forgetting in neural networks. In International Conference on Learning Representations, 2022.
- [29]Vinay V. Ramasesh, Ethan Dyer, and Maithra Raghu. Anatomy of catastrophic forgetting: Hidden representations and task semantics. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=LYh8QdUGSUw.
- [30]Sebastian Raschka. Naive Bayes and text classification I – Introduction and theory. arXiv preprint arXiv:1410.5329, 2014.arxiv.org/abs/1410.5329
- [31]Antonio Sclocchi, Alessandro Favero, and Matthieu Wyart. A phase transition in diffusion models reveals the hierarchical nature of data. Proceedings of the National Academy of Sciences, 122(1): e2408799121, 2025.DOI
- [32]Haizhou Shi, Zihao Xu, Hengyi Wang, Weiyi Qin, Wenyuan Wang, Yibin Wang, Zifeng Wang, Sayna Ebrahimi, and Hao Wang. Continual learning of large language models: A comprehensive survey. ACM Computing Surveys, 58(5):1–42, 2025.arxiv.org/abs/2404.16789
- [34]Jörg Tiedemann and Santhosh Thottिंगal. OPUS-MT – building open translation services for the world. In Proceedings of the 22nd Annual Conference of the European Association for Machine Translation, pp. 479–480, Lisboa, Portugal, November 2020. European Association for Machine Translation. URL https://aclanthology.org/2020.eamt-1.61.
- [35]Rosie Zhao, Alexandru Meterez, Sham Kakade, Cengiz Pehlevan, Samy Jelassi, and Eran Malach. Echo chamber: RL post-training amplifies behaviors learned in pretraining. In Second Conference on Language Modeling, 2025. URL https://openreview.net/forum?id=dp4KWuSDzj.arxiv.org/abs/2504.07912
- [36]Junhao Zheng, Xidi Cai, Shengjie Qiu, and Qianli Ma. Spurious forgetting in continual learning of language models. In International Conference on Learning Representations, volume 2025, pp. 67081–67146, 2025.arxiv.org/abs/2501.13453
























