# nmslib/hnswlib

Header-only C++/python library for fast approximate nearest neighbors

Repository: https://github.com/nmslib/hnswlib
Canonical: https://ross.abutalabs.com/products/hnswlib
Homepage: https://github.com/nmslib/hnswlib
Language: C++
License: Apache-2.0
License Family: permissive
Last push: 2026-03-28T23:20:00+00:00

## Health v2 (maintenance only)
Score: 69/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 74, release rhythm 45, longevity 100
- inputs: {"age_days": 3345, "days_push": 158, "days_rel": 158, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5312, forks 834 (observed 2026-08-28T04:09:15.450400+00:00)

## What it is
A header-only C++ library with Python bindings implementing the HNSW algorithm for fast approximate nearest neighbor search. It supports incremental index construction, updates, deletions, filtering, and custom distance functions with a small memory footprint.

## Use cases
- find similar images by embedding vector
- build a vector index for semantic search
- fast k-nearest-neighbor search on millions of vectors
- deduplicate documents by embedding similarity
- recommendation engine candidate retrieval
- use as a lightweight local vector store for RAG

## When to choose
- you need fast approximate nearest neighbor search in C++ or Python without heavy dependencies
- you need incremental insertions, updates, and deletions in a vector index
- memory footprint and build speed matter more than a full database with persistence and replication

## When to avoid
- you need a distributed, persistent vector database with replication and filtering at scale
- you need exact (brute-force) nearest neighbor results
- you need a managed service or built-in REST API

## Facets
- artifact type: library
- maturity: stable
- function: search-engine, machine-learning, data-science
- domain: machine-learning, databases
- platform: cpp, python, cross-platform
- tags: approximate-nearest-neighbors, ann, hnsw, vector-search, header-only, similarity-search, embeddings, search, algorithms

## Member repositories
- nmslib/hnswlib (main) score 69

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:15.450400+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:58:58.948203+00:00, confidence not recorded.
  - readme: https://github.com/nmslib/hnswlib (fetched 2026-08-28T04:09:15.450400+00:00, sha 6d5e67470e11)
  - homepage: https://github.com/nmslib/hnswlib (fetched 2026-08-29T08:53:43.385532+00:00, sha 86b8f29d6309)
- Data as of 2026-08-30T08:39:29.467469+00:00.
