
One-sentence definition
Unit in which a model splits an input or output to process it and, often, to account for context and usage.
Definition and concepts to distinguish
A token is the basic unit of textual information that a large language model (LLM) uses to process and generate content. It is not necessarily a whole word: depending on the tokenizer, it may be a word, part of a word, punctuation, or a combination of characters. The model receives text as a sequence of these units, represented by numerical identifiers.
It helps to distinguish an AI token from other concepts that share the same name. In computer security, a token may be an authentication credential; in blockchain, it may represent a digital asset. In a language model, a token is a processing unit, not a direct measure of meaning, quality, or human effort. Nor does it necessarily equal a character or a word: the relationship depends on the text and the tokenizer.
Token, word, and character
These units describe different aspects of text. How a tokenizer splits a word can vary from one model to another.
| Unit | What it represents | Illustrative example |
|---|---|---|
| Character | An individual letter, number, or symbol | The letters in “house” |
| Word | A linguistic unit usually separated by spaces in writing | “house” |
| Token | A fragment defined by the model’s tokenizer | “house” could be one token or split into fragments |
How tokenization works
Tokenization turns text into fragments that a model can process. First, a tokenizer splits the input according to rules associated with the model. Then each fragment is linked to an identifier (ID) in the corresponding vocabulary. The model uses these identifiers in its calculations; internal numerical representations, such as embeddings, are involved in processing the sequence.
Subword methods include Byte Pair Encoding (BPE) and WordPiece. These methods can represent frequent words as whole units and split less common words into reusable fragments. As a result, a new word or typo does not necessarily fall outside the vocabulary: the tokenizer may represent it using available units. The exact sequence depends on the tokenizer, so two models can split the same text differently.
From text to generated output
This simplified flow shows what each component does. Implementation details vary by model.
- 01The tokenizer splits text into units according to its rules.
- 02Each unit is converted into an ID in the model’s vocabulary.
- 03The model processes the sequence of IDs using its internal representations.
- 04During generation, the model calculates a probability distribution for the next token.
- 05Generation continues by adding tokens until the response ends or a configured limit is reached.
Examples across languages, code, and conversations
Token counts cannot be inferred simply by counting words or characters. They depend on the language, writing system, tokenizer vocabulary, and content. A rough characters-per-token rule may provide an initial estimate, but it cannot replace a count made with the tokenizer for the model being used.
A translated sentence can produce different token counts in different languages. Some tokenizers represent certain English texts with fewer units than their equivalents in other languages, but no single percentage applies to every model and sentence. Code counts are also affected by syntax, whitespace, and symbols. A code block may require more tokens than a visually similar length of prose; the exact count must be measured using the relevant system.
What can change the count
Visible text alone is not enough to calculate token use. The model’s counter provides a more reliable measure for each case.
| Situation | What can affect the count | Practical check |
|---|---|---|
| Text in different languages | Words, diacritics, and character sequences represented differently by the vocabulary | Count each version with the chosen model’s tokenizer |
| Source code | Names, operators, indentation, and programming-language structure | Measure the actual code block that will be sent |
| Long conversation | Instructions and earlier messages that the application includes again | Check which parts of the conversation are sent with each request |
Context window, cost, and performance
The context window sets how many tokens a model can process in an interaction, subject to the limits of that model and service. The budget may include instructions, messages, documents, or other input, as well as space reserved for generating the response. Some applications truncate or summarize content when a limit is exceeded; others may reject the request. The exact behavior depends on the implementation.
Some services set prices based on input and output tokens and may charge different rates for each category. The amount sent, response length, and provider’s terms determine the cost; token count alone is not enough to calculate it without the applicable rates. Generating a response token by token can also affect generation time, but token count by itself does not allow a reliable comparison of the speed of different models.
Review a request’s token budget
This process can help identify what takes up context and what may be billed when a service charges by token.
- 01Identify the model and its input and output limits.
- 02Gather the instructions, current message, and documents the application will send.
- 03Check whether earlier conversation history is included again and which parts are retained.
- 04Count the input and estimate the output using tools compatible with the model.
- 05Apply the service’s current rates and review the recorded usage after the request.
Common mistakes and practical criteria
A common mistake is to assume that one word equals one token. This approximation can distort a budget, especially for technical text, uncommon names, or languages different from the one used to make the estimate. Spaces and punctuation are also part of the text processed by the tokenizer, so visible length is not a reliable way to determine the count.
Another mistake is treating the context window as permanent memory or assuming that reducing tokens automatically improves a response. Shortening instructions or conversation history may reduce usage in some systems, but it can also remove necessary information. Before reducing context, check that the task still receives the relevant data and that the result meets the intended evaluation criteria.
Usage and evaluation decisions
Token counts help manage limits and, where applicable, costs. They do not replace an assessment of a response’s usefulness or quality.
| Decision | Useful check | Limit of the conclusion |
|---|---|---|
| Estimate usage | Use the counter for the selected model’s tokenizer | A general rule cannot precisely predict counts for other models or texts |
| Reduce conversation history | Compare what information is retained and what is removed | Fewer tokens do not guarantee a better response |
| Compare costs | Check current counts and input and output rates | Token count alone does not determine total cost |
| Evaluate a response | Measure quality using criteria specific to the task | Token use is not a direct measure of accuracy or value |
Methods, uses, and frequently asked questions
A tokenizer is a component that splits text and assigns its units identifiers from a vocabulary. BPE and WordPiece are subword methods; they are not interchangeable names for every tokenizer, nor do they imply that two systems will produce the same segmentation. Vocabularies and rules depend on the model and its configuration.
Tokenization is also used beyond text generation. In search and language processing, a system may split documents into units for indexing or analysis; in those cases, tokenization and subsequent filters do not necessarily match an LLM’s tokenizer. The word “token” is also used in authentication and blockchain for different concepts. For a specific task, use the method and counter of the system that will actually be used.
Quick questions
These answers summarize the main distinctions without assuming that all providers use the same technical or commercial rules.
| Question | Answer |
|---|---|
| Is a token always a word? | No. It may be a word, part of a word, or another fragment defined by the tokenizer. |
| Do all models count the same way? | Not necessarily. The result depends on the tokenizer and the text. |
| Does a token measure quality? | No. The count describes segmentation and usage, not the response’s accuracy or usefulness. |
| Do all services charge by token? | No. Terms depend on the product; some services use quotas or other limits. |