Train No Evil: Selective Masking for Task-Guided Pre-Training

Yuxian Gu, Zhengyan Zhang, Xiaozhi Wang, Zhiyuan Liu, Maosong Sun

Abstract

Modern NLP relies on a "pre-train-then-fine-tune" paradigm, which often struggles with task-agnosticism and data scarcity. This paper introduces a three-stage training framework that incorporates a "task-guided" pre-training phase. By employing a novel selective masking strategy, the model focuses on tokens most relevant to specific downstream tasks. Experimental results on sentiment analysis show that this approach achieves superior performance while reducing computational costs by over 50%.

Introduction

The standard operating procedure in NLP involves pre-training a model like BERT on massive, diverse datasets to learn general language patterns, followed by fine-tuning on smaller, task-specific datasets. However, this approach has significant drawbacks. First, general pre-training is "aimless," treating all words with equal importance regardless of the target task. Second, fine-tuning often lacks sufficient labeled data to capture domain-specific nuances. While domain-specific pre-training from scratch is an alternative, it is computationally prohibitive and requires vast amounts of data.

The Three-Stage Framework

To address these issues, we propose a three-stage framework: General Pre-training $\rightarrow$ Task-guided Pre-training (TaskPT) $\rightarrow$ Fine-tuning.

The three-stage training framework featuring Task-guided Pre-training with Selective Masking.

The core innovation is the Selective Masking strategy used during the TaskPT stage. Unlike random masking, which treats all tokens equally, selective masking focuses on "load-bearing" words for a specific task. The process involves:

  1. Importance Identification: Using a small labeled dataset, the model identifies tokens whose removal significantly drops classification confidence.
  2. Neural Selection: A small binary classifier (a "neural selector") is trained to learn the characteristics of these important tokens.
  3. Targeted Training: This selector is applied to a mid-sized, unlabeled in-domain dataset. During TaskPT, the model is trained to predict only these identified important tokens, allowing it to learn task-specific patterns much faster.

Experimental Results

The framework was evaluated on sentiment analysis benchmarks, including MR and SemEval14, using Yelp and Amazon reviews as in-domain unsupervised data.

Performance comparison across various tasks and datasets, showing faster convergence and higher accuracy for Selective Masking compared to random masking.

Efficiency and Convergence

The TaskPT method demonstrates remarkable efficiency. It reaches the performance levels of a fully pre-trained BERT model (1M steps) using less than 50% of the total computation cost. For instance, on the Sem14-Rest task with Yelp data, the model outperformed the fully pre-trained BERT base by 1.4% while using only half the training steps.

Consistency of Selective Masking

As shown in the results, selective masking consistently outperforms random masking across all tested combinations of tasks and datasets. This confirms that focusing the model's attention on task-relevant tokens is more effective than broad, random masking. The method is particularly potent when the in-domain unsupervised data closely aligns with the downstream task.

Conclusion and Future Work

Selective masking bridges the gap between general language understanding and task-specific expertise. By utilizing unlabeled domain data more effectively, it offers a path toward high-performance models with significantly lower computational overhead. Future research will explore the application of this framework to more complex tasks like text generation and its effectiveness in scenarios with extreme data scarcity.

Summary updated

BibTeX
@inproceedings{gu2020train,
  author = {Yuxian Gu and Zhengyan Zhang and Xiaozhi Wang and Zhiyuan Liu and Maosong Sun},
  title = {{Train No Evil: Selective Masking for Task-Guided Pre-Training}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.emnlp-main.566},
}
Figure