Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Retrieval and Knowledge Systems

Free · sign in to start and track progress

1 · Building the index

  • 1Embeddings in practice
  • 2Chunking structured documents
  • 3Vector indexes and databases

    Exercise answers

    • Answer: Tune an ANN index against a recall target
    • Answer: Red-team tenant isolation (stretch)
  • 4Measuring retrieval

2 · Retrieval that reasons

  • 5Hybrid search and reranking
  • 6Agentic retrieval
  • 7Knowledge graphs and GraphRAG
  • 8Long context versus RAG
CapstoneA measured retrieval service for cases and reference documentsReference implementation

Module 1 · Building the index · Lesson 3

Vector indexes and databases

How HNSW and IVF indexes trade recall for latency, how filters and tenant isolation interact with them, how to choose between pgvector, Turbopuffer, LanceDB and Qdrant, and how to keep an index fresh as documents change.

75 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Python with uvGet an OpenRouter keyLocal models with OllamaDocker and Docker ComposePostgres with pgvector

By the end of this lesson you can

  • Explain how IVF and HNSW indexes find approximate neighbours, and tune nprobe and ef_search against a recall target
  • Predict when a filtered vector query returns too few results, and choose between exact search, iterative scans, partial indexes and partitioning
  • Design tenant and case isolation that is enforced by the database, not by the prompt
  • Choose a vector store for a given workload and justify it on latency, cost, filtering and operations
  • Keep an index fresh with idempotent upserts, supersession, redaction deletes and blue-green re-embedding

On this page

  • Exact search, and why it isn't always the answer
  • IVF: cluster, then search nearby clusters
  • HNSW: a navigable graph
  • The recall–latency curve, measured
  • Compressed and disk-based indexes
  • Filters: where ANN quietly fails
  • pgvector on Neon or Supabase
  • Tenants, matters and ethical walls
  • Choosing a store
  • Keeping the index fresh
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Exact search, and why it isn't always the answer
  2. 02IVF: cluster, then search nearby clusters
  3. 03HNSW: a navigable graph
  4. 04Filters: where ANN quietly fails
  5. 05Tenants, matters and ethical walls
  6. 06Choosing a store
  7. 07Keeping the index fresh
  8. 08Connections
  9. 09Summary

Sources & further reading

  • Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphsPaper · Malkov, Yashunin · 2016The HNSW paper. Read sections 3 and 4 for the layered graph, greedy search and the roles of M and ef. Most vector databases still ship this algorithm.
  • The Faiss libraryPaper · Douze et al. · Meta FAIR · 2024A survey of vector search from the team behind the most used library. Section 3 frames the speed, memory and accuracy trade-off; the IVF and quantisation sections explain coarse-to-fine search.
  • ACORN: Performant and Predicate-Agnostic Search Over Vector Embeddings and Structured DataPaper · Patel, Kraft, Guestrin, Zaharia · Stanford · 2024Why filtered vector search is hard and how to make graph indexes filter-aware. Read the introduction for the pre-filter and post-filter failure modes.
  • pgvector READMEDocsThe reference for HNSW and IVFFlat options, iterative index scans, filtering advice and binary quantisation in Postgres. Read the Filtering and Iterative Index Scans sections.
  • turbopuffer architectureDocsA clear account of a vector database built on object storage, with measured cold and warm latencies, write-ahead log, asynchronous indexing and consistency options.
  • Qdrant multitenancy guideDocsConcrete patterns for many tenants in one collection, dedicated shards for large tenants, and promotion between them.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 9 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks