Tokenization is Sensitive to Language Variation

Anna Wegmann, Dong Nguyen, David Jurgens · DOI

Abstract

Tokenization is a foundational step in Large Language Model (LLM) pipelines, yet its impact on linguistic variation is often overlooked. This research investigates how tokenization choices—specifically pre-tokenizers, vocabulary size, and fitting corpora—affect performance across variation-robust tasks (e.g., semantic understanding) and variation-sensitive tasks (e.g., dialect classification). Through the training of 24 BERT models, the authors demonstrate that standard compression metrics are poor predictors of downstream performance and propose a more effective proxy based on logistic regression. The findings suggest that the optimal tokenizer configuration depends heavily on whether a task requires ignoring or detecting surface-level linguistic variation.

Introduction

In the development of Large Language Models, tokenization—the process of segmenting raw text into subword units—is frequently treated as a static preprocessing step. Standard algorithms like Byte-Pair Encoding (BPE) are typically deployed with default settings, under the assumption that the model will learn to navigate any resulting fragmentation during training. However, language is inherently diverse, encompassing regional dialects, social registers, and idiosyncratic variations like typos.

A recent study by Wegmann, Nguyen, and Jurgens challenges the "one size fits all" approach to tokenization. They argue that tokenization design is a critical lever that determines how a model perceives linguistic variation. Depending on the objective, a model may need to be robust to variation (extracting meaning despite surface differences) or sensitive to it (identifying specific stylistic or dialectal markers).

The Robustness-Sensitivity Dichotomy

The researchers identify a fundamental tension in how models handle language variation:

  1. Variation-Robust Tasks: These are primarily semantic tasks, such as Natural Language Inference (NLI) or Sentiment Analysis. In these contexts, the model should ideally treat variants like "learned" and "learnt" as semantically equivalent.
  2. Variation-Sensitive Tasks: These are form-based tasks, such as Authorship Verification, Dialect Classification, or Grammatical Error Detection. Here, the surface-level variation is the primary signal the model must capture.

Current tokenizers, trained to maximize frequency-based patterns, often split rare dialectal forms or typos into nonsensical fragments, potentially hindering performance on both types of tasks.

Methodology

To isolate the effects of tokenization, the authors pre-trained 24 distinct BERT-base models (110M parameters each) from scratch. They controlled for three primary variables:

  • Vocabulary Size: Ranging from 500 to 128,000 tokens.
  • Pre-tokenizer: The initial rules for splitting text (e.g., whitespace-based, GPT-2 style, Llama-3 style, or no pre-tokenization).
  • Fitting Corpus: The data used to train the tokenizer (Wikipedia, PubMed, Twitter, or a Miscellaneous mix).

Models were evaluated using a dual-track approach. Robustness was tested using GLUE benchmarks modified with synthetic typos (via TextFlint) and dialectal perturbations (via Multi-VALUE). Sensitivity was tested using a suite of stylistic tasks, including Authorship Verification (AV) and Register Classification (CORE).

Key Insights and Results

The Dominance of the Pre-tokenizer

One of the most significant findings was that the choice of pre-tokenizer had a larger impact on downstream performance than either vocabulary size or the training corpus. Pre-tokenizers that preserved whitespace (e.g., _ws) generally yielded the best results. The choice of pre-tokenizer alone could result in accuracy swings of over 10 points on specific tasks, proving it is far from a neutral preprocessing step.

The Compression Fallacy

A common heuristic in NLP is that a tokenizer that achieves higher compression (representing text with fewer tokens) is superior. This study explicitly refutes that assumption for robust tasks. The authors found that worse compression (more tokens) often correlated with better performance in variation-robust contexts. Smaller, more granular tokens (approaching the character level) allow the model to "see through" spelling variations and typos more effectively than large, rigid tokens.

Vocabulary Size Trade-offs

The optimal vocabulary size depends on the task type:

  • Robust tasks performed best with smaller vocabularies (~4,000 tokens), which offer the flexibility to handle non-standard input.
  • Sensitive tasks benefited from larger vocabularies (~32,000 to 64,000 tokens), which can represent unique stylistic markers as single, distinct units.

The Value of Diverse Training Data

Tokenizers fitted on Twitter data showed remarkable versatility. Because Twitter is naturally rich in slang, typos, and emojis, tokenizers trained on it are better equipped to handle the "noise" of real-world language variation compared to those trained on clean, formal sources like Wikipedia.

A New Metric for Tokenization

Standard intrinsic metrics, such as Rényi efficiency, showed little to no correlation with actual model performance. To address this, the authors proposed the Logistic Regression Measure (LRM). By using a simple bag-of-tokens classifier as a proxy, they achieved a Pearson correlation of ~0.85 with actual BERT performance. This provides a computationally inexpensive way to evaluate tokenizers without training full-scale models.

Conclusion

Tokenization is a decisive factor in how LLMs process the complexities of human language. The study concludes that practitioners should move away from task-agnostic compression metrics and instead align their tokenization strategy with the specific requirements of their task. Whether a model needs to be robust to a typo or sensitive to a dialect, the "best" tokenizer is the one designed with that specific variation in mind.

Summary updated

BibTeX
@inproceedings{wegmann2025tokenization,
  author = {Anna Wegmann and Dong Nguyen and David Jurgens},
  title = {{Tokenization is Sensitive to Language Variation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure