Exploring Mode Connectivity for Pre-trained Language Models

Yujia Qin, Cheng Qian, Jing Yi, Weize Chen, Yankai Lin, Xu Han, Zhiyuan Liu, Maosong Sun, Jie Zhou

Abstract

This paper investigates the geometric properties of the loss landscape in pre-trained language models (PLMs) through the lens of mode connectivity. By examining the ability to find low-loss paths between different model minima, the authors demonstrate that pre-training serves as a crucial mechanism for aligning the optimal parameter regions of diverse tasks. The study explores both Linear Mode Connectivity (LMC) and non-linear paths, revealing that while standard fine-tuning maintains strong linear connectivity, parameter-efficient methods like Adapters can introduce significant performance barriers depending on initialization. These findings provide insights into model ensembling, transfer learning, and the fundamental nature of how PLMs acquire and retain knowledge.

Introduction

In deep learning, the high-dimensional parameter space often contains multiple "minima"—sets of weights that achieve high performance on a given task. A key question is whether these minima are isolated or connected by paths of low loss, a property known as mode connectivity. Understanding this relationship is vital for advancing techniques in model ensembling, where weight averaging is used to improve performance, and in transfer learning, where models are adapted across tasks.

This research focuses on how pre-training influences the geometric relationship between these minima. The authors hypothesize that pre-training acts as a "magnet," pulling the high-performance regions of different tasks closer together, thereby facilitating easier adaptation and ensembling.

Methodology

The primary tool used in this study is Linear Mode Connectivity (LMC). For two models $\theta_1$ and $\theta_2$, LMC evaluates the performance of interpolated models along a straight line: $\phi(\alpha) = (1 - \alpha)\theta_1 + \alpha\theta_2$. A significant drop in performance at intermediate values of $\alpha$ indicates a "loss barrier" and a lack of linear connectivity.

In cases where linear paths fail, the authors explore Non-linear Mode Connectivity by searching for quadratic Bezier curves that maintain low loss between the two points. Additionally, Dataset Cartography is employed to analyze the types of knowledge (e.g., easy vs. hard samples) lost or gained during movement through the parameter space.

The study utilizes several NLP benchmarks, including MNLI, ANLI, ReCoRD, and various sentiment analysis and paraphrase detection datasets.

Key Insights

Pre-training as a Geometric Connector

Pre-training is identified as the fundamental connector. Without it, models often remain isolated in the parameter space. As pre-training progresses, the high-performance regions for different tasks are pulled closer together. Remarkably, the authors find that even a small fraction (e.g., 5%) of the standard pre-training budget is sufficient to establish strong linear mode connectivity for downstream tasks.

Fine-tuning vs. Parameter-Efficient Tuning

A significant distinction is observed between standard fine-tuning and "delta tuning" methods like Adapters. Standard fine-tuning, which updates all parameters, generally maintains excellent linear mode connectivity. In contrast, Adapters—which add new, randomly initialized layers—can break linear connectivity if different random seeds are used for those new layers.

Knowledge Dynamics

The transition between models follows a predictable "easy-to-hard" gradient. When moving from a source task model to a target task model, the PLM tends to forget the most difficult or ambiguous knowledge from the source task first, while acquiring the easiest and most confident knowledge from the target task earliest in the process.

Key Results

The study finds that models trained on the same data but in a different order are almost perfectly linearly connected, showing virtually no performance drop when weights are averaged. This is particularly evident in standard fine-tuning scenarios, where connectivity is established very early in the pre-training process.

Linear mode connectivity in MNLI fine-tuning across different pre-training steps.

In contrast, Adapters often exhibit a significant performance "valley" during linear interpolation when initialized differently. This suggests that while they inhabit the same broad basin, they are separated by a high-loss ridge in the linear parameter space.

The "Adapter Valley": Linear interpolation between differently initialized adapters on MNLI.

Conclusion

The discovery of mode connectivity in PLMs provides a theoretical foundation for weight-averaging techniques and ensembling. The results suggest that pre-training is the key factor in creating a connected "continent" of high performance across tasks. Future research can leverage these geometric insights to design more sophisticated ensembling and continual learning strategies.

Summary updated

BibTeX
@inproceedings{qin2022exploring,
  author = {Yujia Qin and Cheng Qian and Jing Yi and Weize Chen and Yankai Lin and Xu Han and Zhiyuan Liu and Maosong Sun and Jie Zhou},
  title = {{Exploring Mode Connectivity for Pre-trained Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-main.451},
}
Figure