SevyDevy

Module 2 · How a language model thinks · Lesson 5 of 32

Tokens: how AI reads your words

10 minFree GenAI course · BeginnerLesson 2.1By Saket Bhatnagar

Researched and drafted with AI, reviewed and edited by Saket Bhatnagar.

In short

  • AI does not read words or letters. It reads small pieces of text called tokens.
  • Each token is swapped for an ID number, and the model only ever works with those numbers.
  • You pay and wait per token, so the same message can cost more in Hindi or in code.
Soon

Video lesson · coming soon

What are tokens in AI? Explained in 3 minutes

Lala, your AI mentor, will walk you through this lesson in a short animated video. Until then, everything is here to read and try.

  1. 01 Telegrams charged by the word
  2. 02 A chai stall’s shorthand
  3. 03 Words become numbers
  4. 04 Watch a sentence get cut up
  5. 05 Why Hindi can cost more
  6. 06 The strawberry puzzle
  7. 07 Try the tokenizer yourself

In 1985, Arjun’s grandfather sent a telegram home from Kanpur: “REACHED SAFELY STOP SEND MONEY STOP”. Every word cost money, so nobody wrote “Dear Amma, I hope this finds you well.”

Forty years later, Arjun builds a small AI helper for his college fest. The bill arrives in a strange unit. Not words. Not letters. Tokens. By the end of this lesson, you’ll know exactly what that unit is, and why it explains some of AI’s oddest habits.

What is a token?

In module 1 you saw that a model learns patterns from huge numbers of examples. But a computer cannot learn from letters on a screen. It only does maths. So before any learning or answering, your text has to become numbers.

The first step is cutting the text into pieces. The pieces are not always whole words, and they are not single letters either. They sit somewhere in between.

A short, common word like “the” or “love” is usually one token. A long or rare word like “unbelievable” may be cut into pieces such as “un”, “believ” and “able”. An exclamation mark is usually a token of its own.

How does text become numbers?

Every token in the list has an ID number, the way every train in India has its own five-digit number. The tokenizer looks up each piece and swaps it for its ID. From then on, the model sees only a row of numbers.

From your words to the model and back

Text is cut into tokens, tokens become ID numbers, the model works on numbers, and new IDs are turned back into text for you.

Diagram connections:

  • Your text to Tokenizer (cut)
  • Tokenizer to Token IDs (look up)
  • Token IDs to Model (read)
  • Model to Back to text (new IDs)
  • Your text: For example: “I love masala chai!”
  • Tokenizer: Cuts the text into pieces from its fixed list.
  • Token IDs: A row of numbers, one number per token.
  • Model: Works only with numbers and predicts the next token ID.
  • Back to text: The new IDs are looked up again and shown as readable words.

Modern models use vocabularies of roughly thirty thousand to a few hundred thousand tokens. The list is chosen once, before training, and then it stays fixed for that model.

How is the list chosen? A popular method starts with tiny pieces, like single characters. It then scans a mountain of text and glues together the pair that appears most often. “t” and “h” become “th”. Later, “th” and “e” become “the”. After many thousands of merges, common words are single pieces and rare words stay in parts.

That is Ramesh’s order book again. Frequent orders earned a mark. Frequent letter pairs earned a token. And because the smallest pieces are always in the list, any text at all can still be written down, even a word nobody has seen before.

Try it: watch a sentence get cut up

The box below starts with “I love masala chai! ☕”. Each coloured chip is one token. A small ␣ mark shows where a token carries a space. Under the box you’ll see how many tokens there are and how many characters each token holds on average. You’ll also see a rough rupee cost for a million such messages, at an example price.

Try it yourselfYour own tokenizerType anything, or tap the English, Hindi, long words, code and emoji examples, and watch the token count change.
  • Tap English. Each common word is one token, the “!” is its own token, and the cup emoji takes two.
  • Tap Hindi. A sentence of similar meaning needs almost twice as many tokens here.
  • Tap “Long words”. Watch a long word like “internationalization” break into several pieces.
  • Tap Code. Symbols like “=” and “*” become tokens of their own.
  • Tap Emoji. One small picture often takes more than one token.
  • Turn on “Show as numbers” to see the row of IDs the model actually receives.
  • Type your own name. Common names may be one token; unusual spellings break into pieces.

