Embedding models turn text into numbers. Vector similarity decides which numbers are "close." If you are building or debugging a RAG pipeline, a semantic search feature, or a recommendation system, understanding this math is not optional.
Open Vector Sandbox โ Read the RAG tutorial โMost RAG implementations work until they don't. A user asks a reasonable question, the retrieval step finds the wrong chunks, and the model either hallucinates or says it doesn't know โ even when the answer is in the knowledge base.
The culprit is usually a mismatch between how similarity is being measured and what "similar" actually means for a given use case. Developers who treat vector search as a black box โ "embeddings go in, results come out" โ have no basis for debugging when retrieval fails.
This is the most common misconception in RAG and search work. Two sentences can share zero words and still be semantically close. Two sentences can share most words and mean opposite things.
"The bank approved the loan" and "The river bank flooded" share the word bank but are semantically unrelated. Keyword search returns both; vector search does not.
"Remote work policy" and "Can I work from home?" share no keywords but a good embedding model places them close in vector space โ which is exactly what RAG needs.
Vector similarity operates on meaning, not spelling. That is the fundamental reason embeddings exist.
Measures the angle between two vectors, ignoring magnitude. Best for text embeddings where direction encodes meaning. Score ranges from โ1 to 1. Most RAG implementations use this.
Measures both angle and magnitude. Used when you want length to influence relevance โ for example in recommendation systems where a higher-magnitude vector may signal a stronger preference.
Measures straight-line distance between two points. Useful for clustering or image embeddings. A lower score means more similar. Less common in text-based RAG but worth understanding.
A RAG pipeline typically retrieves the top-K chunks above a minimum similarity score. Set the threshold too high and you miss relevant context. Set it too low and noise enters the prompt. You cannot tune this threshold without understanding what a cosine score of 0.72 actually means for your corpus.
These are illustrative scores. Real values depend on your embedding model and corpus. Use the Vector Sandbox to explore how different inputs shift similarity scores.
No paid API, no account, no server calls. Everything runs in the browser.
Explore the Vector Sandbox โ Learn the full RAG pipeline โ