AIMLSAGA
1,250 XP · Lv.13
AR
Lv.13
50/100 XP · 50 to Lv.14
7 day streak
RAG Engineering in Production
genai
intermediate
Lesson 1 of 10% complete
Lesson 1
Vector Embeddings and Semantic Search
+100 XP

Vector Embeddings and Semantic Search

Embeddings are dense vector representations that capture semantic meaning. Similar concepts map to nearby points in high-dimensional space.

Embedding Models

  • OpenAI text-embedding-3-small: 1536d, cost-effective
  • text-embedding-3-large: 3072d, higher accuracy
  • Sentence Transformers (all-MiniLM-L6-v2): Open source, 384d, fast

Similarity Metrics

  • Cosine Similarity: Measures angle between vectors (most common for text)
  • Dot Product: Faster, works when vectors are normalized
  • Euclidean Distance: L2 norm, less common for text

Vector Databases

DatabaseTypeBest For
PineconeManagedProduction, scale
ChromaOpen SourceLocal dev, prototyping
WeaviateOpen SourceComplex queries
pgvectorPostgreSQL extensionExisting Postgres infra

Code Sandbox
Python 3.11
Simulated Runtime
sandbox.py
python