Token

BytapaScript

BeginnerLLM Concepts
In a nutshell

A small chunk of text a model processes — a word or part of a word.

What it means

A small piece of text that an AI model processes; it may be a word, part of a word or punctuation.

💡 Cutting a sentence into small Lego blocks before assembling and understanding it.

Code example

import tiktoken
enc = tiktoken.encoding_for_model("gpt-4o")
tokens = enc.encode("What is a token?")
print(len(tokens))   # e.g. 5 tokens

Why it matters

Token usage affects API costs, context limits and processing time.

Common misconception

Tokens are not words — a single word can be split into several tokens.

Further reading

Related terms

Learn Full Stack

with tapaScript

By clicking Sign Up you re confirming that you agree with our Terms and Conditions.

newsletter

Don't forget to connect with us on