How models learn
You do not need to be a mathematician. You need to understand what happens when you type a prompt — from words to numbers to meaning.
This lesson walks through the pipeline step by step: words become numbers, numbers capture meaning, and the model uses that meaning to generate a response. Every concept here connects to something you will do when you write prompts.
Words as numbers
Each word gets turned into a list of numbers called an embedding. The numbers encode meaning, not just spelling.
When you type a prompt, the model does not read words. It converts each token — roughly a word or word-piece — into a vector: a list of numbers that represents its meaning.
Each is a number. A typical model uses hundreds or thousands of dimensions — far more than we can picture, but the principle is the same as placing a pin on a map.
The key insight: words with similar meanings get similar numbers. “Dog” and “puppy” end up close together. “Dog” and “spreadsheet” are far apart. The model learns these positions during training — nobody hand-codes them.
Similarity as closeness
Words that mean similar things end up near each other in this space. We measure closeness with cosine similarity.
If two vectors point in nearly the same direction, their meanings are related. The technical name is cosine similarity: it measures the angle between two vectors.
Close to 1 means very similar. Close to 0 means unrelated. You never need to compute this yourself — the model does it billions of times during training and inference.
The diagram above shows how embeddings power retrieval: your query becomes a vector, the system finds the nearest stored vectors, and those retrieved passages become context for the language model's response.
Latent space — the learned map of meaning
Think of it as a map the model builds during training. Every word, sentence, and concept gets a location.

The space of all embeddings forms what researchers call a latent space. “Latent” means hidden — these dimensions are not visible to us, but the model uses them constantly.
Neighboring regions in latent space capture related ideas. Move in one direction and the tone shifts from formal to casual. Move in another and the topic shifts from cooking to chemistry. The model navigates this space every time it generates a word.
When you write a clear, specific prompt, you are giving the model better coordinates. Vague prompts land in a crowded region of latent space where many possible responses overlap. Specific prompts point to a smaller, more useful neighborhood.
The pipeline: token → representation → attention → output
Here is what happens inside the model when you type a prompt.

- 1. Tokenization. Your text is split into tokens — roughly words or word-pieces. Each token gets an ID.
- 2. Embedding lookup. Each token ID is converted to a vector (the embedding). Now the model has numbers instead of text.
- 3. Self-attention. The model looks at every token in relation to every other token. This is the “attention” in “Attention Is All You Need.” It lets the model understand context — what “it” refers to, which words modify which.
- 4. Feed-forward layers. The contextualized representations pass through dense layers that transform and combine information.
- 5. Output prediction. The model predicts the next most likely token. Then it feeds that prediction back in and repeats — one token at a time — until the response is complete.
This entire pipeline runs in the Transformer architecture — the same design behind GPT, Claude, Gemini, and every modern foundation model. The details vary, but the pattern is always: tokenize, embed, attend, predict.
Why this matters for your work
Understanding the pipeline helps you write better prompts and evaluate model output more clearly.
When you write a clear prompt, you are giving the model better coordinates to work with. When the model hallucinates, it is because it landed in a region of latent space where plausible- sounding text exists but truth does not.
You do not need to understand the math to use these tools well. But knowing that the model works with learned representations — not understanding — helps you stay honest about what it can and cannot do.
Now you know how models turn words into meaning and meaning into responses. Next, meet the people who built these systems — and understand why their choices shaped the tools you use today.
Continue to Lesson 3 →