liveBook · Manning

Distance

As explained in Machine Learning Platform Engineering

A distance metric is a function that quantifies separation between vectors in a mathematical space.

In vector retrieval, distance metrics measure how close document-chunk vectors are to a query vector, helping FAISS find relevant chunks for RAG systems. section 12.2.4

FAISS supports L2, cosine, and inner-product metrics. Cosine similarity works well for most text applications because it focuses on semantic direction rather than magnitude. section 12.2.4

How Machine Learning Platform Engineering covers it

How deep it goes
Names L2, cosine, and inner product, and explains cosine’s focus on semantic direction without deriving the metrics.
Examples
Uses a query vector and nearby document-chunk vectors to illustrate retrieval, and contrasts cosine with magnitude-sensitive comparison.
What you can do after
Evaluate retrieval choices by considering supported distance metrics and cosine’s emphasis on semantic direction.
How it connects
Connects distance metrics to vector retrieval, embeddings, and retrieval-augmented generation.

Also explained in

Compare how 10 books explain distance →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Platform Engineering. The section links point to the parts of the book it draws on.