#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++
Stars, last 29 weeks+215
21 Apr 2026: 5,151 stars28 Apr 2026: 5,166 stars5 May 2026: 5,178 stars12 May 2026: 5,191 stars19 May 2026: 5,201 stars26 May 2026: 5,213 stars2 Jun 2026: 5,219 stars9 Jun 2026: 5,227 stars16 Jun 2026: 5,233 stars23 Jun 2026: 5,238 stars30 Jun 2026: 5,244 stars7 Jul 2026: 5,256 stars14 Jul 2026: 5,263 stars21 Jul 2026: 5,273 stars28 Jul 2026: 5,277 stars4 Aug 2026: 5,286 stars11 Aug 2026: 5,294 stars18 Aug 2026: 5,296 stars25 Aug 2026: 5,301 stars1 Sept 2026: 5,308 stars8 Sept 2026: 5,310 stars15 Sept 2026: 5,319 stars22 Sept 2026: 5,326 stars29 Sept 2026: 5,333 stars6 Oct 2026: 5,338 stars13 Oct 2026: 5,345 stars20 Oct 2026: 5,351 stars27 Oct 2026: 5,357 stars3 Nov 2026: 5,363 stars10 Nov 2026: 5,366 stars

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
Also in Vector databases
RankProjectScore
1MilvusDistributed vector database with dense, sparse and hybrid search at scale Live demo ↗ (opens in a new tab)46.6k starsApache-2.0known advisory in latest version90 out of 100
2QdrantRust vector database with payload filtering, REST and gRPC Live demo ↗ (opens in a new tab)35.5k starsApache-2.085 out of 100
3MeilisearchRust search engine with typo tolerance, filtering and hybrid semantic search Live demo ↗ (opens in a new tab)59.8k starscustom license84 out of 100
#4faissC++ library for similarity search and clustering of dense vectors41.5k stars+388 (+0.9%) in 30 daysMIT81 out of 100
#5leannVector index that recomputes embeddings on demand to cut storage Live demo ↗ (opens in a new tab)13.8k starsMIT79 out of 100