Fast WordPiece Tokenization
Not on the map. Why?
Abstract (arXiv)
Tokenization is a fundamental preprocessing step for almost all NLP tasks. In this paper, we propose efficient algorithms for the WordPiece tokenization used in BERT, from single-word tokenization to general text (e.g., sentence) tokenization. When tokenizing a single word, WordPiece uses a longest-match-first strategy, known as maximum matching. The best known algorithms so far are O(n^2) (where n is the input length) or O(nm) (where m is the maximum vocabulary token length). We propose a novel algorithm whose tokenization complexity is strictly O(n). Our method is inspired by the Aho-Corasick algorithm. We introduce additional linkages on top of the trie built from the vocabulary, allowing smart transitions when the trie matching cannot continue. For general text, we further propose an algorithm that combines pre-tokenization (splitting the text into words) and our linear-time WordPiece method into a single pass. Experimental results show that our method is 8.2x faster than HuggingFace Tokenizers and 5.1x faster than TensorFlow Text on average for general text tokenization.
Key facts. Cited by 85 papers in the map (data through 7 Oct 2026). First posted on arXiv 31 Dec 2020.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 2; 2022: 7; 2023: 18; 2024: 25; 2025: 21; 2026: 12.
85 papers.
Sort:
By area:
- 2023Do All Languages Cost the Same? Tokenization in the Era of Commercial Language Modelscited by 186
- 2021Between words and characters: A Brief History of Open-Vocabulary Modeling and Tokenization in NLPcited by 130
- 2024A Review of Large Language Models and Autonomous Agents in Chemistrycited by 96
- 2024LLMs are Good Sign Language Translatorscited by 76
- 2022SERENGETI: Massively Multilingual Language Models for Africacited by 40
- 2023StrucTexTv2: Masked Visual-Textual Prediction for Document Image Pre-trainingcited by 39
- 2025EndoChat: Grounded Multimodal Large Language Model for Endoscopic Surgerycited by 37
- 2024MAGNET: Improving the Multilingual Fairness of Language Models with Adaptive Gradient-Based Tokenizationcited by 31
- 2022A general-purpose material property data extraction pipeline from large polymer corpora using Natural Language Processingcited by 22
- 2024Subobject-level Image Tokenizationcited by 20
- 2024The Foundations of Tokenization: Statistical and Computational Concernscited by 20
- 2022pNLP-Mixer: an Efficient all-MLP Architecture for Languagecited by 19
38 more
- 2022UnifieR: A Unified Retriever for Large-Scale Retrievalcited by 19
- 2024Understanding and Mitigating Tokenization Bias in Language Modelscited by 18
- 2023DictaBERT: A State-of-the-Art BERT Suite for Modern Hebrewcited by 17
- 2025Multimodal Medical Code Tokenizercited by 14
- 2023ScanDL: A Diffusion Model for Generating Synthetic Scanpaths on Textscited by 13
- 2025Is Your LLM Overcharging You? Tokenization, Transparency, and Incentivescited by 13
- 2024POINTS1.5: Building a Vision-Language Model towards Real World Applicationscited by 12
- 2023What changes when you randomly choose BPE merge operations? Not muchcited by 10
- 2024Evaluating Tokenizer Performance of Large Language Models Across Official Indian Languagescited by 10
- 2025Tokenization and Representation Biases in Multilingual Models on Dialectal NLP Taskscited by 9
- 2022MaxMatch-Dropout: Subword Regularization for WordPiececited by 8
- 2023MultiLegalSBD: A Multilingual Legal Sentence Boundary Detection Datasetcited by 7
- 2025RadarLLM: Empowering Large Language Models to Understand Human Motion from Millimeter-Wave Point Cloud Sequencecited by 7
- 2025Serialized EHR make for good text representationscited by 7
- 2024An Interpretable Ensemble of Graph and Language Models for Improving Search Relevance in E-Commercecited by 6
- 2024Superpixel Tokenization for Vision Transformers: Preserving Semantic Integrity in Visual Tokenscited by 6
- 2024Knowledge of Pretrained Language Models on Surface Information of Tokenscited by 5
- 2024ReTok: Replacing Tokenizer to Enhance Representation Efficiency in Large Language Modelcited by 5
- 2024Tokenization as Finite-State Transductioncited by 5
- 2025Speculating LLMs' Chinese Training Data Pollution from Their Tokenscited by 5
- 2023Leveraging Domain Adaptation and Data Augmentation to Improve Qur'anic IR in English and Arabiccited by 4
- 2024A Survey of Source Code Representations for Machine Learning-Based Cybersecurity Taskscited by 4
- 2024Conformer-1: Robust ASR via Large-Scale Semisupervised Bootstrappingcited by 4
- 2024Revisiting Character-level Adversarial Attacks for Language Modelscited by 4
- 2025Learning an Effective Premise Retrieval Model for Efficient Mathematical Formalizationcited by 4
- 2023Using Semantic Similarity and Text Embedding to Measure the Social Media Echo of Strategic Communicationscited by 3
- 2024I/O in Machine Learning Applications on HPC Systems: A 360-degree Surveycited by 3
- 2026Transducing Language Modelscited by 3
- 2026FreeTxt-Vi: A Benchmarked Vietnamese-English Toolkit for Segmentation, Sentiment, and Summarisationcited by 3
- 2022Language Model Classifier Aligns Better with Physician Word Sensitivity than XGBoost on Readmission Predictioncited by 2
- 2023BIOptimus: Pre-training an Optimal Biomedical Language Model with Curriculum Learning for Named Entity Recognitioncited by 2
- 2023On the Analysis of Cross-Lingual Prompt Tuning for Decoder-based Multilingual Modelcited by 2
- 2025Tokenization Disparities as Infrastructure Bias: How Subword Systems Create Inequities in LLM Access and Efficiencycited by 2
- 2025MUTANT: A Recipe for Multilingual Tokenizer Designcited by 2
- 2026From Token to Token Pair: Efficient Prompt Compression for Large Language Models in Clinical Predictioncited by 2
- 2021Sparse Distillation: Speeding Up Text Classification by Using Bigger Student Modelscited by 1
- 2023Multiple Relations Classification using Imbalanced Predictions Adaptationcited by 1
- 2023Advancing Perception in Artificial Intelligence through Principles of Cognitive Sciencecited by 1
50 most cited of 85 All 85 (JSON)
- 2026The Life of a Token: from Words to Bits on the Wire17 Sep 2026
- 2026Shadow Queries for Private Retrieval in Vector Databases4 Sep 2026
- 2026Domain-Agnostic Neural Topic Modeling with Contextual Token-Level Semantic Graph Representation17 Aug 2026
- 2026Can Released LLM Vocabularies Support Token-Level Estimation of Hidden Corpora?11 Aug 2026
- 2026Adaptive Targeted Dynamic Chunking for Tokenization-Free Hierarchical Model28 May 2026
- 2026DeepTokenEEG Enhancing Mild Cognitive Impairment and Alzheimers Classification via Tokenized EEG Features14 May 2026
- 2026From Token to Token Pair: Efficient Prompt Compression for Large Language Models in Clinical Prediction12 May 2026
- 2026(1D) Ordered Tokens Enable Efficient Test-Time Search16 Apr 2026
- 2026The GELATO Dataset for Legislative NER14 Mar 2026
- 2026FreeTxt-Vi: A Benchmarked Vietnamese-English Toolkit for Segmentation, Sentiment, and Summarisation5 Mar 2026
- 2026Transducing Language Models5 Mar 2026
- 2026Tokenization vs. Augmentation: A Systematic Study of Writer Variance in IMU-Based Online Handwriting Recognition25 Feb 2026
38 more
- 2025Comparative Analysis of 47 Context-Based Question Answer Models Across 8 Diverse Datasets29 Nov 2025
- 2025MUTANT: A Recipe for Multilingual Tokenizer Design5 Nov 2025
- 2025NeoDictaBERT: Pushing the Frontier of BERT models for Hebrew23 Oct 2025
- 2025Tokenization Disparities as Infrastructure Bias: How Subword Systems Create Inequities in LLM Access and Efficiency14 Oct 2025
- 2025Serialized EHR make for good text representations11 Oct 2025
- 2025Role-Aware Multi-modal federated learning system for detecting phishing webpages26 Sep 2025
- 2025Tokenization and Representation Biases in Multilingual Models on Dialectal NLP Tasks24 Sep 2025
- 2025KuBERT: Central Kurdish BERT Model and Its Application for Sentiment Analysis20 Sep 2025
- 20251 bit is all we need: binary normalized neural networks7 Sep 2025
- 2025Speculating LLMs' Chinese Training Data Pollution from Their Tokens25 Aug 2025
- 2025ILID: Native Script Language Identification for Indian Languages16 Jul 2025
- 2025Ensemble BERT for Medication Event Classification on Electronic Health Records (EHRs)29 Jun 2025
- 2025Tokenization Multiplicity Leads to Arbitrary Price Variation in LLM-as-a-service6 Jun 2025
- 2025Is Your LLM Overcharging You? Tokenization, Transparency, and Incentives27 May 2025
- 2025Ustnlp16 at SemEval-2025 Task 9: Improving Model Performance through Imbalance Handling and Focal Loss24 Apr 2025
- 2025RadarLLM: Empowering Large Language Models to Understand Human Motion from Millimeter-Wave Point Cloud Sequence14 Apr 2025
- 2025Tokenization of Gaze Data28 Mar 2025
- 2025Detection of Somali-written Fake News and Toxic Messages on the Social Media Using Transformer-based Language Models23 Mar 2025
- 2025Multimodal Medical Code Tokenizer6 Feb 2025
- 2025Learning an Effective Premise Retrieval Model for Efficient Mathematical Formalization21 Jan 2025
- 2025EndoChat: Grounded Multimodal Large Language Model for Endoscopic Surgery20 Jan 2025
- 2024POINTS1.5: Building a Vision-Language Model towards Real World Applications11 Dec 2024
- 2024Superpixel Tokenization for Vision Transformers: Preserving Semantic Integrity in Visual Tokens6 Dec 2024
- 2024Evaluating Tokenizer Performance of Large Language Models Across Official Indian Languages19 Nov 2024
- 2024Tokenization as Finite-State Transduction21 Oct 2024
- 2024ReTok: Replacing Tokenizer to Enhance Representation Efficiency in Large Language Model6 Oct 2024
- 2024Morphological evaluation of subwords vocabulary used by BETO language model3 Oct 2024
- 2024SubRegWeigh: Effective and Efficient Annotation Weighing with Subword Regularization10 Sep 2024
- 2024The Foundations of Tokenization: Statistical and Computational Concerns16 Jul 2024
- 2024MAGNET: Improving the Multilingual Fairness of Language Models with Adaptive Gradient-Based Tokenization11 Jul 2024
- 2024The Solution for the AIGC Inference Performance Optimization Competition6 Jul 2024
- 2024A Review of Large Language Models and Autonomous Agents in Chemistry26 Jun 2024
- 2024Vaporetto: Efficient Japanese Tokenization Based on Improved Pointwise Linear Classification24 Jun 2024
- 2024Understanding and Mitigating Tokenization Bias in Language Models24 Jun 2024
- 2024Language models emulate certain cognitive profiles: An investigation of how predictability measures interact with individual differences7 Jun 2024
- 2024Technical Language Processing for Telecommunications Specifications4 Jun 2024
- 2024Revisiting Character-level Adversarial Attacks for Language Models7 May 2024
- 2024Relations Prediction for Knowledge Graph Completion using Large Language Models4 May 2024
50 newest of 85 All 85 (JSON)
- 2025EndoChat: Grounded Multimodal Large Language Model for Endoscopic Surgerycited by 37
- 2024POINTS1.5: Building a Vision-Language Model towards Real World Applicationscited by 12
- 2025Tokenization of Gaze Datacited by 1
- 2025Tokenization of Gaze Data28 Mar 2025
- 2025EndoChat: Grounded Multimodal Large Language Model for Endoscopic Surgery20 Jan 2025
- 2024POINTS1.5: Building a Vision-Language Model towards Real World Applications11 Dec 2024
- 2026Shadow Queries for Private Retrieval in Vector Databasescited by 0
- 2026Shadow Queries for Private Retrieval in Vector Databases4 Sep 2026
- 2023Do All Languages Cost the Same? Tokenization in the Era of Commercial Language Modelscited by 186
- 2021Between words and characters: A Brief History of Open-Vocabulary Modeling and Tokenization in NLPcited by 130
- 2024LLMs are Good Sign Language Translatorscited by 76
- 2022SERENGETI: Massively Multilingual Language Models for Africacited by 40
- 2023StrucTexTv2: Masked Visual-Textual Prediction for Document Image Pre-trainingcited by 39
- 2024MAGNET: Improving the Multilingual Fairness of Language Models with Adaptive Gradient-Based Tokenizationcited by 31
- 2022A general-purpose material property data extraction pipeline from large polymer corpora using Natural Language Processingcited by 22
- 2024Subobject-level Image Tokenizationcited by 20
- 2024The Foundations of Tokenization: Statistical and Computational Concernscited by 20
- 2022pNLP-Mixer: an Efficient all-MLP Architecture for Languagecited by 19
- 2022UnifieR: A Unified Retriever for Large-Scale Retrievalcited by 19
- 2024Understanding and Mitigating Tokenization Bias in Language Modelscited by 18
12 most cited of 76 All 76 (JSON)
- 2026The Life of a Token: from Words to Bits on the Wire17 Sep 2026
- 2026Domain-Agnostic Neural Topic Modeling with Contextual Token-Level Semantic Graph Representation17 Aug 2026
- 2026Can Released LLM Vocabularies Support Token-Level Estimation of Hidden Corpora?11 Aug 2026
- 2026Adaptive Targeted Dynamic Chunking for Tokenization-Free Hierarchical Model28 May 2026
- 2026DeepTokenEEG Enhancing Mild Cognitive Impairment and Alzheimers Classification via Tokenized EEG Features14 May 2026
- 2026(1D) Ordered Tokens Enable Efficient Test-Time Search16 Apr 2026
- 2026The GELATO Dataset for Legislative NER14 Mar 2026
- 2026FreeTxt-Vi: A Benchmarked Vietnamese-English Toolkit for Segmentation, Sentiment, and Summarisation5 Mar 2026
- 2026Transducing Language Models5 Mar 2026
- 2026Tokenization vs. Augmentation: A Systematic Study of Writer Variance in IMU-Based Online Handwriting Recognition25 Feb 2026
- 2025Comparative Analysis of 47 Context-Based Question Answer Models Across 8 Diverse Datasets29 Nov 2025
- 2025MUTANT: A Recipe for Multilingual Tokenizer Design5 Nov 2025
12 newest of 76 All 76 (JSON)