Skip to content

Vector Index Tuning

Tuning approximate nearest-neighbour indexes — HNSW and IVF parameters — for the right balance of recall, speed and memory.

Editorial team 1 min read

Approximate nearest-neighbour (ANN) indexes make vector search fast by trading a little accuracy. Their parameters control that trade.

HNSW

A graph-based index widely used for its speed and recall.

  • M: connections per node. Higher improves recall and memory use.
  • ef_construction: search breadth when building. Higher builds a better graph, slower.
  • ef_search: search breadth at query time. Higher improves recall, slower queries. Often the main knob to tune.

IVF

Clusters vectors and searches only the nearest clusters.

  • Number of clusters (lists): more clusters, faster but may miss results.
  • nprobe: clusters searched per query. Higher improves recall, slower.

Quantisation

Compressing vectors (product quantisation, scalar quantisation) reduces memory substantially with some accuracy loss. Useful for very large collections.

How to Tune

  1. Compute exact nearest neighbours for a sample of queries as ground truth.
  2. Measure ANN recall against it at different settings.
  3. Pick settings that meet your recall target at acceptable latency.

Filtering Interacts

Heavy metadata filtering can reduce effective recall in some ANN implementations. Test with realistic filters.

Don't Over-Engineer

For collections under a few hundred thousand vectors, defaults or even exact search are often fine.

More in RAG

All RAG guides →
RAG Guide · 1 min

RAG Architecture: The Components End to End

A map of a complete retrieval-augmented generation system, from ingestion to answer, and what each component is responsible for.

RAG 1 min read 6 Dec 2025

RAG Guide · 2 min

Document Parsing for RAG

Turning PDFs, slides, HTML and scans into clean, structured text — the unglamorous step that decides RAG quality.

RAG 2 min read 5 Dec 2025

RAG Guide · 2 min

Chunk Size and Overlap Tuning

How to choose chunk size and overlap for retrieval by testing against real questions rather than guessing.

RAG 2 min read 4 Dec 2025

RAG Guide · 2 min

Hybrid Search for RAG

Combining keyword and vector search so RAG finds both exact terms and paraphrased meaning.

RAG 2 min read 3 Dec 2025