AI engineering glossary · RAG vector search

What is HNSW M (m parameter)?

M parameter (also called HNSW M): In HNSW, the maximum number of links each node keeps to its neighbours. Larger values build a denser graph that improves recall and robustness but increases memory use and index build time.

Level: advancedTopic: RAG vector search

M parameter: an example

Raising M from 16 to 32 increases graph memory roughly proportionally and improves recall at a given search effort.

Related terms

More RAG vector search terms

Where you learn it

M parameter is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.