Course contentsShow
← AI Engineering
Lesson 291 of 1,8868. Vector Databases - ToolsFree lesson

Embedding Model Compatibility

How different vector databases handle various embedding dimensions and distance metrics.

Embedding Model Compatibility

What you'll learn: How different vector databases handle various embedding dimensions and distance metrics.

The Core Problem

Not all embedding models produce vectors of the same size. OpenAI's text-embedding-3-small generates 1536-dimensional vectors, while Cohere's embed-english-v3.0 produces 1024 dimensions. Meanwhile, some Sentence Transformers models output 384 or 768 dimensions. Your vector database needs to accommodate whichever model you choose—and what you choose affects what the database can support.

Dimension Flexibility

Fixed-dimension databases require you to declare your vector size upfront when creating a collection or index. Once set, you can't mix 384-dimensional and 1536-dimensional vectors in the same index. This is common in systems like Pinecone or Weaviate.

Flexible databases may allow multiple collections with different dimensions, but rarely within a single searchable index. Think of it like organizing shoes: you can have separate shelves for different sizes, but you can't search one shelf that holds both size 8 and size 12 shoes simultaneously.

Distance Metric Compatibility

Vector databases support different distance metrics (cosine similarity, Euclidean distance, dot product), but not all databases support all metrics equally well. Some optimize their indexing algorithms specifically for cosine similarity; others handle Euclidean distance more efficiently.

The mismatch risk: If you generate embeddings normalized for cosine similarity but your database only efficiently supports Euclidean distance, you might get suboptimal performance or need to re-normalize your vectors.

Practical Implications

Before choosing a vector database, verify:

  • Does it support your embedding model's dimension count?
  • Is your preferred distance metric available and well-optimized?
  • Can you change models later without rebuilding everything?

Key Takeaway: Vector database compatibility depends on matching embedding dimensions and distance metrics—choose your embedding model and database together, not separately.