PromptItIn logoPromptItIn
AI glossary · Technical

Tokenisation

The process of splitting text into tokens using a vocabulary and encoding algorithm like BPE.

PromptItIn team

A bookshelf with one card pulled out

What it means

Tokenisation converts raw text into a sequence of integer IDs that the model can process. Byte Pair Encoding (BPE), used by GPT models, starts with individual bytes and iteratively merges the most frequent adjacent pairs to build a vocabulary of ~50k–128k subword tokens.

WordPiece (BERT) and SentencePiece (T5, Llama) are alternative algorithms. Tokenisation is language- and model-specific: the same text tokenises differently depending on the model, affecting cost, context length, and edge cases.

Poorly tokenised inputs (unusual Unicode, code with rare symbols, numbers) can lead to worse model performance because the model sees rare token sequences it encountered infrequently during training.

Examples

  • The number '1234567890' tokenising to ['12', '345', '678', '90'] — 4 tokens — making arithmetic harder for models than it would be for humans who perceive it as one number.
  • Chinese text tokenising into more tokens per character than English, increasing API cost for Chinese-language applications.

Token

The basic unit of text a language model processes, roughly corresponding to a word or word fragment.

Embedding

A dense numerical vector that represents a token, sentence, or document in a continuous semantic space.

Context Length

The maximum number of tokens a model can handle in a single forward pass.

Put this into practice

PromptItIn applies techniques like tokenisation for you: describe what you want and it builds the prompt.

Try PromptItIn freeAdd to Chrome, free

You might also like

Data Analysis Prompts →AI Token Counter →ChatGPT Custom Instructions Generator →Controlling Output Format in AI Prompts →Prompt Chaining for Complex Tasks →Synthesia →
← Browse the AI prompt glossary