Glossary term
Glossary term
Foundations
Text unit processed by a language model.
In a language model, the atomic unit that the model is training on and making predictions on. A token is typically one of the following:
a word—for example, the phrase "dogs like cats" consists of three word tokens: "dogs", "like", and "cats".
a character—for example, the phrase "bike fish" consists of nine character tokens. (Note that the blank space counts as one of the tokens.)
subwords—in which a single word can be a single token or multiple tokens. A subword consists of a root word, a prefix, or a suffix. For example, a language model that uses subwords as tokens might view the word "dogs" as two tokens (the root word "dog" and the plural suffix "s"). That same language model might view the single word "taller" as two subwords (the root word "tall" and the suffix "er").
In domains outside of language models, tokens can represent other kinds of atomic units. For example, in computer vision, a token might be a subset of an image.
See Large language models in Machine Learning Crash Course for more information.
OpenAI GPT-4o charges $5 per 1M input tokens; a company processing 10,000 customer support tickets per day (avg 500 tokens each) calculates a daily cost of $25 and builds a monthly budget forecast accordingly.
GitHub Copilot measures token consumption per developer seat; engineering leaders track token spend per merged PR to understand the ROI of AI-assisted code review.
Anthropic Claude 3.5 Sonnet handles a 100,000-token context window, allowing a legal team to submit an entire 200-page contract and receive a clause-by-clause risk summary in a single API call.
Created for this library
An NLP team tracks token counts during training so it can plan dataset size and training compute accurately.
An LLM product team measures token consumption per feature for cost forecasting at each customer's expected usage.
A SaaS team optimizes prompts to reduce token count per call without losing quality before negotiating a new contract.
Definition source: Google for Developers Machine Learning Glossary | Creative Commons Attribution 4.0 License