#1616th of 22 in Vector databases
hnswlib
Header-only C++ library for approximate nearest neighbor search with HNSW graphs
- Stars
- 5.4k
- License
- Apache-2.0
- Last commit
- Sep 2026
- Last release
- Mar 2026
- Language
- C++
5,151 on 21 Apr 20265,366 on 10 Nov 2026
From GitHub's daily star counts.
Checked on GitHub.
Overview
Hnswlib implements the HNSW graph index for approximate nearest neighbor search as a header-only C++11 library with Python bindings. It supports L2, inner product and cosine distances, incremental inserts, updates, label filtering and marking elements as deleted. Indexes are saved to disk or pickled in Python, and C++ users can define custom distances.
Who it is for: Engineers embedding in-process ANN vector search in C++ or Python apps
Strengths
- Header-only with no dependencies beyond C++11; installs with pip install hnswlib
- Supports incremental inserts, in-place updates, and deletion with slot reuse
- Python index is picklable; C++ supports custom distances, multivector and epsilon search
- Optional -fno-exceptions C++ API via *NoExceptions methods returning Status
Weaknesses
- Library only: no server, REST API or built-in metadata storage
- Only l2, ip and cosine in Python; other spaces need nmslib
- max_elements must be set up front; resizing is not thread-safe with add or query
- Python filtered search is slow in multithreaded mode because of the GIL
What it needs
- no GPU
What changed
From the release notes. No flag means the note does not say so, not that the upgrade is safe.
Also in Vector databases
See all 22| Rank | Project | Score |
|---|---|---|
| 1 | MilvusDistributed vector database with dense, sparse and hybrid search at scale | 90 out of 100 |
| 2 | QdrantRust vector database with payload filtering, REST and gRPC | 85 out of 100 |
| 3 | MeilisearchRust search engine with typo tolerance, filtering and hybrid semantic search | 84 out of 100 |
| #4 | faissC++ library for similarity search and clustering of dense vectors | 81 out of 100 |
| #5 | leannVector index that recomputes embeddings on demand to cut storage | 79 out of 100 |