Hierarchical Navigable Small World (HNSW) is a graph-based approximate nearest neighbor (ANN) search algorithm that constructs a multi-layered, skip-list-like graph to enable extremely fast and memory-efficient similarity searches in high-dimensional vector spaces. It is a foundational technology for semantic search and dense retrieval in vector stores, allowing AI agents to quickly access relevant context from large-scale agentic memory systems. The algorithm's design, inspired by small-world network theory, provides a strong balance between search speed, recall accuracy, and construction complexity.
