Token

Definition

The basic unit of text processed by AI language models, typically representing words, word parts, or punctuation, crucial for understanding language.

Use Cases

Frequently Asked Questions

What's the difference between a token and a word in AI?
A word is a human language unit, but a token is what the model actually reads. Tokens can be whole words, parts of words (like prefixes/suffixes), punctuation, or even whitespace depending on the tokenizer. For example, “unhappiness” might be split into multiple tokens, and “hello!” might be two tokens (“hello” and “!”).
When do I need to think about tokens when using an LLM?
Think about tokens whenever you design prompts, process long documents, or manage cost and latency. Tokens matter for (1) context window limits (prompt + output must fit), (2) performance (more tokens usually means slower responses), and (3) pricing/quotas (many APIs charge per input and output token).
How much do tokens cost?
Tokens don’t have an inherent cost by themselves; cost depends on the specific model/API you use. Many LLM providers price separately for input tokens (your prompt) and output tokens (the model’s response). Total cost is influenced by model choice, total tokens processed, and features like larger context windows. Always check the pricing page for your chosen model and estimate usage by measuring average prompt and response token counts.

Category: ai-ml

Difficulty: intermediate

Related Terms

See Also