Back to Home
Inside a Transformer
🟢 Beginner · 7–10 min

How a Transformer Reads Text

A transformer does not read text the way people do. It breaks your sentence into small pieces, turns them into numbers, and then looks at all the pieces together.

This is a simple learning demo. The tokens and numbers below are simplified examples to build intuition, not real model output.

Start here
When you type a sentence, how does a transformer read it?

Type a sentence and press the button. Watch what happens before the transformer can do anything clever.

Interactive playground

Watch a transformer read your sentence

Pick an example or type your own sentence, then move through each stage one step at a time. Each step reveals what happens and why.

What happens next?

The text is ready, now what?

Now the transformer has tokens. Next it needs to know:

  • Which word came first?
  • Which word came next?
  • Does word order change the meaning?
Next up: Word Order & Positional Encoding
🔑
Key takeaways
  • • Transformers do not read text like humans do.
  • • Text is split into tokens.
  • • Tokens become numbers.
  • • Numbers become internal representations.
  • • The transformer processes tokens together.
  • • This prepares the text for attention and deeper understanding.
Summary

A transformer reads text by converting it into tokens, numbers, and internal representations. Once the text is prepared, the model can start understanding relationships between words.