Bookmarks

Language model token

A chunk of text that the tokenizer splits the input and output of a language model into; context, limits and API pricing are measured in tokens.

Also: LLM token, model token

checked 9 Nov

All terms

The model does not read text as a whole: before processing, the tokenizer splits it into tokens — the indivisible chunks that both the prompt and the answer are made of. The number of tokens determines what fits into the context window, how much a request costs and how fast the answer is generated.

How text becomes tokens

The tokenizer splits text into subwords — chunks smaller or larger than a word: frequent character combinations are stored in the model’s vocabulary as a single token, while rare ones are broken into pieces. Each model has its own vocabulary, and training and inference happen only within it; most often the vocabulary is built with the BPE algorithm (byte pair encoding).

TextHow it is usually split into tokensWhy
a frequent short word1 tokenit is in the vocabulary as a whole
a rare or long word2–4 tokensthe vocabulary holds not every word but frequent chunks
numbers, URLs, codemany tokenssuch sequences are broken into small pieces
spaces and punctuationseparate tokens or part of a wordthe space is attached to the next word

How to count tokens

For English text, one token is on average about four characters or 0.75 of a word, so 100 tokens is roughly 75 words. The ratio differs for other languages: text in a language other than English usually produces more tokens in models trained mostly on English than the same text in English. Estimates by words and characters are rule-of-thumb, and the exact count is given by the tokenizer of the specific model — for OpenAI models it is the tiktoken library, other models have their own tools.

Where tokens appear in practice

  • context window: the model’s limit is set in tokens — how much prompt and answer it takes in at a time
  • API pricing: the rate is quoted per million tokens, separately for input and output
  • provider limits: alongside requests per minute, tokens per minute are limited too
  • inference metrics: time to first token (TTFT) and throughput in tokens per second

A token is not a word

A token is neither a word nor a character: it may be a whole word, part of a word, a punctuation mark or a space. So a “1000 tokens” label does not mean “1000 words”, and the cost of a request cannot be converted by dividing the price by the number of words. Inside the model, a token is a number in the vocabulary that is turned into a vector (an embedding); it is these vectors that the model processes.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • access token

    An access token is a string with which a client proves its right to call an API; do not confuse it with language models: it does not split any text.

In depth in the references

where the topic is covered in detail

Appears in the references