[06/08] Search — Similarity Rank
Rank every chunk by meaning
Your question is already a fingerprint (previous step). Now compare it against 8 mock chunks from the insurance PDF — see which bubble up.
How it works
- Cosine compares the question fingerprint with every chunk’s.
- Scores run 0.00 (unrelated) to 1.00 (same meaning).
- Sort all scores, keep only the Top-K, drop the rest.
Threshold: show only > 0.30
Top-K chunks are the only ones sent to the LLM. Others are ignored — like discarding 40 pages of legal fluff. Wondering why keywords aren’t enough? Try Keyword vs Vector →
For Builders — cosine
cosine = dot(a,b) for normalized vectors. Here Top-K=4. Real DBs use ANN for 10k+ vectors.