Vector databases & ANN at scale
P11.ir-rag.03 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Information retrieval & hybrid search
Where next?
Later in Information Retrieval & RAG
P11.ir-rag.03 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Information retrieval & hybrid search
Later in Information Retrieval & RAG
Dense retrieval finds a query's nearest neighbours in vector space. Exact search compares against every stored vector — fine for the demo corpus, ruinous at 100M vectors. This module is the four pressures that forces on you, and the knobs (nprobe, quantization, sharding) that trade around the recall / latency / memory triangle.
Exact (flat) search compares the query to every stored vector: 1M × 768-d float32 ≈ 3 GB and a full scan per query; 100M ≈ 300 GB — no longer one machine's RAM, and the scan blows the latency budget. Too big to hold and too slow to scan.
| Pressure | Exact / flat | What has to give |
|---|---|---|
| Latency | O(N) scan/query | approximate index (HNSW / IVF) |
| Memory | full float32 vectors | quantization (PQ / scalar) |
| One machine | 300 GB won't fit | sharding across nodes |
| Throughput / HA | single copy | replication |
🎯 The headline trade is recall vs latency vs memory — every knob moves you around that triangle.
nprobe cells scanned. nprobe = recall/latency knob; nprobe = cells ⇒ exact. HNSW's efSearch is the same trade.refine re-scores the shortlist); scalar int8 (4×, almost lossless).Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
A scratch console for this page's ideas — ungraded, nothing you run here is recorded.
Scratch console
A scratch console with the scientific stack (pandas, numpy, scikit-learn). Runs on the server — no network, resource-limited and measured.
Output appears here.
Loading your notes...