Behind the mask: Random and selective masking in transformer models applied to specialized social science texts

Transformer models such as BERT and RoBERTa are increasingly popular in the social sciences to generate data through supervised text classification. These models can be further trained through Masked Language Modeling (MLM) to increase performance in specialized applications. MLM uses a default masking rate of 15 percent, and few works have investigated how different masking rates may affect performance. Importantly, there are no systematic tests on whether selectively masking certain words improves classifier accuracy. In this article, we further train a set of models to classify fake news around the coronavirus pandemic using 15, 25, 40, 60 and 80 percent random and selective masking. We find that a masking rate of 40 percent, both random and selective, improves within-category performance but has little impact on overall performance. This finding has important implications for scholars looking to build BERT and RoBERTa classifiers, especially those where one specific category is more relevant to their research.

Authors

Institutions

Publication Details

Journal
PLoS ONE
Published
2025-02-21
DOI
https://doi.org/10.1371/journal.pone.0318421
Citations
3
Primary Topic
Computational and Text Analysis Methods
Type
article
Field-Weighted Citation Impact
16.03
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Behind the mask: Random and selective masking in transformer models applied to specialized social science texts

Joan C. Timoneda, Sebastián Vallejo Vera
3 citations
PLoS ONE
Computational and Text Analysis Methods
16.03
article

Behind the mask: Random and selective masking in transformer models applied to specialized social science texts

Joan C. Timoneda, Sebastián Vallejo Vera
article en
3 citations

Abstract

Transformer models such as BERT and RoBERTa are increasingly popular in the social sciences to generate data through supervised text classification. These models can be further trained through Masked Language Modeling (MLM) to increase performance in specialized applications. MLM uses a default masking rate of 15 percent, and few works have investigated how different masking rates may affect performance. Importantly, there are no systematic tests on whether selectively masking certain words improves classifier accuracy. In this article, we further train a set of models to classify fake news around the coronavirus pandemic using 15, 25, 40, 60 and 80 percent random and selective masking. We find that a masking rate of 40 percent, both random and selective, improves within-category performance but has little impact on overall performance. This finding has important implications for scholars looking to build BERT and RoBERTa classifiers, especially those where one specific category is more relevant to their research.

PLoS ONEVol. 20(2)
Western University (CA), Purdue University West Lafayette (US)
Good health and well-being
Openalex Percentile: Top 2%
Computational and Text Analysis Methods
16.03
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.