Skip to main content
InterviewHubPRO
Section Overview
Q12

Question 12 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

24%
Vector DBs & RAG (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What are the key HNSW tuning parameters: M, efConstruction, and efSearch?

senior LevelSystem Design

In Simple Words:

  • M (e.g. 16 to 64): Maximum number of bidirectional links connected to each node per layer. Higher M improves recall and search speed on high dimensions, but increases memory usage and build time.
  • efConstruction (e.g. 64 to 512): Size of the dynamic candidate list during index creation. Higher values build higher-quality graphs at the cost of slower indexing.
  • efSearch (e.g. 32 to 256): Size of the candidate list evaluated during live queries. Higher values increase search accuracy/recall but increase query latency.