Masked Language Models (MLMs) like BERT have been the workhorses of natural language processing for years. Their "mask-then-predict" training strategy—hiding words and asking the model to guess them—has proven incredibly effective for learning language representations. But researchers from Peking University and the University of Washington are now asking: is the [MASK] token itself holding these models back?
In their new paper, ExLM: Rethinking the Impact of [MASK] Tokens in Masked Language Models, the authors argue that the way we currently use masking creates a "corrupted semantics" problem that limits how much models can learn.
TL;DR
ExLM identifies that semantic corruption (loss of context), rather than the presence of "unreal" [MASK] tokens, is the primary bottleneck for Masked Language Models. By expanding each [MASK] into multiple hidden states and explicitly modeling their dependencies, ExLM significantly improves performance across text and molecular modeling tasks.
What Problem Does This Paper Address?
When you mask a word in a sentence, you don't just add a placeholder; you remove information. This creates two potential issues:
- Unreal Tokens: The
[MASK]symbol never appears in real-world text, creating a mismatch between training and actual use. - Corrupted Semantics: Removing words makes the remaining context ambiguous. A single
[MASK]could plausibly be many different words (multimodality), and the "right" choice for one mask often depends on the choice made for another.
While previous research focused heavily on the "unreal token" problem, this paper sets out to prove that corrupted semantics is the real villain. To do this, they designed a clever "Repeated MLM" experiment. By repeating tokens before masking them, they could keep the number of [MASK] tokens high (maintaining the "unreal" problem) while ensuring the original meaning was still present in the unmasked copies (fixing the "corrupted semantics" problem).
Their findings were clear: performance drops significantly when semantics are corrupted, but barely budges when you just add more [MASK] tokens.
Methods: Introducing ExLM
To solve the corrupted semantics problem, the authors proposed ExLM (Enhanced-context MLM). The core idea is to give the model more "room to think" about what a masked token might be.
1. States Expansion
Instead of one hidden state for each [MASK], ExLM creates $k$ expanded states (e.g., $k=4$). This allows the model to simultaneously represent different semantic possibilities for the same missing word. To keep these "clones" distinct, the authors use 2D Rotary Position Embeddings (RoPE), which encode both the word's position in the sentence and its "clone index."
2. Dependency Capture
In a vanilla MLM, predictions for different masks are often treated as independent. ExLM changes this by using a transition matrix (modeled as a Directed Acyclic Graph) to capture how the choice for one masked state influences another.
3. States Alignment
Because there are now more hidden states than target words, the model needs a way to decide which state is responsible for which prediction. ExLM uses a dynamic programming algorithm (similar to those used in speech recognition) to efficiently find the best alignment during training.
Datasets
The researchers evaluated ExLM on two very different domains:
- Natural Language: Pre-trained on English Wikipedia and BookCorpus, then evaluated on the GLUE benchmark and SQuAD 2.0.
- Molecular Modeling: Pre-trained on 19 million SMILES strings (text representations of molecules) and evaluated on the MoleculeNet benchmark.
Key Insights and Ideas
- Ambiguity is the Bottleneck: The paper demonstrates that the "multimodality" of language—where one context can mean many things—is what makes MLM training hard.
- Context Capacity Matters: By expanding the number of hidden states, ExLM effectively increases the "bandwidth" of the context, allowing it to store richer, more nuanced information.
- Inter-token Dependencies: The transition matrix is a crucial "aha" moment. It allows the model to learn that if the first mask is "terrible," the second is likely "sorry," whereas if the first is "amazing," the second is likely "glad."
Key Results
ExLM showed consistent improvements over strong baselines like BERT and RoBERTa:
- GLUE & SQuAD: ExLM achieved a mean score of 86.2 on GLUE, outperforming RoBERTa (85.2) and BERT (83.1) with the same model size and data.
- MoleculeNet: In the chemical domain, ExLM achieved a mean ROC-AUC of 76.1, significantly outperforming specialized models like SMILES-BERT (73.2) and GROVER (71.5).
- Lower Uncertainty: Entropy analysis showed that ExLM makes more confident predictions than vanilla MLMs, especially when the mask ratio is high, proving it handles ambiguity more effectively.
Limitations and Future Work
The primary trade-off for ExLM's performance is computational cost. Expanding the sequence length by $k$ and running the dynamic programming alignment makes training about 1.9 times slower than a vanilla MLM.
The authors suggest that future work could involve scaling ExLM to even larger models or applying the "enhanced context" idea to other modalities like images and video, where masking is also a popular pre-training technique.
Summary updated