NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Gradient Localization Improves Lifelong Pretraining of Language Models

Jared Fernandez, Yonatan Bisk, Emma Strubell

TL;DR

Large language models quickly become outdated, but updating them via continual pretraining often leads to catastrophic forgetting or poor uptake of new facts. This paper demonstrates that factual updates are naturally localized within specific layers of a model, showing gradient norms 4x to 15x higher than standard text. By targeting parameter updates specifically to these "high-signal" layers, the authors significantly improve a model's ability to learn new entities and update relationships without degrading its existing knowledge.

What Problem Does This Paper Address?

When Large Language Models (LLMs) are trained on static web corpora, their knowledge is frozen at the moment of data collection. In the real world, facts change: sports players switch teams, political offices change hands, and entirely new entities emerge.

While we can try to keep LLMs fresh by continually pretraining them on new streams of data, standard optimization updates all parameters uniformly. This naive approach suffers from a severe trade-off: the model either fails to absorb new information or catastrophically forgets previously learned facts. The authors argue that this stems from a fundamental misalignment between the standard autoregressive language modeling objective and the localized way factual knowledge is actually stored in neural networks.

Figure 1: When continually pretraining on sequences with updated and newly mentioned entities, certain layers consis- tently observe larger gradient norms.

Methods

To bridge this gap, the authors introduce Traced Gradient Layers (TGL), a method that identifies and targets the specific layers responsible for factual updates.

First, they calculate a relative gradient norm for each layer. They do this by taking the parameter gradients generated when the model predicts a specific, knowledge-intensive entity (a "salient span") and dividing it by the gradients generated during standard, random autoregressive pretraining.

Once these critical layers are identified, they propose two strategies to align the training process:

  1. TGL + FP (Frozen Parameters): A hard thresholding approach where parameters are frozen in any layer where the relative gradient norm falls below the mean across all layers. Only the high-signal layers are updated.
  2. TGL + ALR (Adaptive Learning Rates): A soft approach where the learning rate of each layer is dynamically scaled proportional to its relative gradient norm. Layers experiencing a massive gradient spike get a higher learning rate, while low-signal layers change very little.

These methods are modular and designed to be stacked on top of existing continual learning baselines like LoRA, MixReview, and RecAdam.

Datasets

The authors evaluated their approach using Wikipedia snapshots spanning 2019 to 2022, filtering for text edits made year-over-year. To probe specific types of knowledge degradation, they utilized two diagnostic datasets:

  • Dynamic TempLAMA: Evaluates a model's ability to update changing relationships between existing entities (e.g., tracking a politician's changing job title).
  • Entity Cloze By Date (ECBD): Specifically the ECBD-NP split, which tests the acquisition of entirely new entities that did not exist during initial pretraining. They also used the ECBD-Popular split (containing static, universally known entities) to measure catastrophic forgetting.

Key Insights and Ideas

  • The 15x Gradient Spike: When an LLM processes a sequence containing a factual update or a new entity, the gradient norms in certain layers are 4x to 15x larger than when it processes standard text.
  • Anatomy of a Fact: Factual updates are not scattered randomly. The relative gradient norms show a distinct architectural profile: they are heavily concentrated in the early and middle layers of the transformer blocks.
  • Attention Over MLPs: The gradient spikes are significantly more pronounced in the self-attention layers than in the Multi-Layer Perceptron (MLP) blocks, suggesting that attention mechanisms play a dominant role in routing and binding new entity relationships during continual training.
Relative gradient norms for salient spans show distinct spikes in early and middle attention layers across different model sizes.

Key Results

The authors tested TGL across multiple model sizes, including GPT-2 Base (110M), GPT-2 Large (770M), and GPT-Neo (1.3B).

  • Breaking the Trade-off: Standard continual pretraining baselines usually improve at learning new entities (ECBD-NP) at the direct expense of forgetting old ones (ECBD-Popular). Applying TGL consistently mitigated this trade-off.
  • Perplexity Reductions: On GPT-2 Base evaluated on 2020 data, adding TGL+FP to vanilla continual pretraining dropped the TempLAMA (relation updates) perplexity from 83.39 to 74.55 and the ECBD-NP (new entities) perplexity from 72.42 to 65.08.
  • Complementary to Baselines: TGL consistently boosted the performance of other popular parameter-efficient and regularization methods. For instance, combining RecAdam with TGL+FP yielded some of the lowest perplexity scores across the board for relation updates.

Limitations and Future Work

While TGL shows strong performance, the authors note a few key limitations:

  • Evaluation Metrics: The study relies heavily on perplexity within cloze (fill-in-the-blank) probing tasks. It remains an open question how cleanly these localized gradient improvements translate to downstream tasks like open-ended generation or complex multi-hop question answering.
  • The Efficiency Paradox: Although TGL aims to make continual pretraining computationally cheaper and more environmentally friendly, the authors warn of Jevons Paradox—lowering the cost of model updates might simply incentivize organizations to train massive models even more frequently, potentially offsetting the intended carbon savings.

Summary updated

BibTeX
@inproceedings{fernandez2024gradient,
  author = {Jared Fernandez and Yonatan Bisk and Emma Strubell},
  title = {{Gradient Localization Improves Lifelong Pretraining of Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.949},
}
Figure