liveBook · Manning

Euclidean distance

As explained in LLM Evaluation and Alignment, The Foundational Ideas

Euclidean distance is the straight-line distance between two points in a coordinate space.

Euclidean distance is the straight-line gap between two points or vector tips in coordinate space. For vectors, the related L2 norm measures magnitude by taking the square root of the summed squared components. section 3.2.3

In embedding spaces, raw distance can mislead: sentence length or word frequency may change vector magnitude even when meaning is similar. High-dimensional spaces also make distances less discriminatory, so cosine similarity often emphasizes orientation instead. section 3.2.3

Semantic embeddings

The weather is freezing and it is cold today may have a substantial Euclidean gap despite similar meaning; directional similarity can remain more informative. section 3.2.3

How LLM Evaluation and Alignment, The Foundational Ideas covers it

How deep it goes
Defines straight-line distance and vector magnitude, then stops short of a full implementation or numerical calculation.
Examples
Uses weather sentences and contrasting vector lengths to show why distance may diverge from semantic similarity.
What you can do after
Evaluate when Euclidean distance is informative and when cosine similarity better preserves semantic direction.
How it connects
Connects Euclidean distance to embeddings, cosine similarity, semantic similarity, and the curse of dimensionality.

Also explained in

Compare how 9 books explain Euclidean distance →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of LLM Evaluation and Alignment, The Foundational Ideas. The section links point to the parts of the book it draws on.