Vector and distance math

Vector and distance math is the vocabulary of similarity search: how points are represented as numbers, how closeness is scored, and which geometric rules an index may assume when it stores and compares embeddings.
Created: Updated: 3 min read

These are the topics in this section, each on its own page with a stable path you can bookmark or share.

What topics are covered in this section?

Vector and distance math is the vocabulary of similarity search: how points are represented as numbers, how closeness is scored, and which geometric rules an index may assume when it navigates those scores.

Why does HNSW care which distance you pick?

Every HNSW hop compares a query to neighbor vectors with a chosen dissimilarity. Cosine, Euclidean (L2), inner product, and related measures answer different geometric questions – angle versus magnitude-aware separation versus maximum inner-product search. Mixing a model trained for one measure with an index configured for another is a silent failure mode: the graph still walks, but near no longer means what the embedder intended. Norms, normalization, and magnitude decide whether unit-length assumptions hold. Metric properties such as the triangle inequality and symmetry matter when theory borrows from metric spaces; non-metric dissimilarities still appear in practice and change what proofs can claim.

The glossary terms in this category unpack those primitives one idea at a time.

How should you read the distance-math glossary?

Start with what a vector means in search, then the common families – L2, L1, Chebyshev, Minkowski – before cosine similarity and cosine distance, which dominate text embeddings. Inner product, dot product, norms, normalization, and magnitude explain unit-sphere workflows and MIPS. Hamming and Jaccard cover binary and set-like spaces; angular and Mahalanobis stretch into specialized geometries. Close the loop with metric-space axioms, triangle inequality, symmetry, and non-metric dissimilarities so you can tell when an algorithm’s assumptions match your score. Weaviate collections expose a configurable distance metric per vector index; pick it to match the embedder, then keep query and store paths consistent.

Solid distance literacy unblocks every later Part that talks about recall, tuning, or failure modes.

Where should you go after these definitions?

Read Part I’s chapter on measuring distance and similarity for the curriculum narrative, then jump into individual term pages when you need a sharp definition during tuning or debugging. If rankings look wrong after a model change, check normalization and cosine-versus-L2 pages before touching ef.

This section is the map of geometric scoring for HNSW. Next, open “What is a vector, in the context of search and machine learning?” or Part I’s distance chapter, then continue through cosine and metric-space terms as your workload demands.