HNSW Index Parameters
Parent: MongoDB Atlas Vector Search · Published reference · snapshot 2026-10-24 · skill mongodb-cohort-326a9da785a4
↓ Facts as markdownall context files
Source-anchored research for HNSW Index Parameters. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
Structure and components
- Parameter names indicate related roles across implementations, but supported ranges and degree semantics require implementation-specific documentation. hnswlib describes M as links created per insertion; Atlas describes maxEdges as a maximum outgoing degree per layer. Do not assume numeric configurations transfer unchanged. (medium confidence) [source]
How it works
- The 2026-10-23 MongoDB documentation snapshot gives numEdgeCandidates an inclusive range of 100–3200 and a default of 100. It limits the candidate nodes evaluated when finding neighbors for a newly inserted node. (low confidence) (verified as of 2026-10-23) [source]
Problems, failure modes and limitations
- Increasing graph connectivity can improve recall, but stores more links and increases indexing work. MongoDB warns that maxEdges can also slow queries because each visited node has more neighbors to evaluate. (high confidence) [source]
- In the MongoDB query-documentation snapshot dated 2026-10-14, ANN numCandidates must be at least limit and at most 10000. MongoDB recommends starting with at least 20 times limit, then tuning for the dataset and query requirements. (low confidence) (verified as of 2026-10-14) [source]
Comparisons and alternatives
- A larger construction candidate list can improve graph quality at a greater build-time cost, but improvements eventually plateau. Treat numEdgeCandidates as analogous to efConstruction rather than as the requested result count. (medium confidence) [source]
- Increasing ef_construction has diminishing returns: hnswlib explicitly warns that index quality eventually stops improving. Pinecone's Faiss parameter sweep also shows interactions among construction breadth, graph degree, and search breadth, rather than one universally optimal setting. (high confidence) [source]
Facts and statements
- HNSW separates graph connectivity, construction search effort, and query search breadth. Atlas exposes construction controls as hnswOptions.maxEdges and hnswOptions.numEdgeCandidates; query-time numCandidates is a separate setting. (high confidence) [source]
- In the MongoDB index documentation snapshot dated 2026-10-23, indexingMethod defaults to hnsw and hnswOptions applies only to hnsw indexes. MongoDB recommends retaining construction defaults unless large indexes have suboptimal recall. (low confidence) (verified as of 2026-10-23) [source]
- The 2026-10-23 MongoDB documentation snapshot gives maxEdges an inclusive range of 16–64 and a default of 16. It controls the maximum graph connections per node; these bounds are Atlas product settings, not universal HNSW limits. (low confidence) (verified as of 2026-10-23) [source]
- Increasing query search breadth generally improves recall at the cost of latency. Tune it separately from construction settings so a faster build is not mistaken for an equally accurate index. (high confidence) [source]
- Do not assume that construction effort has zero effect on query latency. MongoDB explicitly warns that increasing numEdgeCandidates can affect latency, and Pinecone's Faiss experiment observed search-time differences across efConstruction values. (high confidence) [source]
- Elliott and Clark's 2024 study reports that insertion order based on local intrinsic dimensionality or categories can shift HNSW recall by up to 12 percentage points in its experiments. This scopes parameter-only explanations of poor recall; it is not an Atlas-specific measured effect. (low confidence) [source]
- Validate tuning against exact nearest-neighbor results on representative data. HNSW tuning guidance depends on intrinsic dimensionality, while empirical research shows that insertion order can also affect recall. (medium confidence) [source]
- Hnswlib issue #666 reports a 3232-dimensional random-vector experiment whose 'recall' test searched every indexed vector for itself. Those figures describe self-match recovery and should not be treated as Atlas recall@k on held-out production queries. (low confidence) [source]
- Atlas documents optional hnswOptions for indexingMethod=hnsw: maxEdges ranges from 16 to 64 with default 16; numEdgeCandidates ranges from 100 to 3200 with default 100. MongoDB recommends retaining defaults unless large indexes show suboptimal recall. (low confidence) (verified as of 2026-10-23) [source]
- Graph degree controls connectivity and graph memory. Raising Atlas maxEdges or hnswlib M can improve recall, while increasing the connections stored and the work involved in graph construction and traversal. (high confidence) [source]
- Construction breadth controls the candidate search used to choose graph connections: Atlas calls it numEdgeCandidates; hnswlib calls it ef_construction. It is separate from the number of retained connections and from query-time search breadth. (high confidence) [source]
- Increasing query breadth explores more candidates and generally trades latency for recall. Atlas numCandidates and hnswlib ef serve this role; neither should be confused with the requested result count. (high confidence) [source]
- Evaluate approximate results against exact nearest-neighbor results on representative queries and embeddings. Measure recall alongside latency, graph memory, and build time; Pinecone's SIFT1M/Faiss measurements should not be treated as Atlas capacity estimates. (medium confidence) [source]
Children
- HNSW graph connectivity and construction breadth (frontier)
- ANN recall measurement against exact neighbors (frontier)
- Insertion order and intrinsic dimensionality (frontier)
Frontier under this node: ANN recall measurement against exact neighbors, HNSW graph connectivity and construction breadth, Insertion order and intrinsic dimensionality