Embeddings: learn a geometry, question its meaning
Trace a lookup, compare directions, and test what a similarity score can support.
Preparation: Coordinates, multiplication and square roots.
Plan 20–35 minutes with the activities; this is a study estimate, not a timed requirement. Both paths have complete narration. Your notes and progress are kept separately for each level.
FULL LOCAL NARRATION
Follow the complete explanation.
Narration includes worked solutions. Pause at each practice prompt before continuing. Formula notation has a spoken explanation; all teaching text remains readable.
College path. Trace a lookup, compare directions, and test what a similarity score can support.
Preparation: Coordinates, multiplication and square roots. Work through one section at a time. Predict the experiment result before changing its controls, then explain what the example leaves out.
An embedding table has vocabulary size by feature width entries. Lookup selects rows, equivalently multiplying a one-hot vector by the table. Token IDs are categorical. The learned geometry depends on the training objective and data; semantic proximity is a tendency to evaluate, not an invariant of all embeddings.
Worked step 1. Use table rows [1,0], [0,2], [1,1].
Worked step 2. IDs [2,0,2] retrieve [1,1], [1,0], [1,1].
Try it yourself. How many output vectors do three IDs produce?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. Three, each with two coordinates. Repeated IDs retrieve the same initial row; later contextual layers can produce different representations.
Section 02 / 07
Length and direction answer different questions
For nonzero vectors, cosine equals the dot product divided by the product of Euclidean norms. It is invariant to positive rescaling, unlike the dot product. A zero vector has no defined cosine direction; software must choose an explicit handling policy rather than silently treating it as an ordinary comparison.
cos(u,v) = (u·v)/(‖u‖‖v‖)
Worked step 1. Take u=[1,0], v=[1,1].
Worked step 2. Dot product is 1; lengths are 1 and square root of 2.
Worked step 3. Cosine is about 0.707.
Try it yourself. What happens if v becomes [2,2]?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. The dot product doubles to 2. Its length also doubles, leaving cosine about 0.707. Negative rescaling would reverse direction.
Section 03 / 07
Repeated lookups accumulate learning
The backward operation scatters output gradients into selected table rows and sums repeated indices. With tied input and output embeddings, the output softmax also contributes gradients. Weight decay and optimizer state further complicate the claim that an unselected row never changes. Separate the lookup Jacobian from the complete optimizer update.
Worked step 1. IDs [2,0,2] receive gradients [1,2], [3,4], [5,6].
Worked step 3. Row 1 receives [0,0] from this lookup.
Try it yourself. Why average the repeated requests instead of adding them?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. Do not average at the lookup operation. Any batch averaging belongs to the chosen loss reduction and is already reflected in its gradients.
Section 04 / 07
Order must enter somewhere
Unmasked self-attention without positional information is permutation equivariant. Absolute position vectors, relative biases and rotary transformations introduce order differently. A causal mask also introduces ordering constraints, so claims about complete order blindness must state masking assumptions. Rotary embeddings transform queries and keys; they are not simply an extra token embedding.
Worked step 1. Compare dog bites person with person bites dog.
Worked step 2. Keep the word vectors fixed.
Worked step 3. Change the positions and observe that the intended roles change.
Try it yourself. Can a bag of these three word vectors distinguish the two sentences?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. A bag discards order. A sequence model needs ordering information through positions, masks or another sequential mechanism.
Section 05 / 07
Predict a turn, then measure it
Use the controlled two-dimensional fixture to separate algebraic invariance from empirical representation quality. Hold the reference vector fixed, vary one coordinate, and compare cosine with norms and dot product. A real embedding evaluation needs a task, a data split, and a policy for normalization and zero vectors.
Worked step 1. Start with reference [1,0] and test [1,1].
Worked step 2. Increase the second coordinate to 2.
Worked step 3. Cosine becomes 1 divided by square root of 5, about 0.447.
Try it yourself. Did the second vector become shorter?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. It became longer and turned farther from the reference. Lower cosine here reflects direction, not less stored information.
Section 06 / 07
Similarity is a claim to test
Static token embeddings and contextual hidden states have different semantics. Geometry may be anisotropic and domain dependent. Evaluate retrieval relevance, robustness and subgroup coverage on held-out queries; do not interpret an arbitrary axis or a two-dimensional projection as a faithful explanation of the model. Record the encoder revision and pooling method.
Worked step 1. Create ten questions with known supporting passages.
Worked step 2. Retrieve candidates and mark actual support.
Worked step 3. Inspect a near neighbor that contradicts the query.
Try it yourself. Does a high cosine score verify a factual answer?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. It is a representation-based similarity score. Verification requires checking whether the retrieved content actually supports the claim.
Section 07 / 07
Mastery and transfer
Bring the pieces together. First answer the checkpoint without the worked solutions. Then explain the mechanism in your own words, using one numerical example from this lesson.
Which comparison removes positive length scaling? Option 1: Dot product alone. Option 2: Cosine between nonzero vectors. Option 3: Token ID difference.
Pause here and choose an answer before continuing. The checkpoint explanation follows.
Reveal worked solution
The correct choice is option 2: Cosine between nonzero vectors. Cosine normalizes both lengths; it still does not establish factual agreement.
Transfer task. Change one assumption in the worked example. State your prediction, calculate or test it in Workbench, then explain whether the result supports your prediction.
Reveal worked solution
Self-check rubric. Name the changed assumption, keep the other inputs fixed, show at least one intermediate calculation, and distinguish what the toy example guarantees from what would require a trained model or a real measurement.
WORKBENCH / PREDICT → TEST → EXPLAIN
Inspect exact numerical data
These are computed teaching fixtures. No remote AI model or GPU is called by the experiment.
CHECK YOUR UNDERSTANDING
Commit to an explanation.
Keep your learning record.
Sources and scope
Original worked examples and teaching text, grounded in these primary references. Numerical fixtures explain mechanisms; model quality and hardware performance require separate measurements. Both levels share key examples, with different explanations and checkpoints.
What a model learns: from numbers to a useful answer
Follow a sentence through learned weights, temporary activations, and the next-token decision.
Additional reading · original lesson audio remains unchanged.
Read the full explanation · 586 words + college extension
What changes when you ask a question?
23input x
×
0.6−0.2learned weights
+
0.1bias
=
0.7output y
The weights stay fixed during ordinary inference. Activations change with your input.
Text → tokens
Tokens → vectors
Learned transformations
Next-token scores
Text → tokens
A model is a computation with learned settings
A language model does not contain a little librarian choosing a finished answer from a shelf. It contains a structured computation whose numerical settings were learned during training. Those settings are called parameters. Many are weights arranged in matrices; other parameters can include offsets or normalization scales. The architecture determines which operations happen and how information travels. The weights determine the particular transformations performed by those operations. Two models can share an architecture and behave differently because they learned different parameter values.
Consider a tiny operation: y = 0.6x₁ − 0.2x₂ + 0.1. With inputs x₁ = 2 and x₂ = 3, the output is 0.7. Changing the first weight from 0.6 to 0.5 changes the output to 0.5. This is a teaching example, not a miniature intelligent system. Its purpose is to make one idea visible: numerical settings influence the result. In a language model, many such transformations act together across large vectors, nonlinear functions, and layers.
Follow the sentence
First, a tokenizer turns text into a sequence of token identifiers. A token may represent a word, part of a word, punctuation, or another unit. An embedding table supplies a learned vector for each identifier. These vectors are starting representations, not complete dictionary definitions. As they pass through the network, surrounding tokens influence how the current sequence is represented.
In attention, learned projections produce queries, keys, and values. The model compares queries with keys to calculate input-dependent attention scores, then combines value representations. This distinction matters: the projection weights normally remain fixed during a conversation, while the attention scores change with the input. Feed-forward transformations further process the representations, and residual connections carry information around sublayers. Finally, an output transformation supplies scores for possible next tokens. A selection procedure chooses a continuation, which becomes part of the next input step.
Training changes the settings; a conversation changes the state
During training, a loss measures how the predictions compare with the training objective. Gradients estimate how parameter changes would affect that loss. An optimizer uses those gradients to update trainable parameters. A single example does not usually teach an isolated fact to one identifiable weight. Useful patterns emerge through many updates, and knowledge and behavior are distributed across the computation.
During ordinary inference, the parameters stay fixed. Your prompt changes the activations: the temporary numbers produced while the model runs. A cache can retain intermediate information so the system need not repeat earlier work. That cache is not a new permanent education for the model. A product may separately save conversation history or conduct later training, but those are additional mechanisms. Saying that a chatbot remembers your previous sentence does not establish that its weights changed.
Why more parameters is not a complete explanation
A parameter count describes scale, not a guarantee of reliability. Data quality, architecture, training, numerical precision, and the way a model is evaluated all matter. A large model can produce a convincing error; a smaller specialized model can perform a narrow task well. To compare systems, ask what task was tested and under what conditions, rather than treating one number as a universal intelligence score.
Return to the animation and identify three different objects: a stored weight, an activation that changes with the sentence, and an output score. If the diagram uses moving dots, those dots represent information flow; they are not literal particles inside a model. Using the small equation above on paper, change an input while keeping a weight fixed, then change the weight while keeping the input fixed. Explain why these are different experiments. That distinction will help you understand fine-tuning, quantization, caches, and model releases throughout the course.
College extension · make the assumptions explicit
For a linear layer, write y = Wx + b. If W has shape m × n, x has n entries and y has m entries. During backpropagation, the chain rule relates a loss gradient at y to gradients at W and x. During inference, the same forward transformation can execute without constructing those training gradients. In attention, WQ, WK and WV are parameters; QKᵀ and its normalized scores are functions of the current activations. Keeping these categories separate prevents a common mistake: interpreting an attention heat map as a direct picture of stored model weights.
Sources and further investigation
Source review: October 28, 2026. Model-release claims are attributed to their publishers.