Whole Word Masking › Limitations and Impact

Michael BrenndoerferUpdated July 10, 20256 min read
Language AI HandbookAll chapters
Part 22 of 67Pre-training Objectives
Chapter 157Whole Word Masking › Limitations and Impact
Reading section 10 of 13 · Limitations and Impact · 6 minSection 10 of 13 · 6 min

Book contents

Section 10 of 13 · 6 min read

Whole Word Masking › Limitations and ImpactOne section · Sections in this chapter10 / 13 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Whole Word Masking is a well-motivated improvement over random subword masking, but it comes with trade-offs and boundary conditions that practitioners should understand before deciding whether and how to apply it.

Limitations

Language-dependent effectiveness: WWM assumes that word boundaries carry semantic significance. This assumption holds well for English and other European languages that use spaces to delimit words, but it becomes complicated for languages without clear word boundaries. Chinese and Japanese are the most prominent examples: Chinese text typically has no spaces between characters, so identifying word boundaries requires running a separate word segmentation system before tokenization. This adds a preprocessing dependency that can introduce segmentation errors, particularly for domain-specific vocabulary, technical terms, or proper nouns that the segmenter was not trained on. For Chinese BERT, the Google team used an external word segmenter to identify word boundaries, then applied WWM on the resulting word-segmented text. Errors in segmentation propagate directly into errors in word grouping, and the effectiveness of WWM depends on the quality of the underlying segmenter.

Inconsistent masking ratio: Because words have variable lengths in subword tokens, the actual percentage of tokens masked varies by sentence even with the greedy selection approach. A sentence composed primarily of long, morphologically complex words (common in technical writing, or in German which frequently uses compound nouns) might see 20% or more of its tokens masked when a few words are selected. A sentence of short common words might see only 10% masking. Over a full training run, these variations average out, but they can cause instability early in training when the model is still adapting to the masking distribution.

Computational overhead: Identifying word boundaries adds preprocessing cost. For every sequence in every training batch, the data collator must scan the token list, detect boundary markers, build the word groups, shuffle them, and apply the greedy selection algorithm. For production training at scale with billions of tokens, this overhead is negligible compared to the GPU compute for model forward and backward passes. But for research experiments with limited hardware, or for fast iteration during development, the additional collation cost can slow the overall training loop if the collator is not efficiently implemented.

Morphology complications in agglutinative languages: Some morphological systems do not interact cleanly with the "mask the whole word" approach. Finnish and Turkish, along with Hungarian, are agglutinative languages where a single word might consist of many morphemes stacked together, each carrying distinct semantic content. The Finnish word "talossanikin" means "also in my house" and could tokenize into many subword pieces. Masking the entire word removes substantial semantic content in a single masking event, potentially making the prediction task too difficult or providing too little residual context for the model to learn from. For these languages, span masking or character-level approaches might be more appropriate than either standard MLM or WWM.

Does not fix all information leakage: WWM eliminates within-word information leakage, but other forms of context leakage remain. If a word appears multiple times in the same sentence, masking one occurrence while leaving the other visible still provides strong evidence about the masked token. Similarly, syntactic cues (a masked position in a role that only certain word types can fill) reduce the effective prediction difficulty even without visible subword siblings. WWM is a targeted fix for one specific source of leakage; it does not create a uniformly difficult prediction task across all sentence types.

Interaction with special tokens: Special tokens like [CLS], [SEP], [PAD], and entity markers (used in some BERT variants) must be excluded from WWM grouping. Implementations that naively group all tokens can accidentally include these special tokens in word groups, producing incorrect groupings for the first or last real word in a sequence. Production implementations need explicit handling to skip special tokens before building word groups.

Impact

Despite these limitations, WWM has proven to be a durable and valuable technique with clear empirical benefits and lasting influence on how the field approaches masked language model pre-training.

Improved downstream performance: Google released official BERT-wwm models alongside the Chinese BERT paper, and subsequent benchmarking showed consistent improvements on SQuAD and other reading comprehension benchmarks. For English, the improvements are modest but reliable: typically 0.5-1.0 F1 points on SQuAD, which sounds small but represents a meaningful reduction in error rate when considered relative to state-of-the-art performance. For Chinese, the improvements are much larger because character-level masking in standard BERT creates severe information leakage at the finest possible granularity. WWM, combined with proper word segmentation for Chinese, produces substantially better models on Chinese NLP tasks.

Better morphological understanding: WWM forces models to learn word-level rather than subword-level patterns. When the model must predict entire words from context, it cannot rely on within-word co-occurrence statistics. The resulting representations tend to capture more of the word's semantic role and less of its morphological structure. Words with shared roots form more semantically coherent clusters in the embedding space because the model has learned what those roots mean in context rather than just what tokens tend to follow them. This benefit compounds over training: as the model develops richer word-level representations, its attention mechanism learns to perform more sophisticated semantic matching between words at different positions.

Standard practice for non-English models: WWM has become the default for training BERT models in morphologically rich languages. German and Arabic BERT variants, together with Turkish, Korean, plus Chinese variants, almost universally use WWM because random subword masking loses too much training signal to information leakage in these languages. The community has effectively concluded that WWM should be the default masking strategy for any new BERT pre-training effort, regardless of language, with random subword masking only as a fallback when word boundary information is unavailable.

Foundation for span masking: WWM paved the way for more sophisticated masking strategies like span corruption in T5 and SpanBERT's span masking approach. The insight that masking units should respect linguistic boundaries generalizes beyond single words to phrases and sentences. T5's sentinel token approach, where entire spans of consecutive tokens are masked and replaced with a single sentinel, is essentially WWM generalized to arbitrary spans. SpanBERT demonstrated that masking contiguous spans of 2-10 tokens (often corresponding to phrases or named entities) produces better representations for span-based tasks like named entity recognition and relation extraction. These techniques built directly on the intuition first formalized in WWM: the unit of masking should match the unit of prediction, and both should be linguistically meaningful.

Continued relevance in the era of larger models: Even as language models have scaled dramatically in size (from BERT's 110M parameters to models with hundreds of billions of parameters), the masked language modeling objective and its variants remain important for encoder pre-training. Models like RoBERTa and DeBERTa, along with ALBERT, all use masking-based objectives, and WWM or span masking variants are standard components of their pre-training procedures. The core insight of WWM, that masking granularity should match semantic granularity, remains valid regardless of model size.