Overview

An embedding is a fixed-length vector of numbers that represents text, an image, or other input so that inputs with similar meaning map to nearby vectors. Search compares vectors with cosine similarity or dot product and stores them in a vector index such as pgvector, ChromaDB, Pinecone, or Qdrant.

Embed queries and documents with the same model. Vectors from different models are not comparable, so changing the model means re-embedding the whole corpus. Use the dimensionality and normalization the model’s documentation specifies.

Embeddings match meaning, not exact strings. Combine them with BM25 keyword search for identifiers, error codes, and rare terms (rag-retrieval). Typical uses are semantic search, retrieval for retrieval-augmented-generation, clustering, and deduplication.