AI / A CONCEPT NOTE
Semantic Search
finding documents by conceptual meaning rather than exact keywords
Overview · mechanism
pitfall · examples
01 / THE SHORT VERSION
The idea in a few sentences.
Uses vector embeddings to map queries and documents into a shared high-dimensional latent space, measuring relevance via Cosine Similarity rather than string matching.
02 / FOLLOW THE MECHANISM
How semantic retrieval operates
User Query
is passed through an embedding model to generate a dense vector.
Vector DB Index
performs Approximate Nearest Neighbors (ANN) vector search.
Distance Calculation
ranks top-K documents by highest cosine similarity.
Result Chunks
are returned to the application as grounded prompt context.
04 / COMMAND NOTES
Read the command, then the result.
Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.
calculate cosine similarity
python -c import numpy as np; a=np.array([1,0]); b=np.array([0.9,0.1]); print(np.dot(a,b)/(np.linalg.norm(a)*np.linalg.norm(b)))05 / CHECK YOURSELF
Could you explain Semantic Search to a teammate?
Try it out loud in two sentences: what it is, and the one detail that changes the picture. If you stall, the gap is the part to reread.
Up next in AI engineeringRetrievalfetching external, real-time knowledge at query time