Embeddings and Vector Search
An embedding represents an input as a numeric vector. Similar inputs may be close under a chosen similarity measure, which makes embeddings useful for semantic retrieval, clustering and recommendation.
#Similarity is not truth
Embedding dimensions are learned features, not usually human-readable labels. A high similarity score does not prove factual agreement or source authority. Negation, exact identifiers and specialized terminology can still cause retrieval errors.
Use the same compatible embedding model and dimensional configuration for indexed documents and queries. Changing the model usually requires rebuilding the index; equal vector length alone does not establish compatibility.
#Search at scale
Exact nearest-neighbor search compares a query with every vector. Approximate nearest-neighbor methods trade some recall for speed and resource efficiency. ScaNN is a Google Research project in this area; no algorithm is universally fastest for every dataset and setting.
Managed vector services can handle parts of indexing and serving, but still require capacity, latency and cost decisions. Verify supported deployment modes instead of assuming every service is serverless or automatically scaled.
#Store enough context
Keep source ID, text, version, access metadata and deletion state beside each vector. Apply filters that prevent one tenant's document from appearing in another tenant's result. Avoid embedding secrets that should never enter retrieval.
#Evaluate retrieval independently
Build question-to-passage reference cases and measure whether the relevant passages are returned. Compare keyword, semantic and hybrid retrieval, including exact product codes and multilingual questions. Tune top-k and index parameters using recall and latency together.