Back to M1 — Embeddings + Retrieval

Embeddings + Vector DBs

Outcome: Compare dims 768/1536/3072 on retrieval quality Curated video (LearnThatStack): Embeddings & Vector Databases Explained — https://www.youtube.com/watch?v=rw1YfQQttfo (verified live via yt-dlp 2026-09-24). Pointer: llms-genai-for-practitioners/11 (top_k, FAISS, Pinecone); shell: courses/video-scripts/genai-rag-agents/02.md.

10 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.

Ready to continue?

Mark this lesson as complete when you're ready to proceed.

Key moments

  1. Meaning vs Exact Match — Traditional databases struggle with human meaning, requiring a mathematical solution for concepts like cloud-like shoes.
  2. Defining Embeddings — An embedding converts data into numerical coordinates where distance between points captures similarity in meaning.
  3. High-Dimensional Space — Meaning is captured across 1500 dimensions, representing invisible traits discovered by the model.
  4. Embedding Generation — Embeddings are extracted from a neural network trained to predict masked words in billions of sentences.
  5. Vector Database Necessity — Vector databases are needed because brute force comparison of millions of vectors is computationally impossible.
  6. Distance Metrics — Similarity is measured using distance metrics, primarily cosine similarity for text and Euclidean distance for images.
  7. HNSW Indexing — HNSW builds layered graphs with long-range connections (highways) and local connections (streets) to narrow the search space quickly.
  8. Trade-offs and Filters — The search is Approximate Nearest Neighbors (ANN) for speed, and strong vector DBs support combined similarity and metadata filtering.
  9. Key Applications — Core applications include semantic search, Retrieval Augmented Generation (RAG), recommendations, and multi-modal search.
  10. Complete Mental Model — Embeddings turn meaning into geometry, and vector databases make that geometry searchable at scale for AI applications.
PDF notes

Frequently asked questions

How does the model discover the 1500 dimensions?

The neural network discovers them by predicting masked words across billions of examples, compressing its learned intuition into numbers.

Why is "King - man + woman = queen" significant?

It proves embeddings capture real semantic structure, allowing arithmetic operations on meaning itself.

Why use Approximate Nearest Neighbors (ANN)?

ANN (like HNSW) provides very fast results, trading occasional misses for massive speed gains necessary for scale.

When should I use Cosine Similarity versus Euclidean Distance?

Cosine similarity is the default for text, measuring the angle between vectors; Euclidean distance is common for images, measuring straight line distance.