Skip to main content
QUICK REVIEW

[Paper Review] Tokenization counts: the impact of tokenization on arithmetic in frontier LLMs

Aaditya K. Singh, DJ Strouse|arXiv (Cornell University)|Feb 22, 2024
Advancements in Photolithography TechniquesEngineering8 citations
TL;DR

The paper shows that number tokenization direction (left-to-right vs right-to-left) markedly affects arithmetic performance in GPT-3.5 and GPT-4, with R2L generally yielding better results; models can convert tokenizations to recover performance, and effects persist with larger models.

ABSTRACT

Tokenization, the division of input text into input tokens, is an often overlooked aspect of the large language model (LLM) pipeline and could be the source of useful or harmful inductive biases. Historically, LLMs have relied on byte pair encoding, without care to specific input domains. With the increased use of LLMs for reasoning, various number-specific tokenization schemes have been adopted, with popular models like LLaMa and PaLM opting for single-digit tokenization while GPT-3.5 and GPT-4 have separate tokens for each 1-, 2-, and 3-digit numbers. In this work, we study the effect this choice has on numerical reasoning through the use of arithmetic tasks. We consider left-to-right and right-to-left tokenization for GPT-3.5 and -4, finding that right-to-left tokenization (enforced by comma separating numbers at inference time) leads to largely improved performance. Furthermore, we find that model errors when using standard left-to-right tokenization follow stereotyped error patterns, suggesting that model computations are systematic rather than approximate. We show that the model is able to convert between tokenizations easily, thus allowing chain-of-thought-inspired approaches to recover performance on left-to-right tokenized inputs. We also find the gap between tokenization directions decreases when models are scaled, possibly indicating that larger models are better able to override this tokenization-dependent inductive bias. In summary, our work performs the first study of how number tokenization choices lead to differences in model performance on arithmetic tasks, accompanied by a thorough analysis of error patterns. We hope this work inspires practitioners to more carefully ablate number tokenization-related choices when working towards general models of numerical reasoning.

Motivation & Objective

  • Motivate careful examination of number tokenization as a potential inductive bias in numerical reasoning with frontier LLMs.
  • Compare arithmetic performance under left-to-right (L2R) and right-to-left (R2L) tokenization in GPT-3.5 and GPT-4.
  • Analyze error patterns to understand the influence of tokenization on reasoning processes.
  • Evaluate whether model scale mitigates tokenization-related biases.

Proposed method

  • Experiment setup uses OpenAI Chat Completions API to test few-shot addition tasks with addends of 7–9 digits.
  • Force R2L tokenization by inserting separators (commas or other delimiters) every three digits to alter input segmentation.
  • Measure accuracy under 1-, 2-, 4-, and 8-shot prompts and across model versions (GPT-3.5, GPT-4 and variants).
  • Conduct ablations to control for formatting priors and “thinking tokens,” including alternative separators and prompts that separate tokenization direction from output.
  • Analyze error patterns to characterize when L2R tokenization underperforms (e.g., length-mismatch cases) and the nature of mistakes (digit-level errors).],
  • research_questions":[
Figure 1: Illustrating the dependence of frontier model arithmetic performance on tokenization. We show how using commas can enforce right-to-left (R2L) tokenization for the same addition problem. R2L tokenization leads to improved model performance on both GPT-3.5 and GPT-4 (March 2023 models), whi
Figure 1: Illustrating the dependence of frontier model arithmetic performance on tokenization. We show how using commas can enforce right-to-left (R2L) tokenization for the same addition problem. R2L tokenization leads to improved model performance on both GPT-3.5 and GPT-4 (March 2023 models), whi

Experimental results

Research questions

  • RQ1How does tokenization direction (L2R vs R2L) affect arithmetic accuracy in frontier LLMs?
  • RQ2Do tokenization-induced effects persist across model versions and larger models?
  • RQ3What error patterns emerge under different tokenization schemes, and do they suggest systematic computation vs. approximate matching?
  • RQ4Can prompting the model to convert inputs between tokenizations mitigate performance gaps?
  • RQ5Is the observed effect driven by token boundaries or by broader training data priors?

Key findings

  • R2L tokenization yields significantly higher arithmetic accuracy than L2R for GPT-3.5 and GPT-4 in controlled experiments (e.g., up to 20% higher accuracy).
  • The accuracy gap between R2L and L2R grows with more shots, but saturates, with R2L showing robust gains across 8-shot trials.
  • Length-mismatch cases (where the answer is longer than addends) disproportionately hurt L2R performance, revealing tokenization-induced misalignment between inputs and outputs.
  • L2R tokenization produces highly stereotyped digit-4 errors in length-mismatch scenarios, suggesting a systematic processing pattern rather than mere noise.
  • Models can convert L2R inputs to R2L outputs to recover accuracy, with few-shot prompting enabling the model to repeat problems in the preferred tokenization.
  • Tokenization-dependent effects generally extend to newer models, including GPT-4 variants, though the magnitude can vary across model versions and configurations.
Figure 2: All 3-digit strings, colored red when the string does not have a corresponding single token in p50k_base , the BPE tokenizer for GPT-3. Though there’s some patterns (e.g., nearly all multiples of 10 are present), overall there’s no clear structure. The missing tokens are an artifact of the
Figure 2: All 3-digit strings, colored red when the string does not have a corresponding single token in p50k_base , the BPE tokenizer for GPT-3. Though there’s some patterns (e.g., nearly all multiples of 10 are present), overall there’s no clear structure. The missing tokens are an artifact of the

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.