Embeddings and similarity search

Turning text into vectors, and the store that finds the nearest ones.

What you will be able to do

Embed a corpus, put it in a store, and get sensible results back from a query.

Prerequisites
Comfort calling an API and handling its response.
Length
6 lessons · 20 min

Syllabus

  1. 1What are Embeddings?A vector of floating point numbers whose distance from another measures how related two texts are. The same distance reads as search, recommendation, classification or anomaly depending on the question you ask it.3 min
  2. 2Embedding ModelsVectors from two models are not comparable, so the choice comes with a migration attached from the day you make it. Dimensions, input limits, and the mixed index that fails without erroring.3 min
  3. 3OpenAI Embeddings APIShortening a vector is supported and cheap, and slicing it yourself without normalizing degrades search with nothing failing.3 min
  4. 4Semantic SearchRetrieving by meaning finds the document that shares no words with the query, and loses to keyword search on identifiers, rare terms and quoted phrases. Hybrid search runs both and fuses the results.3 min
  5. 5Purpose and FunctionalityA B-tree cannot find nearest neighbors, exact search stops scaling, and approximate search trades a guarantee for speed. Sometimes you need none of it.4 min
  6. 6Performing Similarity SearchCosine and dot product rank the same on normalized vectors. The decision that actually changes your results is where the filter runs.4 min

Practice alongside it