Beta

Sync to cloud

Uses your current signed-in YoolVi account. A Learn profile is not required.

Upload a snapshot of this browser’s saved lesson work across all subjects, including notes, experiments, journal and review history. Existing guest work is included only when you confirm below. This does not upload account credentials or award XP.

Sync uploads to your private account; it does not automatically merge or replace this device’s work. On another device, download the cloud copy and use My Learning’s backup import. The previous cloud snapshot is retained when a new one replaces it.

Export or import this device’s work

No background uploads. Edits made after a snapshot need another sync. On shared devices, work is bound to the first account observed by cloud sync; another account must use a separate browser profile. Keep your own downloaded backup too.

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Back to Perception and Representations

Perception and Representations · Lesson 1 of 2 in this module

Understand vector similarity

Vector similarityFixed teaching example — not your saved experiment.
  1. Starting information

    Two objects represented as number lists

  2. Relationship or operation

    Compare aligned coordinates

  3. Consequence

    A similarity score under the chosen representation

An embedding is a vector representation. Nearby vectors need task-specific evidence before being treated as interchangeable meanings.

The idea in everyday terms

An embedding represents something using an ordered list of numbers, called a vector. Different comparison rules answer different questions. Distance measures how far apart two vectors are. A dot product multiplies matching entries and adds them. Cosine compares their direction while removing the effect of their lengths.

What to watch in the experiment

Move the points and compare the scores. Two arrows can point in the same direction while ending far apart. That is why a close match under one rule need not be a close match under another. Always name the comparison used by a search system.

What this does not establish

The lab’s geometry is supplied for teaching. A high similarity score does not show that a document is relevant, current or true; inspect the source and the requested fact separately.

Full worked explanation, calculations and control definitions

Use this reference for the detailed mechanism and control meanings. Derivations explicitly marked optional are enrichment.

A vector keeps numbers in a meaningful order

An embedding represents a token, image, object, or state as a vector: an ordered list of numbers. Order matters. The vector (1,0) is different from (0,1), just as swapping the latitude and longitude of a location changes its meaning.

Our two-dimensional drawing makes the geometry visible. Real embeddings usually have many more coordinates. The axes in this lab are simply coordinate 1 and coordinate 2. They are not universal “meaning axes,” and a real learned dimension need not correspond to a human-readable category.

Compare direction and distance

A dot product multiplies matching coordinates and adds the products. For (1,0) and (1,1), it is 1 × 1 + 0 × 1 = 1. Vector length is the square root of the sum of squared coordinates, so these lengths are 1 and √2.

Cosine similarity divides the dot product by both lengths. It compares directions: 1 means the same direction, 0 means perpendicular directions, and −1 means opposite directions. For the source example, cosine is 1/√2, about 0.7071. The zero vector has no direction, so its cosine similarity is undefined.

cos⁡(a,b)=a⋅b∥a∥∥b∥\cos(a,b)=\frac{a\cdot b}{\lVert a\rVert\lVert b\rVert}

Euclidean distance measures the straight-line gap between the endpoints. In the same example it is 1. If we stretch B to (2,2), its direction stays the same but its endpoint moves. Cosine stays about 0.7071 while distance becomes √5. Neither measure is universally best; the choice depends on how the representation was learned and what comparison is useful.

The same token can mean different things in context

“River bank” and “bank account” share the token “bank,” but their contexts favor different interpretations. A model can start from the same token embedding and produce different contextual representations after combining information from nearby positions.

The lab illustrates this with a fixed bank vector and a 50–50 average with a river or account vector. These are hand-chosen numbers, not a trained language model. Self-attention replaces that fixed average with query-dependent attention weights. Real contextual representations emerge through trained projections and multiple transformations.

Knowledge is distributed, and retrieval can be wrong

A distributed representation spreads useful distinctions across combinations of numbers. One concept need not live in one neuron, and one neuron can contribute to multiple features. In superposition, several features occupy different, potentially interfering directions in a shared space.

Similarity can retrieve useful related items, or provide weights for an associative memory that mixes stored values. But being close in an embedding space does not establish that a claim is correct, current, or an exact answer to your question. A model can reconstruct a plausible but wrong statement from learned patterns. Exact, inspectable databases and source verification remain valuable.

Entering from an application project

A retrieval system turns the query and candidate documents into comparable number lists, chooses a scoring rule, then inspects the returned text. A score is a ranking signal, not a probability that the answer is true. In the recap experiment, compare dot product, cosine and distance on the same three notices. Then check the organization, revision and exact sentence before choosing an answer. A current notice about the wrong building and an archived notice about the right building fail for different reasons.

The geometry is hand-assigned to expose these distinctions. Actual learned retrieval must also test whether its training objective produces useful rankings on different queries. Continue to keyword and learned retrieval or claim-to-source checks without completing the rest of the language course.