Ch 5 — Vector Stores & Indexing — Under the Hood

HNSW internals, IVF, quantization, metadata indexes, and storage engines
Under the Hood
-
Click play or press Space to begin...
Step- / 10
AHNSW Graph ConstructionThe dominant ANN index algorithm
1
scatter_plot
New Vector
Insert point p
assign layer
1
casino
Layer Selection
Exponential decay
greedy search
1
route
Find Neighbors
ef_construction
connect
1
hub
Link Edges
M connections
2
searchHNSW Search: Enter at top layer, greedy descend, expand at layer 0
BIVF & Product QuantizationCluster-based indexing for billion-scale
3
bubble_chart
K-Means Train
nlist centroids
assign
3
inventory_2
Inverted Lists
Vectors per cluster
nprobe
3
search
Probe Clusters
Search nearest cells
4
compressProduct Quantization: Split vector into sub-vectors, quantize each to codebook ID
CQuantization TechniquesReducing memory footprint while preserving recall
5
straighten
Scalar Quant
float32 → int8
4x smaller
5
grid_on
Binary Quant
float32 → 1-bit
32x smaller
5
speed
Rescore
Re-rank with originals
6
memoryMemory Math: 1M vectors × 1536d = 6.1 GB (float32) → 1.5 GB (int8) → 192 MB (binary)
DMetadata Indexing & FilteringHow pre-filtering actually works under the hood
7
label
Payload Index
Inverted index on fields
bitmap
7
filter_alt
Filter Bitmap
Allowed vector IDs
intersect
7
join
ANN + Filter
Skip filtered nodes
8
storageStorage Engines: Qdrant (RocksDB + mmap), Weaviate (custom LSM), Pinecone (proprietary)
EWrite Path & Segment ArchitectureHow upserts reach the index
9
edit_note
Upsert API
Batch of vectors
WAL
9
history_edu
Write-Ahead Log
Durability first
flush
9
view_column
Segments
Immutable chunks
merge
9
merge
Compaction
Background merge
FTuning Parameters & BenchmarksThe knobs that control recall vs speed
10
tune
HNSW Params
M, ef_construction, ef
trade-off
10
monitoring
Recall vs QPS
ANN benchmarks
measure
10
verified
Production Config
Recommended defaults
1
Title