Pre-training Text Representations as Meta Learning

Shangwen Lv, Yuechen Wang, Daya Guo, Duyu Tang, Nan Duan, Fuqing Zhu, Ming Gong, Linjun Shou, Ryan Ma, Daxin Jiang, Guihong Cao, Songlin HuarXiv 2020

Introduction

The dominant paradigm in Natural Language Processing (NLP) involves a "pre-train then fine-tune" approach. Models like BERT are typically pre-trained on large-scale corpora using proxy objectives such as Masked Language Modeling (MLM) or Next Sentence Prediction (NSP). While effective, this approach creates a fundamental mismatch: the model is optimized to predict missing words or sentence order, whereas the ultimate goal is to acquire representations that facilitate learning downstream tasks like sentiment analysis or natural language inference.

This paper proposes a conceptual shift, framing pre-training as a meta-learning problem. Instead of minimizing a proxy objective, the authors suggest directly optimizing the model's ability to adapt to new tasks using the Model-Agnostic Meta-Learning (MAML) framework.

Methodology: Pre-training as Meta-Learning

The authors utilize the MAML framework to find a parameter initialization $\theta$ that can be quickly adapted to various tasks. The process involves two nested loops:

  1. Meta-Train Step: The model performs $k$ steps of gradient descent on a task-specific batch, resulting in temporary parameters $\theta'$.
  2. Meta-Test Step: The model evaluates the performance of $\theta'$ on a separate test batch from the same task. The original parameters $\theta$ are then updated based on this meta-objective.
Comparison between learning from proxy tasks (a) and meta-learning (b).

As illustrated in Figure 1, standard multi-task pre-training (like BERT) can be viewed as a special case of this algorithm where the number of inner-loop steps $k=0$. By increasing $k$, the model explicitly "practices" the act of fine-tuning during the pre-training phase. To manage the computational cost of second-order derivatives, the authors employ a first-order approximation.

Experimental Results

The approach was evaluated by meta-learning a BERT-base model and testing it on a suite of downstream benchmarks, including sentiment analysis (SST-2, SST-5), inference (MNLI, SNLI), and search query tasks (QDC, QPP).

Performance and Convergence

The meta-learned models consistently outperformed standard BERT-base. For instance, on SST-5, the proposed method achieved 55.97% accuracy compared to 54.84% for BERT. Beyond final accuracy, a key advantage is the speed of adaptation. Meta-learned initializations start at significantly higher accuracies in the first epoch of fine-tuning.

Accuracy vs. Epoch for various values of $k$ across different tasks.

The Impact of the Inner Loop ($k$)

Figure 2 demonstrates the effect of the number of meta-train steps ($k$) on downstream performance. The authors identified a "sweet spot" (typically $k=5$ or $k=10$) where performance is maximized. While increasing $k$ generally improves the starting point and final accuracy, excessively high values (e.g., $k=20$) can lead to gradient instability, potentially harming the learning process.

Conclusion

By treating pre-training as meta-learning, this work provides a theoretical bridge between multi-task learning and model adaptation. The results suggest that directly optimizing for "learnability" leads to more robust initializations that adapt faster and more effectively to downstream NLP tasks than traditional proxy-based pre-training. Future work remains to explore the scalability of this approach to larger model architectures.

Summary updated

BibTeX
@misc{lv2020pre,
  author = {Shangwen Lv and Yuechen Wang and Daya Guo and Duyu Tang and Nan Duan and Fuqing Zhu and Ming Gong and Linjun Shou and Ryan Ma and Daxin Jiang and Guihong Cao and Ming Zhou and Songlin Hu},
  title = {{Pre-training Text Representations as Meta Learning}},
  year = {2020},
  eprint = {2004.05568},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2004.05568},
}
Figure