#Concise Definition
Tokenization is the procedure that converts raw input (text, as a sequence of bytes or characters) into a sequence of discrete symbols called tokens drawn from a fixed vocabulary. An embedding is a learned dense vector assigned to each token (or, in later models, to a whole passage), which is the numerical form on which a neural network operates. Together they define the interface between human-readable data and the Transformer layers of a language model.
#Overview & Significance
A neural language model (see [TECH-LLM-001]) cannot consume a string directly. It needs a finite vocabulary of symbols, each mapped to a vector, and it predicts a distribution over that vocabulary at each step. The choice of vocabulary is therefore a modelling decision with consequences for several things:
- Sequence length and compute. A tokenizer that represents a text in fewer tokens makes attention and generation cheaper, because cost grows with the number of tokens (see [TECH-ARCH-001], [TECH-INFER-001]).
- Coverage. Word-level vocabularies cannot represent unseen words; characters or bytes can represent anything but yield long sequences.
- Fairness and cost. The same content can require very different token counts in different languages, which affects price, latency and usable context (Petrov et al., 2023; Ahia et al., 2023).
- Reliability. Tokens present in a vocabulary but rare or absent in training data can cause erratic behaviour (Land & Bartolo, 2024).
Embeddings matter because the geometry of the vector space determines what the model can easily generalise. The same idea extends beyond input: embedding models that map passages or images to vectors are the basis of semantic search (see [TECH-RAG-001]) and of multimodal alignment (see [TECH-MM-001]).
#Historical Development
Before neural models, text was represented as sparse count vectors over a word vocabulary. Dense, learned word vectors became practical with the word2vec models of Mikolov et al. (2013a, 2013b), which learned vectors from large corpora fast enough to use 1.6 billion words in under a day and evaluated them on syntactic and semantic similarity. GloVe (Pennington, Socher & Manning, 2014) fitted vectors to global co-occurrence statistics. fastText (Bojanowski et al., 2017) composed word vectors from character n-grams so that rare and unseen words obtain representations.
The open-vocabulary problem in neural machine translation led Sennrich, Haddow and Birch (2016) to adopt a segmentation based on the byte pair encoding (BPE) compression algorithm, encoding rare words as sequences of subword units; they reported gains of 1.1 and 1.3 BLEU over a back-off dictionary on WMT 15 English–German and English–Russian. Wu et al. (2016) described a related wordpiece approach for Google's translation system. Kudo (2018) proposed a unigram-language-model segmentation with subword regularisation, and Kudo and Richardson (2018) released SentencePiece, which trains directly on raw text without requiring a pre-tokenised word sequence. BERT (Devlin et al., 2019) used a subword vocabulary together with contextual representations, replacing static word vectors with ones that depend on the surrounding sentence.
More recently, token-free approaches processing bytes directly have been studied with standard Transformers (ByT5; Xue et al., 2022) and, for the Byte Latent Transformer, in a scaling study up to 8B parameters (Pagnoni et al., 2024). Subword tokenizers remain the documented norm in the models reviewed for this article; this article does not survey whether later frontier models adopted byte-level or patch-based designs.
#Technical / Conceptual Explanation
#4.1 Byte-pair encoding
BPE learns a vocabulary from a training corpus. In its subword form (Sennrich et al., 2016):
- Start with a vocabulary of base symbols (characters, or the 256 possible byte values in byte-level variants).
- Count all adjacent symbol pairs in the corpus.
- Merge the most frequent pair into a new symbol and add it to the vocabulary; record the merge rule.
- Repeat until the vocabulary reaches a target size.
At encoding time the learned merges are applied to new text in the order in which they were learned. Frequent words become single tokens; rare words decompose into several pieces. Byte-level BPE, which builds the vocabulary on bytes, was described for machine translation by Wang, Cho and Gu (2019); because it starts from bytes it produces no out-of-vocabulary tokens, so any Unicode string is representable. Sennrich et al. (2016) describe the subword BPE method itself, not the byte-level variant.
#4.2 Unigram and WordPiece variants
The unigram model (Kudo, 2018) starts from a large candidate vocabulary and prunes it to maximise the likelihood of the training data under a unigram language model; it can produce several segmentations of the same string with different probabilities, which subword regularisation uses as training noise. WordPiece (Wu et al., 2016) is likewise a data-driven subword scheme. The families differ in how the vocabulary is built and in how ties and ambiguities are resolved; all of them produce a deterministic or sampled mapping from a string to a sequence of vocabulary indices.
#4.3 The embedding layer
Given token indices with and an embedding matrix , the input to the Transformer is the matrix whose -th row is , with positional information added or applied inside attention (Vaswani et al., 2017; see [TECH-ARCH-001]). The matrix is a trained parameter, so parameters are spent on it; the output projection back to logits has the same shape. A language model is trained to minimise the cross-entropy
over tokens, so its units of prediction are the tokenizer's tokens.
#4.4 Why tokenizers complicate comparison
Because is measured per token, models with different tokenizers have different units. If a tokenizer yields on average tokens per byte of text and the loss in nats per token is , the loss per byte in bits is . Comparisons across tokenizers should therefore use a per-byte or per-character measure, not per-token perplexity. This is a direct consequence of the definitions and is not a claim about any specific model.
#4.5 Static versus contextual embeddings
word2vec, GloVe and fastText assign one vector per word type, so a polysemous word has one vector. A Transformer layer stack outputs contextual vectors in which the same token receives different representations in different sentences (Devlin et al., 2019). Sentence-level embedding models, such as Sentence-BERT (Reimers & Gurevych, 2019), pool or fine-tune such representations so that semantically similar sentences have high cosine similarity; embedding-based retrieval uses the same idea of comparing learned vectors, though dense passage retrievers such as that of Karpukhin et al. (2020) train separate query and passage encoders with a similarity score over their outputs.
#4.6 Vocabulary size trade-off
A larger vocabulary shortens sequences but enlarges the embedding and output matrices and makes each rare token less frequently trained. As one documented data point, the Llama 3 report describes a 128K-token vocabulary (100K tokens from the tiktoken tokenizer plus 28K additional tokens for non-English languages) and states that, versus the Llama 2 tokenizer, compression on a sample of English data improved from 3.17 to 3.94 characters per token (Grattafiori et al., 2024). This is a single developer-reported figure on one sample; it is not a general law.
#Types, Components & Classifications
| Level | Description | Advantages | Disadvantages |
|---|---|---|---|
| Word | One token per word type | Short sequences, readable | Unseen-word problem; huge vocabularies |
| Character | One token per character | No unseen symbols | Long sequences |
| Byte | One token per byte (256 symbols) | Language-agnostic; no preprocessing (Xue et al., 2022) | Longer sequences, more compute per text |
| Subword (BPE, WordPiece, Unigram) | Variable-length pieces learned from data | Compromise between coverage and length | Language-dependent efficiency; artefacts |
| Learned patches | Dynamic-length byte groups chosen by the model | Reported to match token-based models at scale (Pagnoni et al., 2024) | Newer; less widely deployed |
The Byte Latent Transformer (Pagnoni et al., 2024) groups bytes into patches whose lengths depend on the entropy of the next byte; the authors report the first FLOP-controlled scaling study of byte-level models up to 8B parameters and 4T training bytes and better scaling than token-based models at fixed inference cost. This is single-group evidence (Preliminary).
#Applications & Concrete Examples
- Text LLMs. The widely used autoregressive language models reviewed for this article use a tokenizer, with the vocabulary and algorithm usually published for open-weight models. For closed models the vocabulary may be exposed through the API or a library, but whether the training-time tokenizer matches a published one is a developer matter; this article does not infer it.
- Billing. Commercial APIs commonly price by tokens. Ahia et al. (2023) analysed OpenAI's API on multilingual benchmarks in 22 languages and report that speakers of many of the languages are overcharged while obtaining poorer results, because of differences in token counts.
- Retrieval. Dense passage encoders map queries and documents to vectors for nearest-neighbour search (Reimers & Gurevych, 2019; Karpukhin et al., 2020).
- Cross-modal embeddings. CLIP-style models align image and text embeddings in a shared space (see [TECH-MM-001]).
#Advantages, Limitations & Unresolved Questions
#Advantages of subword tokenization
Fixed, moderate sequence lengths; no unseen-word failure; a mature toolchain (Kudo & Richardson, 2018).
#Limitations
- Cross-language disparity. Petrov et al. (2023) report that the same text translated into different languages can differ in tokenization length by up to 15 times in some cases, even for tokenizers built for multilingual support, with character- and byte-level models still showing over 4x differences for some language pairs. They argue this produces unequal cost, latency and available context (see [SAFE-ETHICS-001]).
- Tokenizer quality affects downstream performance. Rust et al. (2021) examine monolingual performance of multilingual models as a function of tokenizer quality.
- Under-trained ("glitch") tokens. Land and Bartolo (2024) present methods to detect vocabulary tokens that are nearly or entirely absent from training data and show such tokens are prevalent across a diverse set of models; these can induce unwanted behaviour.
- Opaque units. Models see tokens, not characters. Tasks that depend on spelling or on character-level structure can be harder; the extent for any given model must be measured, not assumed.
#Unresolved questions
- Whether tokenizer-free models will match subword models at the largest scales; current evidence is limited to the studies cited (Preliminary).
- How to design vocabularies that are fair across languages without large cost in compute.
- How much of the geometric structure of embedding spaces reflects meaning rather than corpus statistics; the word-vector literature measures similarity tasks and does not settle this.
#Current State of Knowledge
As of 2026-10-19, subword tokenization (BPE variants and SentencePiece-style unigram or BPE models) is the standard in the documented language models reviewed here (no survey of 2026 model documentation was performed), and byte-level BPE is a documented option for coverage. Dense learned embeddings, both input embeddings and sentence-level retrieval embeddings, are standard components. Claims about the tokenizer or vocabulary of a specific closed model should be taken only from developer documentation or from the model's public tokenizer, and are otherwise undisclosed. Current vocabulary sizes and compression rates of named models belong in the Living Reference (MODEL-001), not in this article.
#Future Trajectory & Strategic Outlook
Observed directions: dynamic or learned segmentation (Pagnoni et al., 2024), explicit tests for under-trained tokens (Land & Bartolo, 2024), and fairness-aware tokenizer design (Petrov et al., 2023). Whether byte-level or patch-based models become the default is open; no forecast is registered here.
Sources, evidence and revision historyReferences · Evidential Classification Matrix · Revision History
#References & Foundational Literature
- Mikolov, T., Chen, K., Corrado, G., & Dean, J. (2013a). Efficient Estimation of Word Representations in Vector Space. arXiv:1301.3781. [word2vec architectures; vectors learned from a 1.6-billion-word set in under a day, evaluated on syntactic and semantic similarity].
- Mikolov, T., Sutskever, I., Chen, K., Corrado, G., & Dean, J. (2013b). Distributed Representations of Words and Phrases and their Compositionality. NeurIPS 2013. arXiv:1310.4546. [Skip-gram training refinements and phrase vectors].
- Pennington, J., Socher, R., & Manning, C. (2014). GloVe: Global Vectors for Word Representation. Proceedings of EMNLP 2014. https://doi.org/10.3115/v1/D14-1162. [Word vectors fitted to global co-occurrence statistics].
- Bojanowski, P., Grave, E., Joulin, A., & Mikolov, T. (2017). Enriching Word Vectors with Subword Information. Transactions of the ACL, 5. arXiv:1607.04606. [Character n-gram composition for rare and unseen words].
- Sennrich, R., Haddow, B., & Birch, A. (2016). Neural Machine Translation of Rare Words with Subword Units. Proceedings of ACL 2016. arXiv:1508.07909. [BPE-based subword segmentation; +1.1 and +1.3 BLEU on WMT 15].
- Wu, Y., Schuster, M., Chen, Z., et al. (2016). Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation. arXiv:1609.08144. [Wordpiece segmentation in a production NMT system].
- Kudo, T. (2018). Subword Regularization: Improving Neural Network Translation Models with Multiple Subword Candidates. Proceedings of ACL 2018. arXiv:1804.10959. [Unigram language-model segmentation and sampled segmentations as regularisation].
- Kudo, T., & Richardson, J. (2018). SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processing. Proceedings of EMNLP 2018 (System Demonstrations). arXiv:1808.06226. [Subword training directly from raw sentences].
- Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2019). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. Proceedings of NAACL-HLT 2019. arXiv:1810.04805. [Subword input and contextual representations].
- Reimers, N., & Gurevych, I. (2019). Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks. Proceedings of EMNLP-IJCNLP 2019. arXiv:1908.10084. [Sentence embeddings compared by cosine similarity].
- Karpukhin, V., Oğuz, B., Min, S., Lewis, P., Wu, L., Edunov, S., Chen, D., & Yih, W. (2020). Dense Passage Retrieval for Open-Domain Question Answering. Proceedings of EMNLP 2020. arXiv:2004.04906. [Learned dense encoders for retrieval].
- Xue, L., Barua, A., Constant, N., Al-Rfou, R., Narang, S., Kale, M., Roberts, A., & Raffel, C. (2022). ByT5: Towards a token-free future with pre-trained byte-to-byte models. Transactions of the ACL, 10. arXiv:2105.13626; https://doi.org/10.1162/tacl_a_00461. [Standard Transformer on byte sequences; trade-offs in parameters, FLOPs and speed; byte-level models competitive with token-level counterparts].
- Rust, P., Pfeiffer, J., Vulić, I., Ruder, S., & Gurevych, I. (2021). How Good is Your Tokenizer? On the Monolingual Performance of Multilingual Language Models. Proceedings of ACL-IJCNLP 2021. arXiv:2012.15613; ACL Anthology 2021.acl-long.243. [Tokenizer quality and monolingual downstream performance].
- Petrov, A., La Malfa, E., Torr, P. H. S., & Bibi, A. (2023). Language Model Tokenizers Introduce Unfairness Between Languages. NeurIPS 2023. arXiv:2305.15425. [Up to 15x tokenization-length differences across languages for the same text].
- Ahia, O., Kumar, S., Gonen, H., Kasai, J., Mortensen, D. R., Smith, N. A., & Tsvetkov, Y. (2023). Do All Languages Cost the Same? Tokenization in the Era of Commercial Language Models. Proceedings of EMNLP 2023. arXiv:2305.13707; ACL Anthology 2023.emnlp-main.614. [API pricing disparities across 22 languages].
- Land, S., & Bartolo, M. (2024). Fishing for Magikarp: Automatically Detecting Under-trained Tokens in Large Language Models. Proceedings of EMNLP 2024. arXiv:2405.05417; ACL Anthology 2024.emnlp-main.649. [Detection of under-trained vocabulary tokens].
- Pagnoni, A., Pasunuru, R., Rodriguez, P., et al. (2024). Byte Latent Transformer: Patches Scale Better Than Tokens. arXiv:2412.09871. [Entropy-based byte patching; scaling study up to 8B parameters and 4T bytes].
- Grattafiori, A., Dubey, A., Jauhri, A., et al. (2024). The Llama 3 Herd of Models. arXiv:2407.21783. [Documents a 128K vocabulary and the reported change in compression rate].
- Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., & Polosukhin, I. (2017). Attention Is All You Need. NeurIPS 2017. arXiv:1706.03762. [Transformer input embeddings and positional encodings].
- Wang, C., Cho, K., & Gu, J. (2019). Neural Machine Translation with Byte-Level Subwords. arXiv:1909.03341. [Introduces byte-level BPE; reports no out-of-vocabulary tokens and performance comparable to standard BPE with a smaller vocabulary.]
#Evidential Classification Matrix
| Section / Claim | Evidence Category | Supporting Source | Confidence / Status |
|---|---|---|---|
| BPE merge algorithm and its use for subword vocabularies | Established | Sennrich et al. (2016) | High |
| Unigram segmentation and SentencePiece | Well Supported | Kudo (2018); Kudo & Richardson (2018) | Moderate-High; method papers plus broad adoption, adoption not surveyed here |
| Per-byte measure needed for cross-tokenizer comparison | Established (derivation from definitions) | Section 4.4 | High |
| Cross-language token-count disparity | Well Supported | Petrov et al. (2023); Ahia et al. (2023) | High for reported languages and tokenizers |
| Under-trained tokens are prevalent and cause erratic behaviour | Preliminary | Land & Bartolo (2024) | Moderate; single peer-reviewed study, models tested were those in the paper |
| Byte/patch models match token-based models at scale | Preliminary | Pagnoni et al. (2024); Xue et al. (2022) | Moderate; limited independent replication |
| Tokenizer of any specific closed model | Undisclosed unless developer-documented | Developer documentation | Not inferred |
#Revision History
- v0.2.1 (2026-10-27): Resolved verification flags against sources named in the references; unverifiable claims softened or removed.
- v0.1.0 (2026-10-15): Initial draft. Citations checked against arXiv/Crossref/publisher pages where marked; not independently fact-checked.
- v0.2.0 (2026-10-19): Fact-check audit (docs/audits/TECH-TOK-001_audit.md). All 19 references re-checked against arXiv, ACL Anthology and Crossref; quoted figures confirmed. Corrected ByT5 scale claim, retrieval-encoder wording and two evidence ratings; marked unverified current-state and byte-level BPE claims. Status remains Draft.