HNSW = Hierarchical NSW graph

Vectors linked into a layered graph. Search descends from top (few nodes) to bottom (all nodes). O(log N) lookup.

Advertisement

HNSW = Hierarchical NSW graph

Vectors linked into a layered graph. Search descends from top (few nodes) to bottom (all nodes). O(log N) lookup.

Advertisement

Sharding for scale

Beyond ~10M vectors per shard, split. Query fans out to all shards. Merge top-K globally.

Metadata filtering

'Vectors matching my query AND category = X AND date > Y'. Filter first (or post-filter) to avoid scanning irrelevant vectors.

Rerank for accuracy

Approximate NN gives top 100. Cross-encoder reranks top 10 with more precision. Balance recall vs cost.

Storage choices

pgvector for Postgres integration. Pinecone for managed. Weaviate for hybrid. Qdrant for cost. Choose by scale + ops maturity.