Tokenization Matters! Degrading Large Language Models through Challenging Their Tokenization

Dixuan Wang, Yanda Li, Junyuan Jiang, Zepeng Ding, Guochao Jiang, Jiaqing Liang, Deqing Yang · DOI

Abstract

Modern Large Language Models (LLMs) rely on subword-level tokenization as a foundational processing step. However, this algorithmic approach often diverges from human linguistic logic. This paper introduces the Adversarial Dataset for Tokenizer (ADT), a benchmark designed to exploit this "tokenization gap." By manipulating word boundaries and character sequences, we demonstrate that even frontier models like GPT-4o and Llama-3 can be induced into significant reasoning failures and hallucinations. Our results reveal that tokenization remains a critical, yet often overlooked, vulnerability in LLM architectures.

Introduction: The Tokenization Blind Spot

Before an LLM processes a sentence, it must segment the text into tokens using algorithms like Byte Pair Encoding (BPE). While efficient, these methods are purely statistical and lack semantic awareness. In English, missing spaces or specific prefixes can alter token boundaries; in Chinese, the lack of explicit word delimiters exacerbates the issue. This "tokenization gap" creates a fundamental vulnerability where a model "sees" a different set of concepts than intended by the human author.

Figure 1: Examples of how incorrect tokenization leads to reasoning failures in both Chinese and English contexts.

Methodology: Constructing Challenging Spans

To systematically test this vulnerability, we developed a framework to create "challenging spans"—sequences designed to trick tokenizers into incorrect segmentations. We employed three primary adversarial strategies:

  1. Before Insertion: Adding a character before a word to form a new valid token (e.g., "stable" becomes "movestable," causing the model to see "moves" + "table").
  2. After Insertion: Adding a character after a word to create a deceptive suffix (e.g., "driven" becomes "drivenothing," segmented as "drive" + "nothing").
  3. Before & After: Combining both to create a "trap" (e.g., "this" becomes "sixthisland," which a human reads as "sixth island" but a model may segment as "six" + "this" + "land").
Figure 2: The ADT construction framework, illustrating the insertion methods used to generate adversarial examples.

The ADT Dataset

The Adversarial Dataset for Tokenizer (ADT) consists of two components:

  • ADT-Human: A high-quality, manually crafted set containing 11 Chinese and 7 English instances per targeted LLM, ensuring linguistic coherence while maximizing tokenization difficulty.
  • ADT-Auto: An automated pipeline that identifies "trap words" (overlapping tokens) within a model's exported vocabulary and uses GPT-4 to generate contextually relevant sentences and questions.

Key Results and Insights

Our evaluation across diverse models, including ChatGLM3, Baichuan2, Yi, Qwen, Llama-3, and Mixtral, yielded several critical findings:

  • High Error Rates: On the ADT-Human (Chinese) set, most open-source models exhibited error rates between 80% and 90%. Even state-of-the-art closed models like GPT-4o suffered a 61.36% error rate.
  • Cross-Lingual Vulnerability: While English is often considered more robust due to spaces, ADT-Human (English) still induced error rates of 92.86% for Llama-3-8B and 64.29% for GPT-4o.
  • Direct Correlation: Fine-grained analysis confirms that in the vast majority of failure cases, the incorrect response was directly preceded by a mis-tokenization of the input span.
  • Scale vs. Robustness: Larger models (e.g., Qwen-72B) show improved reasoning that can occasionally overcome bad tokenization, but they remain significantly more vulnerable on ADT compared to standard benchmarks.

Conclusion and Future Work

The ADT benchmark highlights that LLMs are "slaves to their vocabulary." When a concatenation of words contains a high-priority sub-token, the tokenizer's greedy nature can effectively hide the original meaning from the model's reasoning layers.

While this study focuses on Chinese and English, future research should extend to morphologically rich languages. Furthermore, the high success rate of these simple adversarial "traps" suggests a need for more linguistically-aware tokenization or a move toward "token-free" model architectures to achieve true robustness.

Summary updated

BibTeX
@misc{wang2024tokenization,
  author = {Dixuan Wang and Yanda Li and Junyuan Jiang and Zepeng Ding and Guochao Jiang and Jiaqing Liang and Deqing Yang},
  title = {{Tokenization Matters! Degrading Large Language Models through Challenging Their Tokenization}},
  year = {2024},
  eprint = {2405.17067},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.17067},
}
Figure