READING COMPANION

Keep the definitions close.

Notation, sources, and the boundary around our toy experiment.

A compact glossary

Embedding
A numerical vector representation of an input; not a guarantee of lossless meaning or factual correctness.
Encoder
The function that maps an input, such as text, to its representation.
Dimension
The number of coordinates in the vector—not automatically the number of human-readable concepts.
Norm
The length of a vector from the origin. This guide uses the Euclidean, or L2, norm.
Normalization
Dividing a nonzero vector by its norm to give it unit length.
Dot product
The sum of products of matching coordinates. Raw scores retain magnitude effects.
Cosine similarity
A comparison of nonzero vectors' directions, ranging from −1 to 1. It is not a probability.
Euclidean distance
The straight-line distance between vector endpoints; smaller values rank nearer.
Pooling
An aggregation step that combines several representations, such as token states, into one.
Retrieval
Selecting candidates from a corpus for further inspection or use.
Projection
A mapping to a displayed or lower-dimensional space that may discard distinctions.

Sources behind the explanation

Primary papers and documentation, inspected on 4 September 2026. These support the concepts, not our invented coordinates or a claim of measured learning effectiveness.

  1. PyTorch 2.8 — Embedding

    Lookup-table weights and input/output shapes. Used to distinguish a token-ID lookup from contextual processing.

  2. Distributed Representations of Words and Phrases and their Compositionality

    Mikolov et al. (2013), §2. One historical context-prediction objective, not a universal embedding recipe.

  3. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding

    Devlin et al. (2019), §3. Input representations and contextual token states.

  4. Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks

    Reimers and Gurevych (2019), §§3–4. Pooling, sentence-level training, and task-specific evaluation.

  5. Dense Passage Retrieval for Open-Domain Question Answering

    Karpukhin et al. (2020), §§2–3. Compatible query/passage encoders, candidate scoring, and the retrieval objective.

  6. Faiss — MetricType and distances

    Cosine, inner product, L2, and normalized-ranking equivalence. The lab displays Euclidean distance, not squared L2.

Reproduce the geometry

The canonical JavaScript module (local copy) contains the five hand-authored vectors and all score calculations. Run node model.mjs from the downloaded source folder for baseline, comparison and transfer values. No model or randomness is involved.

Numerical tests (local copy) check the geometric invariants and all allowed control states. Calculations use full precision; the display rounds to three decimals. Score ties within 10−12 are displayed in corpus ID order; the earlier ID is not more relevant.

The experiment does not encode text, train a model, run a vector database, evaluate relevance, or measure accuracy. It demonstrates vector geometry. A real application must choose and evaluate compatible representations and the intended scoring rule.