Learning Better Masking for Better Language Model Pre-training

Dongjie Yang, Zhuosheng Zhang, Hai Zhao · DOI

Introduction

Standard language model pre-training, exemplified by BERT, typically employs a static masking strategy. In this "one-size-fits-all" approach, the difficulty level and the types of tokens masked remain constant throughout the entire training process—usually fixed at a 15% random masking ratio. This paper argues that such a time-invariant approach is suboptimal.

Drawing an analogy to human language acquisition, learners do not begin by deciphering complex technical jargon in noisy environments; they start with simple structures and gradually progress to more challenging material. Similarly, as a model matures during pre-training, its "exercises" should adapt. The authors propose two dynamic strategies: Masking Ratio Decay (MRD) and POS-Tagging Weighted (PTW) Masking, which adapt training difficulty and content over time to improve efficiency and performance.

Proposed Methodology

The researchers introduce two novel time-variant masking schedules designed to optimize the learning trajectory of the model.

Masking Ratio Decay (MRD)

Instead of a fixed 15% ratio, MRD starts with a high masking ratio (approximately 30%) and gradually decreases it as training progresses. This approach forces the model to learn global semantics early on when context is sparse, transitioning to fine-grained local linguistic patterns as the ratio drops.

Figure 1: Comparison of fixed masking ratio versus linear and cosine decay schedules.

The authors experimented with both linear and cosine decay schedules, finding that a high initial "temperature" (masking ratio) allows the model to explore a larger solution space, similar to simulated annealing in optimization.

POS-Tagging Weighted (PTW) Masking

Not all word types are equally difficult to master. "Function words" (e.g., the, of, a) are learned quickly, while "content words" (nouns, verbs, adjectives) carry more semantic weight and require more training. PTW uses Part-of-Speech (POS) tagging to track the model's loss for different categories and adaptively increases the probability of masking "difficult" words that the model has not yet mastered.

Figure 6: Overview of the proposed pre-training architecture integrating POS-Tagging Weighted masking and Masking Ratio Decay.

Experimental Setup

The proposed methods were evaluated using BERT-base and BERT-large architectures:

  • Pre-training: Models were trained on the standard English Wikipedia corpus.
  • Evaluation: Performance was measured across the GLUE benchmark (9 NLU tasks), SQuAD v1.1 (reading comprehension), and CoNLL-2003 (Named Entity Recognition).

Key Insights

  • Global vs. Local Trade-off: High initial masking ratios encourage the learning of global semantic representations. As the ratio decays, the model focuses on local context, capturing the "best of both worlds."
  • Efficiency Gains: By using a cosine decay schedule, the model reached the baseline performance of a standard 1-million-step BERT model in just 650,000 steps—a 35% reduction in training time.
  • Prioritizing Semantic Content: Analysis of different word categories showed that function words reach near-zero loss very early. PTW prevents the model from wasting "training bandwidth" on these simple grammatical markers, focusing instead on semantically rich tokens.

Results and Discussion

The dynamic masking strategies yielded significant improvements across all benchmarks:

  • SQuAD v1.1: BERT-base with Cosine MRD achieved an F1 score of 90.9, surpassing the 90.2 baseline.
  • GLUE Benchmark: MRD training for 1M steps resulted in an average increase of over 1.0 point across subtasks.
  • Information Extraction: PTW Masking significantly boosted performance on tasks requiring deep semantic understanding, such as CoNLL-2003 NER, where the F1 score improved from 94.9 to 95.4.

Limitations and Future Work

While effective, the authors note that these schedules were primarily tested on BERT. Future research is needed to determine if these strategies translate to other architectures like T5 or Electra. Additionally, while PTW improves training efficiency, it introduces a small pre-processing overhead due to the requirement for POS tagging. Future work may explore more complex decay schedules or the application of these techniques to massive Large Language Models (LLMs).

Summary updated

BibTeX
@inproceedings{yang2023learning,
  author = {Dongjie Yang and Zhuosheng Zhang and Hai Zhao},
  title = {{Learning Better Masking for Better Language Model Pre-training}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-long.400},
}
Figure