LiNeS: Post-training Layer Scaling Prevents Forgetting and Enhances Model Merging

Ke Wang, Nikolaos Dimitriadis, Alessandro Favero, Guillermo Ortiz-Jimenez, François Fleuret, Pascal Frossard

LiNeS (Layer-increasing Network Scaling) is a simple yet powerful post-training technique that fixes "catastrophic forgetting" by linearly scaling model updates based on layer depth. By keeping shallow layers close to their pre-trained state while allowing deeper layers to specialize, LiNeS preserves general knowledge and significantly boosts the performance of merged models across vision and NLP tasks without any additional training.

The Challenge: Forgetting and Interference

In the modern AI era, we rarely train models from scratch. Instead, we take a "foundation model" (like CLIP or LLaMA) and fine-tune it for a specific task. However, this process has two major side effects:

  1. Catastrophic Forgetting: As the model learns a new task, it often "overwrites" the general-purpose features it learned during pre-training, destroying its ability to perform other tasks (zero-shot generalization).
  2. Task Interference in Model Merging: When we try to merge multiple fine-tuned models (e.g., a model that's good at sentiment analysis with one that's good at summarization), the updates from different tasks often clash. This "interference" leads to a merged model that is worse than the sum of its parts.

Existing solutions often involve complex regularization during training, which is computationally expensive. LiNeS offers a post-training solution—one that can be applied to existing checkpoints to recover lost performance effortlessly.

The LiNeS Approach

The core intuition behind LiNeS is that not all layers are created equal. In deep neural networks, shallow layers (near the input) typically capture general, transferable features (like edges in images or basic syntax in text), while deeper layers (near the output) capture task-specific logic.

LiNeS operates on the task vector ($\tau$), which is the difference between the fine-tuned weights and the original pre-trained weights ($\tau = \theta_{fine-tuned} - \theta_{pre-trained}$).

Instead of treating the whole network the same, LiNeS applies a scaling factor $\lambda$ that increases linearly with layer depth: $$\lambda^{(\ell)} = \alpha + \beta \frac{\ell-1}{L-1}$$

  • Shallow layers get a small scaling factor, keeping them close to the pre-trained "generalist" weights.
  • Deep layers get a larger scaling factor, allowing them to keep the "specialist" knowledge from fine-tuning.
Effect of downscaling shallow vs. deep layers on target and control tasks.

This is a "plug-and-play" method. It requires no new training, no gradients, and negligible compute time. It can be applied to a single fine-tuned model or integrated into multi-task merging algorithms like Task Arithmetic, Ties-Merging, or Consensus Merging.

Key Insights

  • Shallow updates are often destructive: Updates to shallow layers contribute very little to the accuracy of the target task but are the primary cause of forgetting general features.
  • The "Residual" is the Key: By scaling the difference between models rather than the weights themselves, LiNeS effectively "edits" the model's knowledge.
  • Universality: The layer-depth-scaling principle holds true across wildly different architectures (Transformers vs. CNNs) and modalities (Vision vs. Language).
  • Synergy with Merging: In multi-task merging, LiNeS reduces interference because it prevents different tasks from competing to redefine the "foundation" (shallow layers) of the model.

Key Results

The authors validated LiNeS across an impressive range of benchmarks, including computer vision (CLIP ViT, ConvNeXt), out-of-distribution (OOD) datasets, NLP tasks (T5-large), and RLHF policy merging (LLaMA-2 7B).

  • Mitigating Forgetting: In image classification, LiNeS maintained 99.8% of the fine-tuned task performance while restoring 97.9% of the pre-trained model's performance on other control tasks.
LiNeS mitigates catastrophic forgetting, maintaining high accuracy on both target and control tasks.
  • Superior Merging: On a challenging 20-task vision benchmark, LiNeS improved the Task Arithmetic baseline by 3.1% and Ties-merging by 4.0%.
  • NLP Boost: For T5-large models, LiNeS improved multi-task performance by up to 4.5 points over standard merging techniques.
  • Pareto Dominance: In OOD generalization and RLHF policy merging, LiNeS produced a "Pareto Front" that consistently outperformed existing methods (like WiSE-FT and Rewarded Soups), providing a strictly better trade-off between specialized and general performance.

Limitations and Future Work

  • Heuristic Dependency: While the authors provide a heuristic for choosing the scaling parameters ($\alpha$ and $\beta$), these might still require some tuning or a small validation set for optimal results in niche applications.
  • Linear Assumption: The paper focuses on linear scaling. While they briefly tested quadratic and square-root scaling (finding linear to be generally sufficient), more complex architectures might benefit from non-linear scaling schedules.
  • Layer Definitions: The method relies on a clear definition of "layer depth." In non-sequential or highly branched architectures, defining the linear progression of depth might be less straightforward.

Overall, LiNeS is a remarkably elegant solution to a fundamental problem in model adaptation, proving that sometimes the best way to move forward is to look back at the foundation.

Summary updated

BibTeX
@inproceedings{wang2025lines,
  author = {Ke Wang and Nikolaos Dimitriadis and Alessandro Favero and Guillermo Ortiz-Jimenez and François Fleuret and Pascal Frossard},
  title = {{LiNeS: Post-training Layer Scaling Prevents Forgetting and Enhances Model Merging}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=J5sUOvlLbQ},
}
Figure