Broken Words, Broken Performance: Effect of Tokenization on Performance of LLMs

TL;DR

Proposes multiple tokenization penalty functions to quantify the impact of word splitting on LLM performance; experiments show significant correlation.

cs.CL 🔴 Advanced 2025-12-26 49 views
Sachin Pawar Manoj Apte Kshitij Jadhav Girish Keshav Palshikar Nitin Ramrakhiyani
NLP Tokenization Model Performance Statistical Analysis Subword Segmentation

Key Findings

Methodology

Four penalty functions—anomaly scores, embedding distance from unused tokens, pairwise token distance, and contextual probability—were developed. These metrics quantify the quality of tokenization by analyzing token embeddings, anomaly detection, and context-aware probabilities. Experiments across seven NLP tasks and four models involved computing penalties for each input, then statistically correlating penalties with output correctness using Student's t-test and Mann-Whitney U test. SpaCy was used for natural word extraction, and metrics like Isolation Forest and cosine similarity assessed token anomalies and distances, ensuring multi-angle evaluation of tokenization quality.

Key Results

  • Contextual penalty (CP) achieved statistical significance at 5% in 17/28 dataset-model combinations, outperforming non-contextual metrics. Higher penalties correlated with incorrect outputs, especially in models with smaller vocabularies. Results demonstrated a consistent positive relationship between tokenization quality and model accuracy, validated by p-values below 0.05. The findings highlight that poor tokenization significantly hampers model performance, with the effect more pronounced in low-vocabulary models.
  • Across tasks like classification, QA, and NER, the penalty functions reliably distinguished better and worse tokenizations. Different aggregation strategies (max, mean, top-K) yielded similar trends, confirming robustness. Ablation studies on POS importance weights indicated that certain POS tags (verbs, nouns) contribute more to performance degradation when poorly tokenized. The experiments collectively support the hypothesis that improving tokenization can enhance model robustness.
  • The analysis revealed that models with smaller vocabularies are more sensitive to tokenization issues, with performance drops correlating with increased token split penalties. The results suggest that optimizing tokenization strategies, especially for low-resource languages or specialized domains, can lead to substantial performance gains. The metrics provide a practical tool for diagnosing and improving tokenization in real-world applications.

Significance

This work advances understanding of how subword segmentation quality influences large language model outputs. By systematically quantifying tokenization effects, it bridges a gap between low-level preprocessing and high-level model performance. The findings inform tokenizer design, emphasizing context-aware and anomaly-sensitive approaches to reduce error propagation. Such insights are crucial for deploying more reliable, robust NLP systems across diverse languages and tasks, addressing longstanding challenges in subword modeling. The methodology offers a new standard for evaluating tokenization quality, fostering innovations that can improve model interpretability and accuracy in real-world scenarios.

Technical Contribution

The paper introduces four novel tokenization penalty functions, integrating anomaly detection, embedding similarity, token pairwise distance, and context-dependent probabilities. These metrics are combined with statistical validation techniques, providing a rigorous framework for assessing tokenization quality's impact on model performance. The approach differs from existing methods by focusing on the model's output behavior rather than purely statistical or frequency-based measures. It enables fine-grained analysis of tokenization errors, guiding the development of smarter tokenizers that adapt dynamically to input context. The work also demonstrates how to incorporate POS tagging and contextual probabilities for more nuanced evaluation, opening avenues for future research in adaptive tokenization strategies.

Novelty

This is the first comprehensive framework to quantify the impact of word splitting on LLM performance through multiple, complementary penalty functions. Unlike prior work that focused on token frequency or embedding analysis in isolation, this study combines anomaly detection, embedding similarity, and context-aware probabilities into a unified evaluation system. The integration of POS weighting and dynamic context adjustment further distinguishes it from static tokenization assessments. The methodology provides a new lens to understand and improve tokenizer design, emphasizing the direct relationship between tokenization quality and downstream task accuracy, which is a novel contribution to NLP research.

Limitations

  • The current approach relies on access to model embeddings and output probabilities, limiting its applicability to open-source models. Closed-source models like GPT are less accessible for detailed analysis, restricting broader validation.
  • The metrics may be sensitive to extreme cases of token splitting or multilingual texts, requiring further adaptation and validation across diverse languages and complex scripts.
  • Experiments primarily involve models with around 8 billion parameters; scalability to larger models or different architectures remains to be tested. Future work should explore these dimensions to confirm generalizability.

Future Work

