aicoolies logo
hnswlib logo
hnswlib logo

hnswlib

Header-only C++ implementation of HNSW for fast approximate nearest-neighbor search.

freeupdated Jul 7, 2026

hnswlib is a header-only C++ library implementing the Hierarchical Navigable Small World (HNSW) graph algorithm for approximate nearest-neighbor search, with Python bindings and a tiny dependency footprint. Originally developed by the nmslib team, it has become the default HNSW implementation embedded inside many vector databases and search products. Engineers use it directly when they want HNSW retrieval without pulling in a heavyweight vector DB.

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.

Pricing

Open-source Apache-2.0 licensed library — no commercial tier.

Platforms

Header-only C++ with Python bindings; cross-platform.

Categories

Tags

Use Cases

Alternatives

Qdrant logo

Qdrant

High-performance vector database written in Rust for similarity search at scale.

Qdrant is a high-performance vector similarity search engine and database written in Rust. Designed for production-grade AI applications with advanced filtering, payload indexing, and distributed deployment. Supports billion-scale vector collections with sub-second query times. Popular choice for RAG, recommendation systems, and anomaly detection.

freemiumOpen Source
Weaviate logo

Weaviate

Open-source vector database for AI-native applications and semantic search.

Weaviate is an open-source vector database purpose-built for AI applications. Supports vector, keyword, and hybrid search with built-in vectorization modules for OpenAI, Cohere, Hugging Face, and more. Used for RAG pipelines, semantic search, recommendation engines, and multimodal search. Written in Go for high performance.

freemiumOpen Source
Milvus logo

Milvus

GPU-accelerated open-source vector database

Milvus is an open-source vector database with 45K+ GitHub stars for billion-scale similarity search. Features GPU-accelerated indexing, hybrid search combining vector and scalar filtering, multi-tenancy, partitioning, and horizontal scaling. Supports HNSW, IVF, DiskANN, and GPU index types. SDKs for Python, Java, Go, and Node.js. Zilliz Cloud offers a managed version. A production-grade foundation for RAG pipelines and recommendation systems at enterprise scale.

Open Source
Marqo logo

Marqo

Embedding-first search and discovery engine for AI-powered product experiences.

Marqo is an open-source tensor search engine that combines embedding generation and vector search in a single API, removing the need to manage separate embedding pipelines and vector databases. Built for product discovery and multi-modal search, it lets teams index text, images, and structured data together, returning ranked results based on semantic similarity rather than keyword overlap.

freemium

Related Tools

Cloudflare logo

Cloudflare Vectorize

Edge-native vector database for Workers and AI applications

Cloudflare Vectorize is Cloudflare’s managed vector database for Workers and edge AI applications. It is distinct from the existing Cloudflare Workers tool page: Workers is the compute runtime, while Vectorize is the embedding index and vector-query layer used to add semantic retrieval to Cloudflare-hosted apps.

freemium
Upstash Vector logo

Upstash Vector

Serverless vector database with pay-as-you-go API pricing

Upstash Vector is a managed serverless vector database for RAG, semantic search, and embedding lookup. It is separate from the existing Upstash platform record in the aicoolies catalog: this slug covers the Vector product line, not the broader Redis, Kafka, or QStash platform.

freemium
OpenSearch logo

OpenSearch

Open-source search engine with vector and hybrid retrieval

OpenSearch is an Apache-2.0 distributed search engine with native vector-search support for teams that want BM25, filters, aggregations, and k-NN retrieval in the same search stack. It is distinct from Elasticsearch in the aicoolies catalog: OpenSearch is the AWS-backed open fork with its own docs, plugin path, and serverless deployment options.

Open Source
Supabase MCP logo

Supabase MCP

MCP server for connecting AI assistants to Supabase projects

Supabase MCP is Supabase's Apache-2.0 server for connecting AI assistants to Supabase projects. It can expose database, configuration, and project-management workflows to MCP clients such as Cursor, Claude, and Windsurf, while the official docs emphasize permission and security review before production use, SQL changes, or high-privilege database access.

Open SourceTelemetry
Deep Lake logo

Deep Lake

AI data runtime for multimodal datasets and vector search

Deep Lake is an open-source AI data runtime from Activeloop for storing, versioning, and querying multimodal data and embeddings. It fits teams building RAG, training, evaluation, or dataset-heavy agent workflows that need a bridge between vector search, structured metadata, and large image, text, audio, or video collections.

Open Source
SeekDB logo

SeekDB

AI-native state store with hybrid vector and full-text search

SeekDB is an open-source AI-native state store from the OceanBase ecosystem that combines MySQL-compatible data access with hybrid vector and full-text retrieval. It targets agent and AI application teams that need embedded or server deployment, copy-on-write style sandboxes, and searchable state without gluing together several separate storage layers.

Open Source