COMPLETE READING EDITION

Embeddings, explained.

All five chapters, including the worked answers and static lab comparisons. This edition loads no JavaScript.

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

  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.