Future research will focus on developing integrated, multi-metric penalty systems that combine anomaly, semantic, and contextual cues for more robust evaluation. Extending the framework to multilingual and low-resource languages will be prioritized, aiming to optimize tokenization strategies for diverse linguistic structures. Additionally, automating input transformations—such as synonym replacement, morphological analysis, and case normalization—based on penalty feedback could further mitigate poor tokenization effects. Collaborations with tokenizer developers to incorporate these insights into next-generation algorithms are also envisioned, ultimately leading to more adaptive, context-aware tokenization methods that enhance overall model robustness.

AI Executive Summary

The rapid advancement of large language models (LLMs) has revolutionized natural language processing, yet the foundational step—tokenization—remains a critical bottleneck. Traditional tokenization methods, such as Byte-Pair Encoding (BPE), often split natural words into multiple subword units due to limited vocabularies, which can distort the semantic and morphological integrity of input text. This fragmentation hampers the model's ability to accurately interpret and generate language, especially in complex or low-resource scenarios.

This study introduces a comprehensive set of tokenization penalty functions designed to quantify how 'bad' a particular word split is for a given model. These functions include anomaly scores derived from Isolation Forests, embedding distance metrics from unused tokens, pairwise cosine distances between subwords, and context-dependent probabilities incorporating part-of-speech tags. By applying these metrics across seven diverse NLP tasks—such as text classification, question answering, and named entity recognition—and evaluating four prominent models (Phi, Mistral, Qwen, Llama), the authors establish a strong statistical correlation between high penalty scores and degraded model performance.

The experimental results demonstrate that models with smaller vocabularies are more sensitive to poor tokenization, with the contextual penalty (CP) consistently outperforming other metrics in significance tests. These findings highlight that optimizing tokenization strategies, especially through context-aware and anomaly-sensitive approaches, can substantially improve model robustness and accuracy. The research underscores the importance of refining subword segmentation techniques to mitigate performance drops, paving the way for more reliable NLP systems.

Despite its promising insights, the study faces limitations, including dependence on model internals and challenges in applying the metrics to closed-source or multilingual models. Future work aims to develop integrated, adaptive tokenization frameworks, incorporate automated input transformations, and extend validation across languages. Overall, this research offers a vital step toward understanding and enhancing the fundamental preprocessing stage in large language models, with broad implications for both academia and industry.

Deep Dive

Plain Language Accessible to non-experts

想象你在厨房里做饭,食材就像模型的词汇。传统的切菜方法可能会把一个大土豆切成很多小块,但如果切得太碎,厨师(模型)可能会难以判断这些碎块是一个完整的土豆,影响菜的味道。这个研究就像在找一种方法,衡量切得太碎的食材对菜的影响。通过观察这些碎块是否还保持原来的味道和形状,科学家们可以设计更聪明的切菜方法,让厨师做出更好吃的菜。类似地,研究中的惩罚指标帮助判断词拆分得是否合理,从而让模型理解得更准确。这样一来,模型在回答问题、理解句子时就能表现得更好,就像厨师做出更美味的菜一样。

ELI14 Explained like you're 14

想象你在玩拼图游戏,每块拼图代表一个词。正常情况下,拼图块完整,拼起来很容易理解。但如果拼图被切得太碎,拼图就变得很难看懂,就像词被拆成很多小部分一样。这个研究就像在找一种办法,判断拼图碎得多不多,碎得多会让拼图变难看懂。科学家们用一些特殊的“评分”方法,看看拼图碎得是否合理,帮助设计更好的拼图工具。这样,拼图(模型)就能更快、更准确地拼出完整的图片(理解句子)。他们发现,拼图碎得越厉害,模型的表现就越差。未来,他们希望能用这些评分,帮模型变得更聪明,理解得更清楚,就像拼图变得更完整一样。

Abstract

Tokenization is the first step in training any Large Language Model (LLM), where the text is split into a sequence of tokens as per the model's fixed vocabulary. This tokenization in LLMs is different from the traditional tokenization in NLP where the text is split into a sequence of "natural" words. In LLMs, a natural word may also be broken into multiple tokens due to limited vocabulary size of the LLMs (e.g., Mistral's tokenizer splits "martial" into "mart" and "ial"). In this paper, we hypothesize that such breaking of natural words negatively impacts LLM performance on various NLP tasks. To quantify this effect, we propose a set of penalty functions that compute a tokenization penalty for a given text for a specific LLM, indicating how "bad" the tokenization is. We establish statistical significance of our hypothesis on multiple NLP tasks for a set of different LLMs.

cs.CL