Metric Algebra: Embedding-Independence in Vector Databases
Abstract
Vector databases are increasingly central to retrieval applications, yet deployments remain embedding-siloed: different databases store vectors produced by different embedding models and ANN pipelines, making cross-database search ill-defined or forcing expensive re-embedding and index rebuilds. We propose metric algebra, a logical foundation for embedding-independence. It models each dataset as a metric relation, i.e., identifiers equipped with a semantic distance, and provides operators for similarity search, and, critically, a semantics-preserving Union operator for cross-embedding search. We implement metric algebra in MetricDB, which treats existing vector databases as physical vector realizations that implement metric relations, and executes Union via witness maps learned from overlap anchors. Building on this logical-physical bridge, MetricDB plans hard vs. soft execution for queries over Union under imperfect witnesses and avoids rebuilds via transformation-equivariant index compilation and merging. Experiments on benchmark workloads across heterogeneous embedding models (e.g., Mistral, GTE-Qwen2, NV-Embed-V2, OpenAI-Ada-002) demonstrate robust cross-embedding retrieval and efficient interoperability.