Mechanistic Analysis of Catastrophic Forgetting in Large Language Models During Continual Fine-tuning
Olaf Yunus Laitinen Imanov
TL;DR
This work analyzes catastrophic forgetting in transformer-based LLMs during sequential fine-tuning, addressing how learned knowledge deteriorates as new tasks are introduced. It builds a mechanistic framework identifying three interacting processes—gradient interference on attention, representational drift in intermediate layers, and loss-landscape flattening near prior task minima—and shows these effects are modulated by model scale and task similarity, with a strong empirical link to forgetting (e.g., $r = 0.87$). By demonstrating causal relationships via targeted interventions (attention freezing, representation realignment, curvature regularization), the study delivers actionable strategies to mitigate forgetting and informs future architecture and optimization designs for robust continual learning. The findings advance mechanistic interpretability of LLMs and offer practical guidance for deploying continually adapting models with reduced catastrophic forgetting, scalable across large parameter budgets.
Abstract
Large language models exhibit remarkable performance across diverse tasks through pre-training and fine-tuning paradigms. However, continual fine-tuning on sequential tasks induces catastrophic forgetting, where newly acquired knowledge interferes with previously learned capabilities. Despite widespread observations of this phenomenon, the mechanistic understanding remains limited. Here, we present a comprehensive mechanistic analysis of catastrophic forgetting in transformer-based LLMs during sequential fine-tuning. Through systematic experiments across multiple model scales (109B to 400B total parameters) and task sequences, we identify three primary mechanisms driving forgetting: gradient interference in attention weights, representational drift in intermediate layers, and loss landscape flattening. We demonstrate that forgetting severity correlates strongly with task similarity (Pearson r = 0.87) and gradient alignment metrics. Our analysis reveals that approximately 15 to 23 percent of attention heads undergo severe disruption during fine-tuning, with lower layers showing greater susceptibility. These findings establish mechanistic foundations for developing targeted mitigation strategies in continual learning systems.
