Macalinao StudioLearnAll enriched lessons ↗
High school path · 7 sectionsSwitch to college ↗

High school / LONGER LESSON 05

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.

Section 01 / 07

A label selects a row

High-school 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.

Imagine a cupboard with numbered drawers. A token number selects a drawer containing several measurements. The number on the drawer is only an address. Nearby drawer numbers do not imply nearby meanings. Learning changes the measurements inside each drawer, not the alphabetical order of the labels.

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

Draw an arrow from the origin to each point. Doubling both coordinates stretches the arrow without turning it. A dot product changes with that stretch. Cosine similarity divides out both arrow lengths, so it compares direction. Neither number alone establishes that two sentences mean the same thing.

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

If the same drawer is used twice in a batch, both uses can request a change. Add the requests before updating the row. Unused drawers receive no direct lookup gradient in this example. Other parts of a real training system can still affect them, so keep the simplified rule in context.

Worked step 1. IDs [2,0,2] receive gradients [1,2], [3,4], [5,6].

Worked step 2. Row 2 receives [6,8]; row 0 receives [3,4].

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

The same words in a different order can tell a different story. Give each position an additional signal, or make attention depend on relative position. A word vector alone does not describe where a word sits. Different position methods encode different relationships; they are not interchangeable stickers.

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

In Workbench, move the second coordinate of an arrow before checking cosine. Predict whether it turns toward or away from the reference. Record the calculation and draw both arrows. This experiment demonstrates geometry; it does not learn word meanings or prove that a model understands the words.

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

A search system might place two passages close together because they discuss the same subject while making opposite claims. Check the actual evidence. Compare successful and failed searches using examples from the learners who will use the system. A pleasing map is not a substitute for a useful task result.

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.

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.

EXTENDED FIELD NOTES

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
What changes when you ask a question?

The weights stay fixed during ordinary inference. Activations change with your input.

  1. Text → tokens
  2. Tokens → vectors
  3. Learned transformations
  4. 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.

Sources and further investigation

Source review: October 28, 2026. Model-release claims are attributed to their publishers.

Open the focused reading page →

Reset this high school path?

This removes only this path’s notes, progress and experiments from this browser.