Similarity metrics
A similarity metric (or distance metric) is the rule Ahnlich uses to decide
how close two vectors are during a similarity search.
You pick the metric per query via the algorithm field.
The metrics
| Metric | Measures | Good when |
|---|---|---|
| Cosine similarity | the angle between vectors (ignores magnitude) | text/semantic embeddings, where direction matters more than length |
| Euclidean distance | the straight-line distance between points | vectors where magnitude is meaningful (e.g. spatial data) |
| Dot product | angle and magnitude together | when larger vectors should score higher (some recommender setups) |
Choosing one
- Start with cosine similarity for embeddings from language or vision models — it's the most common default and is unaffected by vector length.
- Use Euclidean when the absolute position of a vector carries meaning.
- Use dot product when your model was trained to encode relevance in the vector's magnitude.
The metric only affects ranking — it doesn't change what's stored, so you can issue different queries against the same store with different metrics.