Module 07
Embeddings and Semantic Search
Embeddings turn text into lists of numbers so that similar meanings land close together, which lets a computer compare meaning with simple arithmetic. You will create embeddings with a paid API and a free local model, explore and measure the space they live in, and use them to build semantic search, recommendations and a support-ticket classifier, each with a real measurement of how well it works.
By the end of this module you can
- explain what an embedding is and calculate cosine similarity by hand
- create embeddings with OpenAI text-embedding-3-small and a local sentence-transformers model, and choose between them on cost, privacy and quality
- normalise vectors, measure a noise floor, and visualise a vector space with PCA and UMAP without being fooled by the picture
- build semantic search and recommendations with filters, diversity and a hit-rate test set
- classify text with nearest centroid, k-NN and logistic regression on embeddings, and read per-label precision and recall
- spot where embeddings fail: negation, exact identifiers, long text, language and bias
Lessons
6 in this module- 01What are embeddings?Explain what an embedding is, compute cosine similarity by hand, and say where meaning-based search beats keywords and where it fails.
- 02Creating embeddings in codeCreate embeddings in batches with OpenAI text-embedding-3-small and a local sentence-transformers model, estimate their cost, and save them safely for reuse.
- 03Exploring and reasoning about vector spacesNormalise vectors, compare dot product, cosine and Euclidean distance, measure a noise floor, map a space with PCA and UMAP, and probe it for analogies and bias.
- 04Semantic search and recommendationsBuild semantic search and content-based recommendations from one set of embeddings, with hard filters, a minimum score, MMR diversity and a hit-rate test set.
- 05Classification with embeddingsSort support tickets with nearest centroid, k-NN and logistic regression on embeddings, read per-label precision and recall, and route unsure or safety-critical messages correctly.
- 06Project: Exploring embeddingsShip one embedding layer that powers semantic search, recommendations and ticket classification for a bakery, with a measured score for each and a findings report on the vector space behind them.