Calendar Module 2

Distance Metrics

When you query a collection, Qdrant compares your query vector with the stored vectors using the distance metric you chose when creating the collection. For text embeddings, cosine similarity is the most common metric.

Checking every vector would be too slow for large collections. Instead, Qdrant uses an HNSW index to find the closest matches efficiently without scanning the entire collection. Fast Approximate Search: HNSW explains how it works.

MetricNotes
models.Distance.COSINEMeasures angle between vectors. Robust to magnitude differences.
models.Distance.DOTFaster than cosine when vectors are unit-length at index time.
models.Distance.EUCLIDMeasures absolute distance. Sensitive to vector magnitude.
models.Distance.MANHATTANSum of absolute differences. Less sensitive to outliers than Euclidean; use when the embedding model was trained with L1.

On this page: