Token – explained simply
A token is a small piece of text, often a word part, into which a language model breaks text before processing it.
Also: Tokens, Tokenizer, Tokenization
Language models don’t read letters or whole words, but tokens. Common words are usually a single token, while rare ones are broken into pieces. The Hugging Face documentation gives annoyingly as an example, which can be split into annoying and ly.
Tokens are the unit of measurement for almost everything in language models: context length, speed, and in cloud services, the price too. German texts often need more tokens than English texts of the same length because many tokenizers are trained mostly on English and split long compound words.
Related terms
Errors where that matters
- llama-server: the request exceeds the available context size, try increasing it (request longer than the context length)
- LM Studio: Trying to keep the first … tokens when context the overflows (Input is longer than the configured context length)
- vLLM: The model's max seq len is larger than the maximum number of tokens that can be stored in KV cache / No available memory for the cache blocks (context does not fit in the VRAM)
- WhisperX: Could not download 'pyannote/speaker-diarization…' pipeline / 'NoneType' object has no attribute 'to' (speaker diarization must not load the model)