Here is a handy rule of thumb for English. One token is roughly four characters, or about three quarters of a word. So a hundred tokens is roughly seventy-five words, and a one-page essay of five hundred words is roughly six or seven hundred tokens.

Why tokens matter for cost, speed and language

Tokens are AI’s meter, like the meter in an auto-rickshaw. Companies that offer AI models charge a price per million tokens. They count the tokens you send in and the tokens that come back, and output tokens usually cost more than input tokens.

Prices vary a lot. Depending on the model, a million tokens can cost anywhere from a few rupees to a few thousand rupees. One message is tiny, but an app with thousands of users sends millions of tokens a day.

Tokens also set the speed. As you’ll see in the next lesson, the model writes one token at a time. A longer answer means more tokens, and more tokens mean more waiting. And every model can only look at a limited number of tokens at once. You’ll meet that limit, the context window, later in this module.

Roughly how different kinds of text turn into tokens
Kind of textWhat usually happensWhy it matters
Common English wordsOne token each, often with the space in frontCheapest and fastest
Rare or long wordsSplit into two to four piecesSpelling games and rhymes get harder
Hindi, Tamil and other Indian languagesOften more tokens for the same meaningThe same message can cost more and fill the limit faster
CodeSymbols, brackets and spaces become many tokensCode is token-hungry
Long numbersCut into chunks of a few digitsOne reason exact maths can be shaky
EmojiOne to several tokens eachSmall on screen, not always small in tokens

Why do Indian languages often cost more? A tokenizer learns its pieces from text, and most of that text has been English. Hindi and Tamil words were seen less often, so fewer of them earned a single token. Newer tokenizers have narrowed the gap a lot, but a Hindi sentence still often needs more tokens than its English twin.

Tokens explain AI’s strange mistakes

Ask an AI how many times the letter “r” appears in “strawberry”, and for a long time many models said two. Why would a clever system miss something a child can count?

Because the model never saw the letters. It saw something like “str”, “aw” and “berry” as three ID numbers. Asking it to count letters is like asking Ramesh bhaiya how many letters are in his mark “AD”. He knows it means adrak chai, but the mark itself does not show the spelling.

The same root cause trips models on rhymes, reversing a word, and exact sums with long numbers. Newer models handle many of these better, often by working step by step or by using a calculator tool. The underlying reason stays the same: the model thinks in tokens.

Check yourself

Check yourself

Roughly how many tokens is a 750-word English article?

Pick an answer to see why it is right or wrong.

Check yourself

Priya’s app replies in both Hindi and English. The Hindi replies cost more. What is the most likely reason?

Pick an answer to see why it is right or wrong.

Check yourself

Why can a chat model struggle to count the letters in a word?

Pick an answer to see why it is right or wrong.

Remember these three

  1. A token is a small piece of text; AI reads and writes in tokens, not words or letters.
  2. Each token becomes an ID number from a fixed vocabulary, and the model only sees those numbers.
  3. Tokens are the meter for cost, speed and limits, so Hindi, code and long numbers can cost more.

Questions people ask

What are tokens in AI?
Tokens are the small pieces of text an AI model reads and writes. A token can be a whole common word, part of a longer word, or a punctuation mark. Each token is turned into a number before the model works with it.
How many words is 1,000 tokens?
In English, 1,000 tokens is roughly 750 words, because one token is about three quarters of a word. Hindi, other Indian languages and code usually fit fewer words into the same number of tokens.
Is a token the same as a word?
Not always. Short, common words are often one token, but long or rare words are split into several tokens, and punctuation marks and emoji can be tokens too. That is why token counts are usually higher than word counts.
Why do AI apps charge per token?
The work a model does grows with the number of tokens it reads and writes, so tokens are a fair way to measure use. Prices are quoted per million tokens, and output tokens usually cost more than input tokens.