Principle:AI Northstar Tech Vector io Metric Standardization
| Knowledge Sources | |
|---|---|
| Domains | Vector_Database, Interoperability, Metric |
| Last Updated | 2026-10-15 00:00 GMT |
Overview
An interoperability pattern that maps database-specific distance metric names to and from a standardized intermediate representation, enabling cross-database vector data migration.
Description
Metric Standardization solves the problem that different vector databases use different names for the same distance metrics:
- Cosine similarity: Pinecone calls it "cosine", Milvus calls it "COSINE", KDB.AI calls it "CS", Chroma calls it "cosine"
- Euclidean distance: Pinecone calls it "euclidean", Milvus calls it "L2", KDB.AI calls it "L2", Chroma calls it "l2"
- Dot product: Pinecone calls it "dotproduct", Milvus calls it "IP", KDB.AI calls it "IP", Chroma calls it "ip"
The pattern uses Qdrant's Distance enum (COSINE, EUCLID, DOT, MANHATTAN) as a common intermediate representation. A bidirectional mapping table (db_metric_to_standard_metric) provides:
- standardize_metric(db_metric, db_slug) → Distance: Used during export to record the metric in VDF metadata.
- standardize_metric_reverse(Distance, db_slug) → db_metric: Used during import to configure the target database with the correct metric name.
When a metric or database is unrecognized, both functions fall back to cosine (the most common default metric across vector databases).
Usage
Use this principle when designing systems that need to transfer vector data between databases with different metric naming conventions. It is suited for:
- Cross-database migration tools
- Export/import pipelines that need to preserve metric configuration
- Systems that need to represent distance metrics in a vendor-neutral format
Theoretical Basis
The bidirectional mapping:
# Abstract mapping (NOT real implementation)
standard_metric = {
COSINE: Distance.COSINE,
EUCLIDEAN: Distance.EUCLID,
DOT: Distance.DOT,
MANHATTAN: Distance.MANHATTAN,
}
# Forward: DB-specific name -> standard enum
def standardize_metric(db_metric, db_slug):
return mapping[db_slug][db_metric] # e.g. ("IP", "milvus") -> DOT
# Reverse: standard enum -> DB-specific name
def standardize_metric_reverse(standard, db_slug):
for db_name, std in mapping[db_slug].items():
if std == standard:
return db_name # e.g. (DOT, "milvus") -> "IP"