Table of Contents
Fetching ...

Tokenization Is More Than Compression

Craig W. Schmidt, Varshini Reddy, Haoran Zhang, Alec Alameddine, Omri Uzan, Yuval Pinter, Chris Tanner

TL;DR

The paper investigates whether minimizing token counts in tokenization improves downstream NLP performance, by decomposing tokenization into pre-tokenization, vocabulary construction, and segmentation and introducing PathPiece as a lossless, shortest-path tokenizer. Through large-scale experiments with 64 language models across three vocabulary sizes, it shows that reducing tokens does not straightforwardly enhance accuracy; pre-tokenization strategy and initial vocabulary selection (notably BPE initialization) significantly influence results. The findings challenge the compression-centric view of why tokenization works and provide nuanced guidance on tokenizer design, releasing all vocabularies and models for public use. Overall, the work suggests that tokenization effectiveness arises from a combination of design choices rather than merely achieving a small token count, and it offers practical benchmarks and methodological insights for future research.

Abstract

Tokenization is a foundational step in natural language processing (NLP) tasks, bridging raw text and language models. Existing tokenization approaches like Byte-Pair Encoding (BPE) originate from the field of data compression, and it has been suggested that the effectiveness of BPE stems from its ability to condense text into a relatively small number of tokens. We test the hypothesis that fewer tokens lead to better downstream performance by introducing PathPiece, a new tokenizer that segments a document's text into the minimum number of tokens for a given vocabulary. Through extensive experimentation we find this hypothesis not to be the case, casting doubt on the understanding of the reasons for effective tokenization. To examine which other factors play a role, we evaluate design decisions across all three phases of tokenization: pre-tokenization, vocabulary construction, and segmentation, offering new insights into the design of effective tokenizers. Specifically, we illustrate the importance of pre-tokenization and the benefits of using BPE to initialize vocabulary construction. We train 64 language models with varying tokenization, ranging in size from 350M to 2.4B parameters, all of which are made publicly available.

Tokenization Is More Than Compression

TL;DR

The paper investigates whether minimizing token counts in tokenization improves downstream NLP performance, by decomposing tokenization into pre-tokenization, vocabulary construction, and segmentation and introducing PathPiece as a lossless, shortest-path tokenizer. Through large-scale experiments with 64 language models across three vocabulary sizes, it shows that reducing tokens does not straightforwardly enhance accuracy; pre-tokenization strategy and initial vocabulary selection (notably BPE initialization) significantly influence results. The findings challenge the compression-centric view of why tokenization works and provide nuanced guidance on tokenizer design, releasing all vocabularies and models for public use. Overall, the work suggests that tokenization effectiveness arises from a combination of design choices rather than merely achieving a small token count, and it offers practical benchmarks and methodological insights for future research.

Abstract

Tokenization is a foundational step in natural language processing (NLP) tasks, bridging raw text and language models. Existing tokenization approaches like Byte-Pair Encoding (BPE) originate from the field of data compression, and it has been suggested that the effectiveness of BPE stems from its ability to condense text into a relatively small number of tokens. We test the hypothesis that fewer tokens lead to better downstream performance by introducing PathPiece, a new tokenizer that segments a document's text into the minimum number of tokens for a given vocabulary. Through extensive experimentation we find this hypothesis not to be the case, casting doubt on the understanding of the reasons for effective tokenization. To examine which other factors play a role, we evaluate design decisions across all three phases of tokenization: pre-tokenization, vocabulary construction, and segmentation, offering new insights into the design of effective tokenizers. Specifically, we illustrate the importance of pre-tokenization and the benefits of using BPE to initialize vocabulary construction. We train 64 language models with varying tokenization, ranging in size from 350M to 2.4B parameters, all of which are made publicly available.
Paper Structure (41 sections, 12 equations, 22 figures, 14 tables, 2 algorithms)

This paper contains 41 sections, 12 equations, 22 figures, 14 tables, 2 algorithms.

Figures (22)

  • Figure 1: Effect of vocabulary size on downstream performance. For each tokenizer variant, we show the overall average, along with the three averages by vocabulary size, labeled according to the ranks in \ref{['tab:overallavg_grouped']}.
  • Figure 2: Pairwise $p$-values for 350M model results. Boxes outlined in black represent $p$ > 0.05. The top 6 tokenizers are all competitive, and there is no statistically significantly best approach.
  • Figure 3: Effect of corpus token count (CTC) vs average accuracy of individual vocabulary sizes.
  • Figure 4: The impact of pre-tokenization on Corpus Token Count (CTC) and Overall Accuracy. Ranks in parentheses refer to performance in \ref{['tab:overallavg_grouped']}.
  • Figure 5: Venn diagram comparing 40,960 token vocabularies of BPE, PathPieceL and SaGe -- the latter two were both initialized from a BPE vocabulary of 262,144.
  • ...and 17 more figures