AI Foundations

What Are Tokens in AI?

Tokens are the text units a language model processes and generates. A token may be a word, part of a word, punctuation or another encoded text unit.

A tokenizer maps input text to token IDs. The model processes those IDs, and limits on context length and output length are generally measured in tokens rather than words.

Two practical examples

Example 1. A long technical document can consume many tokens even when it has relatively few pages.

Example 2. A code snippet may use more tokens than a similarly sized paragraph.

What to check in practice

  • Identify the exact device, software version or service involved before changing a setting.
  • Record the current configuration so you can reverse a change that causes problems.
  • Test one variable at a time and confirm the result using reliable measurements or logs.
  • Use the official documentation for model-specific limits, compatibility and safety requirements.
Important consideration

Token counts vary by language, formatting and tokenizer. Do not assume one token always equals one word or one character.

Common question

What is the first thing to do? Start by identifying the exact use case and the system involved. Then verify the relevant settings or measurements before making changes. A general explanation is a starting point, not a substitute for checking your own environment.

TryHook publishes independent educational explainers. Product names and technical standards belong to their respective owners. Some pages may eventually contain clearly disclosed affiliate links; editorial explanations are not paid endorsements.

Explore more in AI Foundations

Continue with related beginner-friendly guides.

AI vs Machine Learning vs Deep LearningRead guideWhat Is a Large Language Model?Read guide