Glossary · AI/ML

Token

Also known as: tokens, tokenization, context window

The unit of text an LLM reads and writes, usually a word or part of a word. Pricing, speed, and context limits are all measured in tokens.

Why it matters

  • Cost: hosted APIs bill per input and output token.
  • Context window: the maximum number of tokens (prompt + answer) a model can handle in one call.
  • Latency: models generate output one token at a time, so long answers take longer.

Rule of thumb

For English text, one token is roughly four characters or about three quarters of a word. Code and non-English text usually use more tokens per word.

Example

"Spring Boot is great"  →  ["Spring", " Boot", " is", " great"]   (4 tokens)

Exact splits depend on the model’s tokenizer.

See also

Related technologies

Used in these posts

AI/ML • 10 min read Reader level: Advanced

What you'll learn

  • How AI Copilot Optimizer cuts tokens and latency on large Java codebases
  • The architecture: sanitization, cache reuse, and similarity search
  • How to set it up locally with Ollama, secure secrets, and a .env file
  • How to troubleshoot the most common setup errors
Optimizing AI Coding Assistants for Large Java Applications

Learn how AI Copilot Optimizer cuts token usage and latency for large Java codebases through sanitization, cache reuse, and similarity search.

#ai-coding-assistant#java#token-optimization#fastapi