Abstract
Large pre-trained models exhibit impressive zero-shot performance across diverse tasks, but fine-tuning often leads to catastrophic forgetting, where improvements on a target domain degrade generalization on other tasks. To address this challenge, we introduce LiNeS, Layer-increasing Network Scaling, a post-training editing technique designed to preserve pre-trained generalization while enhancing fine-tuned task performance. LiNeS scales parameter updates linearly based on their layer depth within the network, maintaining shallow layers close to their pre-trained values to preserve general features while allowing deeper layers to retain task-specific representations. We further extend this approach to multi-task model merging scenarios, where layer-wise scaling of merged parameters reduces negative task interference. LiNeS demonstrates significant improvements in both single-task and multi-task settings across various benchmarks in vision and natural language processing. It mitigates forgetting, enhances out-of-distribution generalization, integrates seamlessly with existing multi-task model merging baselines improving their performance across benchmarks and model sizes, and can boost generalization when merging LLM policies aligned with different rewards via RLHF. Importantly, our method is simple to implement and complementary to many existing techniques.
Introduction
Fine-tuning foundation models has become the standard approach for creating specialized experts. However, this process frequently results in catastrophic forgetting, where the model's specialized gains come at the expense of the broad, general-purpose knowledge acquired during pre-training. This issue is compounded in model merging, where combining multiple specialized models often leads to task interference, resulting in a "jack of all trades, master of none" scenario.
In this work, we present LiNeS (Layer-increasing Network Scaling), a post-training technique that mitigates forgetting and improves model merging by strategically scaling parameter updates based on layer depth.
Methodology: Layer-increasing Network Scaling
The fundamental premise of LiNeS is that shallow layers in a neural network capture general, robust features, while deeper layers specialize in task-specific representations. Standard fine-tuning updates all layers, often introducing "noise" into the general features of shallow layers.
LiNeS operates on the task vector $\tau$, defined as the difference between fine-tuned weights $\theta_{ft}$ and pre-trained weights $\theta_{pre}$: $\tau = \theta_{ft} - \theta_{pre}$. Instead of applying the full update uniformly, LiNeS scales the update for each layer $\ell$ using a factor $\lambda^{(\ell)}$ that increases linearly with depth:
$$\lambda^{(\ell)} = \alpha + \beta \frac{\ell-1}{L-1}$$
where $L$ is the total number of layers, $\alpha$ is the base scaling for the first layer, and $\beta$ determines the rate of increase. By setting a small $\alpha$, shallow layers remain close to their pre-trained state, preserving general knowledge.
This post-training approach is computationally efficient and requires no changes to the training pipeline. It can be applied to a single fine-tuned checkpoint or integrated into model merging algorithms like Task Arithmetic or Ties-Merging.
Experimental Evaluation
We evaluated LiNeS across a diverse set of benchmarks:
- Computer Vision: 8, 14, and 20-task benchmarks using CLIP (ViT-B/L) and ConvNeXt on datasets like MNIST, CIFAR, and ImageNet variants.
- NLP: 7-task general NLP, 8-task Question Answering, and 11-task combined benchmarks using T5-large.
- RLHF: Merging LLaMA-2 7B policies for helpfulness and faithfulness on Reddit summarization.
- OOD Robustness: Evaluation on ImageNet-A, -R, -Sketch, -V2, and ObjectNet.
Key Results and Insights
LiNeS consistently demonstrates a superior trade-off between target task performance and the preservation of pre-trained capabilities.
Single-Task Preservation and Forgetting
On CLIP ViT-B/32, LiNeS maintained 99.8% of the fine-tuned task performance while restoring 97.9% of the pre-trained model's performance on control tasks. This confirms that updates in shallow layers are largely redundant for the target task but critical for maintaining generalizability.
Enhancing Model Merging
In multi-task scenarios, LiNeS significantly reduces task interference. In a 20-task vision benchmark, LiNeS provided an absolute improvement of 3.1% for Task Arithmetic and 4.0% for Ties-merging. Similar gains were observed in NLP, where T5-large performance improved by 4.5 points.
Out-of-Distribution Generalization
LiNeS consistently produces a better Pareto frontier in OOD scenarios compared to standard interpolation methods like WiSE-FT. By preserving the robust features of the pre-trained model in early layers, LiNeS enhances the model's ability to generalize to shifted distributions.
Conclusion
LiNeS is a simple yet powerful post-training tool for managing the trade-off between specialization and generalization. By recognizing the hierarchical nature of feature representation, it effectively mitigates catastrophic forgetting and task interference. Its ease of implementation and compatibility with existing merging techniques make it a practical solution for deploying and combining large-scale foundation models. Future work may explore non-linear scaling schedules and applications to non-transformer architectures.
Summary updated