Episode 0 — What Is a Transformer?
Episode 0 — What Is a Transformer?
Imagine you ask ChatGPT a question. Within a few seconds, it understands your sentence, reasons about it, and generates a meaningful response. The engine that makes this possible is called a Transformer. A transformer is a neural network architecture designed to process sequences such as text. Its purpose is simple: it receives a sequence of words, understands the relationships between those words, and produces another sequence as output. But the transformer never works directly with words. Every sentence first passes through a series of transformations. The words are broken into smaller pieces called tokens. Those tokens are converted into vectors, which are mathematical representations that a computer can process. The transformer then examines how every vector relates to every other vector in the sentence. It strengthens important relationships, weakens less important ones, and gradually builds a rich understanding of the entire context. Finally, using this understanding, it predicts the most appropriate next token. That prediction becomes the next word. The process repeats again and again until a complete response is generated. At a high level, every transformer follows the same journey. Sentence. ↓ Tokens. ↓ Vectors. ↓ Attention. ↓ Context. ↓ Prediction. ↓ Generated Text. In this series, we will open every one of these stages and understand exactly how it works. We'll begin with the most fundamental question of all. Why do transformers think in vectors instead of words?