Should You Mask 15% in Masked Language Modeling?

Alexander Wettig, Tianyu Gao, Zexuan Zhong, Danqi Chen
2/16/2022
cs.CLcs.LG

Official code: princeton-nlp/DinkyTrain (117 stars, Python, MIT, last commit 2022-10-27).

Abstract

Masked language models (MLMs) conventionally mask 15% of tokens due to the belief that more masking would leave insufficient context to learn good representations; this masking rate has been widely used, regardless of model sizes or masking strategies. In this work, we revisit this important choice of MLM pre-training.

Show full abstract

We first establish that 15% is not universally optimal, and larger models should adopt a higher masking rate. Specifically, we find that masking 40% outperforms 15% for BERT-large size models on GLUE and SQuAD. Interestingly, an extremely high masking rate of 80% can still preserve 95% fine-tuning performance and most of the accuracy in linguistic probing, challenging the conventional wisdom about the role of the masking rate. We then examine the interplay between masking rates and masking strategies and find that uniform masking requires a higher masking rate compared to sophisticated masking strategies such as span or PMI masking. Finally, we argue that increasing the masking rate has two distinct effects: it leads to more corruption, which makes the prediction task more difficult; it also enables more predictions, which benefits optimization. Using this framework, we revisit BERT's 80-10-10 corruption strategy. Together, our results contribute to a better understanding of MLM pre-training.

View on arXivView PDF

Code Implementations(1)

MIT

Princeton NLP's pre-training library based on fairseq with DeepSpeed kernel integration 🚃

1179Python, CudaApr 25, 20224 years agoMIT

Similar Papers

Cite this paper

@article{wettig2022should,
  title  = {Should You Mask 15% in Masked Language Modeling?},
  author = {Alexander Wettig and Tianyu Gao and Zexuan Zhong and Danqi Chen},
  year   = {2022},
  eprint = {2202.08005},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2202.08005}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2202.08005.svg)](https://codeofpaper.com/paper/2202.08005)

Discussion