hnswlib is the canonical open-source implementation of the HNSW algorithm — a graph-based ANN structure that delivers state-of-the-art recall-versus-latency curves for in-memory vector search. The library is intentionally minimal: header-only C++ for the core, lightweight Python bindings for everyday use, and an interface focused on building, querying, saving, and loading indexes without ceremony.
The library has spread far beyond standalone use because of how cleanly it embeds. Vector databases including Milvus, Weaviate, Qdrant, and pgvector have either integrated hnswlib directly or based their HNSW implementations on its data structures and tuning conventions. For ML teams that need a single-process, in-memory index attached to a Python service, hnswlib is the path of least resistance — pip install, build the index, query in milliseconds.
Where hnswlib stops short is at the system layer. It is a single-machine library, not a distributed search engine: no sharding, replication, or persistence beyond a flat-file dump and reload. Development cadence has slowed compared to its early years, with fewer commits in 2024 and 2025, but the library remains stable and widely deployed. Apache-2.0 licensed.
