Hierarchical Navigable Small World
  • Home
  • Nearest-neighbor search fundamentals
    • What is vector search?
    • What is nearest-neighbor search?
      • Is k-nearest neighbors a supervised or unsupervised algorithm?
      • How does the k-nearest neighbors algorithm work, step by step?
      • How do you choose the value of k in k-nearest neighbors?
      • What is a k-nearest neighbors classifier?
    • What is k-nearest neighbors (k-NN)?
    • What is top-k search?
    • What is range search?
    • What is ground truth in a search benchmark?
    • What is exact nearest-neighbor search?
    • What is approximate nearest-neighbor search (ANN)?
    • What is a c-approximate nearest neighbor?
    • What is recall-based approximation?
    • What is candidate generation?
    • What is reranking?
    • What is filtered nearest-neighbor search?
    • What is a predicate in search filtering?
    • What is pre-filtering?
    • What is post-filtering?
    • What is integrated filtering?
    • What are ties in nearest-neighbor results?
    • What are the workload dimensions of an ANN system (N, d, k, QPS)?
  • Foundations of similarity search
    • Why does high-dimensional geometry break traditional search structures?
    • Why can’t nearest-neighbor search just compare a query against every vector?
    • How do we measure distance and similarity between vectors?
    • Which algorithms and systems concepts does every HNSW implementation rely on?
  • From proximity graphs to HNSW
    • How do proximity graphs support nearest-neighbor search without a hierarchy?
    • What are small-world and navigable small-world graphs, and why did they fall short?
    • What is the core idea behind HNSW’s layered graph?
  • High-dimensional geometry
    • What is an embedding?
    • What is the curse of dimensionality?
    • What is ambient dimension?
    • What is intrinsic dimensionality?
    • What is local intrinsic dimensionality (LID)?
    • What is the manifold hypothesis?
    • What is distance concentration?
    • What is high-dimensional sparsity?
    • What is dimensionality reduction?
    • What is an embedding space?
    • What is query-database distribution shift?
    • What is an out-of-distribution (OOD) query?
    • What is an in-distribution query?
  • HNSW algorithms and theory
    • Why does HNSW’s neighbor-selection heuristic matter more than raw distance?
    • How does HNSW search a graph, step by step?
    • How is an HNSW graph actually built, one insertion at a time?
    • What can we actually prove about HNSW’s complexity, and what can’t we?
    • Why do recall and query difficulty vary so much from query to query?
  • Compression and quantization concepts
    • What is vector quantization?
    • What is scalar quantization (SQ)?
    • What is product quantization (PQ)?
    • What is int8 quantization?
    • What is FP16 (half precision)?
    • What is BF16 precision?
    • What is full-precision reranking?
    • What is approximate distance computation?
    • What is quantization error?
    • What is compression-aware graph construction?
    • What is adaptive quantization?
    • What is two-stage retrieval (quantize then rerank)?
  • Concurrency and parallelism concepts
    • What is parallel query serving?
    • What is parallel insertion?
    • What is per-node locking?
    • What is global-state locking?
    • What is read-mostly graph safety?
    • What is multithreaded construction?
    • What is a thread-safety guarantee?
    • What is nondeterministic build order?
    • What is a work queue?
    • What is batch query execution?
    • What is the trade-off between throughput and latency?
    • What is CPU affinity?
  • Building HNSW from scratch
    • What does concurrent HNSW construction and querying actually require?
    • What does a minimal, correct HNSW implementation look like?
    • How should HNSW’s data structures be laid out in memory for performance?
    • How do distance calculations and CPU optimization affect HNSW’s speed?
    • How should an HNSW index be persisted and recovered safely?
  • Filtered and hybrid search concepts
    • What is naive post-filtering?
    • What is aggressive pre-filtering?
    • What is filter selectivity?
    • What is vector/predicate correlation?
    • What is oversampling in filtered search?
    • What is filter-aware graph traversal?
    • What is a predicate-aware graph neighborhood?
    • What is lexical-plus-vector retrieval?
    • What is reciprocal rank fusion?
    • What is database-aware index selection?
  • Reading real HNSW implementations
    • What does a compact, dedicated HNSW implementation look like inside?
    • How does a general-purpose similarity search library implement HNSW?
    • How does a broader ANN toolkit compose HNSW with other index types?
  • Tuning and optimization
    • How does compression and quantization interact with an HNSW graph?
    • What do M, efConstruction, and efSearch actually change?
    • How do you build a reproducible method for tuning HNSW instead of guessing?
    • Which search and graph optimizations improve HNSW without changing its architecture?
  • Accelerators and scaling
    • Can HNSW run efficiently on GPUs?
    • What would specialized hardware for HNSW traversal look like?
    • How does HNSW work when a dataset spans more than one machine?
    • How does HNSW behave on disk and tiered storage instead of RAM?
  • Evaluation and benchmarking
    • What does rigorous HNSW benchmarking methodology actually require?
    • Which benchmark suites and datasets should you use, and for what purpose?
    • What common mistakes make HNSW benchmarks misleading?
  • Applications and hybrid retrieval
    • How does filtered and hybrid search change what HNSW has to do?
    • How is HNSW used inside recommendation systems?
    • How is HNSW used for image and multimodal search?
    • How is HNSW used for semantic search and retrieval-augmented generation?
    • What extra machinery does HNSW need once it’s inside a vector database?
  • Dynamics, variants, and frontier research
    • How does HNSW handle updates, deletion, and graph repair?
    • How does HNSW compare with alternative graph-based ANN designs?
    • How is HNSW combined into hybrid index architectures?
    • What HNSW variants are emerging from current research?
    • What are the most common production failure modes, and how do you debug them?
    • What open research problems remain in HNSW?
  • Appendices
    • Which mathematical notation does this documentation use consistently?
    • What does complete HNSW pseudocode look like, paper-style and implementation-style?
    • Which distance function should you choose, and when?
    • What should a complete HNSW benchmark record to be trustworthy?
    • How should an HNSW binary format be specified for stable persistence?
  • Vector and distance math
    • What is a vector, in the context of search and machine learning?
    • What is Euclidean distance (L2)?
    • What is Manhattan distance (L1)?
    • What is Chebyshev distance (L∞)?
    • What is Minkowski distance?
    • What is cosine similarity?
    • What is cosine distance?
    • What is inner product?
    • What is a dot product?
    • What is a vector norm?
    • What is vector normalization?
    • What is vector magnitude?
    • What is Hamming distance?
    • What is Jaccard similarity?
    • What is angular distance?
    • What is Mahalanobis distance?
    • What is a metric space?
    • What is the triangle inequality?
    • What does symmetry mean for a distance function?
    • What is a non-metric dissimilarity function?
    • What is maximum inner-product search (MIPS)?
  • Probability and randomization
    • What is a uniform random variable?
    • What is an exponential distribution?
    • What is a geometric distribution?
    • What is expectation in probability?
    • What are order statistics?
    • What is a randomized data structure?
    • What is random level assignment?
    • What is a probability decay function?
    • What is the level multiplier (mL)?
    • What is a random seed?
    • What is Monte Carlo estimation?
    • What is a tail distribution?
    • What is variance in a randomized algorithm?
    • What is the difference between expected value and worst case?
    • What is insertion-order randomness?
  • Algorithms and complexity fundamentals
    • What is Big-O notation?
    • What is average-case complexity?
    • What is expected-case complexity?
    • What is worst-case complexity?
    • What is amortized analysis?
    • What is an approximation algorithm?
    • What is a greedy algorithm?
    • What is a divide-and-conquer algorithm?
    • What is the difference between time complexity and space complexity?
    • What is logarithmic time complexity?
    • What is a linear scan?
    • What is brute-force search?
    • What is exhaustive search?
    • What is an algorithmic trade-off?
    • What is asymptotic scaling?
  • Core data structures
    • What is an array?
    • What is a linked list?
    • What is a binary heap?
    • What is a min-heap?
    • What is a max-heap?
    • What is a priority queue?
    • What is a bounded top-k heap?
    • What is a hash table?
    • What is a hash set?
    • What is a bitset (bitmap)?
    • What is an adjacency list?
    • What is a skip list?
    • What is a visited set?
    • What is a generation counter?
    • What is a dual-queue search structure?
  • Graph theory fundamentals
    • What is a graph, in the data-structure sense?
    • What is a directed graph?
    • What is an undirected graph?
    • What is a node (vertex) in a graph?
    • What is an edge in a graph?
    • What is graph degree?
    • What is a connected component?
    • What is a shortest path?
    • What is path length?
    • What is graph diameter?
    • What is an adjacency matrix?
    • What is a k-nearest-neighbor graph (k-NN graph)?
    • What is a proximity graph?
    • What is a sparse graph?
    • What is a dense graph?
    • What is a hub node?
    • What is a bridge edge?
    • What is graph traversal?
  • HNSW-specific concepts and parameters
    • What is Hierarchical Navigable Small World (HNSW)?
    • What is an HNSW layer?
    • What is the HNSW hierarchy?
    • What is an entry point in HNSW?
    • What is the base layer (level zero) in HNSW?
    • What is an upper layer in HNSW?
    • What is the M parameter in HNSW?
    • What is Mmax in HNSW?
    • What is Mmax0 in HNSW?
    • What is mL, the level multiplier, in HNSW?
    • What is efConstruction?
    • What is efSearch (ef)?
    • What is k, the requested result count, in a search query?
    • What is the maximum layer of a node?
    • What is level-assignment probability?
    • What is a graph’s connectivity budget?
    • What is a neighbor list?
    • What is neighbor-list capacity?
    • What is neighbor-list overflow?
    • What is a bidirectional edge in HNSW?
    • What is diversified neighbor selection?
    • What is the neighbor-selection heuristic?
    • What is an extended candidate set?
    • What is simple neighbor selection (closest-M)?
    • What is the skip-list analogy for HNSW?
    • What is separation by distance scale?
    • What is greedy navigation?
    • What is best-first search?
    • What is the SEARCH-LAYER algorithm?
    • What are HNSW’s graph invariants?
    • What is an HNSW index?
    • How does HNSW improve vector retrieval performance?
  • HNSW construction concepts
    • What is HNSW index construction?
    • What is incremental graph construction?
    • What is the HNSW insertion algorithm?
    • What is construction search in HNSW?
    • What is level sampling?
    • What is the descend-to-insertion-level step?
    • What is bidirectional connection during insertion?
    • What is neighbor pruning?
    • What is base-layer degree?
    • What is insertion-order sensitivity?
    • What is graph quality, in the context of HNSW construction?
    • What is construction saturation?
    • What is batch insertion?
    • What is the difference between updating a node and reinserting it?
    • What is level-zero density?
  • HNSW search concepts
    • What is upper-layer greedy descent?
    • What is a candidate queue?
    • What is a result queue?
    • What is the stopping criterion in HNSW search?
    • What is base-layer search?
    • What is beam search width?
    • What is a search frontier?
    • What is a local minimum in graph search?
    • What is multi-entry search?
    • What is early termination in search?
    • What is range-aware termination?
    • What is a search trace?
  • Complexity and theory specific to HNSW
    • What is expected hierarchy height?
    • What is the logarithmic search claim about HNSW?
    • What is the Delaunay-like graph assumption?
    • What is bounded expected routing work?
    • What is HNSW’s construction complexity?
    • What is the space complexity of a graph index?
    • What is graph storage overhead?
    • What is vector storage overhead?
    • What is the difference between worst-case and idealized HNSW analysis?
    • What is adversarial graph topology?
  • Recall, accuracy, and query difficulty
    • What is recall@k?
    • What is recall@1?
    • What is the difference between precision and recall in ANN search?
    • What is query difficulty?
    • What is a search failure mode?
    • What is a missing bridge in graph connectivity?
    • What is a poor entry region?
    • What is under-exploration in graph search?
    • What is adaptive ef?
    • What is query-adaptive exploration?
    • What is accuracy certification for ANN search?
    • What is a graph spanner?
  • Systems and hardware concepts
    • What is a CPU cache?
    • What is a cache line?
    • What is a cache miss?
    • What is a translation lookaside buffer (TLB)?
    • What is main-memory latency?
    • What is memory bandwidth?
    • What is locality of reference?
    • What is NUMA (non-uniform memory access)?
    • What is SIMD (single instruction, multiple data)?
    • What is vectorized distance computation?
    • What is pointer chasing?
    • What is branch misprediction?
    • What is a CPU register?
    • What is a thread, in a concurrent system?
    • What is an atomic operation?
    • What is a mutex?
    • What is a reader/writer lock?
    • What is false sharing?
    • What is lock ordering?
    • What is a deadlock?
    • What is contention in a concurrent system?
    • What is the roofline performance model?
  • Memory and storage concepts
    • What is an array-of-structures memory layout?
    • What is a structure-of-arrays memory layout?
    • What is memory alignment?
    • What is padding in a data structure?
    • What are huge pages?
    • What is prefetching?
    • What is neighbor-ID width (32-bit vs. 64-bit)?
    • What is a contiguous memory layout?
    • What is bytes-per-vector memory accounting?
    • What is peak build memory?
    • What is steady-state memory?
    • What is allocator overhead?
    • What is serialized index size?
    • What is a memory-mapped file (mmap)?
    • What is on-disk record layout?
  • Alternative ANN techniques and families
    • What is locality-sensitive hashing (LSH)?
    • What is an inverted file index (IVF)?
    • What is a product-quantization index?
    • What is tree-based nearest-neighbor search?
    • What is a k-d tree?
    • What is a ball tree?
    • What is an R-tree?
    • What is a VP-tree?
    • What is hashing-based ANN?
    • What is partition-based ANN?
    • What is a hybrid ANN index?
    • What is a coarse quantizer?
    • What is cluster-based candidate reduction?
    • What is an exact brute-force baseline?
    • What is the taxonomy of ANN methods?
    • What is a composite index structure?
    • What is a two-level index structure?
    • What is the trade-off in choosing an ANN index?
  • Graph-based ANN alternatives to HNSW
    • What is Navigable Small World (NSW)?
    • What is the Navigating Spreading-out Graph (NSG)?
    • What is a monotonic relative neighborhood graph (MRNG)?
    • What is the Vamana graph algorithm?
    • What is DiskANN?
    • What is FreshDiskANN?
    • What is CAGRA (GPU graph ANN)?
    • What is robust pruning in graph ANN?
    • What is the difference between a flat graph and a hierarchical graph?
    • What is the difference between offline and incremental graph construction?
  • Scaling and distributed search concepts
    • What is sharding in a search index?
    • What is replication in a search index?
    • What is random sharding?
    • What is cluster-based sharding?
    • What is a routing index?
    • What is a meta-index over shards?
    • What is a fan-out query?
    • What is top-k merge across shards?
    • What is recall decomposition across shards?
    • What is load skew?
    • What is fault tolerance in distributed search?
    • What is RDMA (remote direct memory access)?
    • What is disaggregated memory?
    • What is the trade-off between network cost and computation cost?
    • What is distributed graph traversal?
    • What is query-aware data loading?
  • Persistence and database concepts
    • What is a vector database?
    • What is a vector index?
    • What is index persistence?
    • What is a binary index format?
    • What is format versioning?
    • What is endianness?
    • What is checksum validation?
    • What is an atomic snapshot?
    • What is a write-ahead log (WAL)?
    • What is an incremental checkpoint?
    • What is tombstone deletion?
    • What is deleted-slot reuse?
    • What is a transaction, in a database?
    • What is multi-tenancy in a vector database?
    • What is resource governance?
    • What is query-planner integration?
  • Benchmarking and evaluation concepts
    • What is queries per second (QPS)?
    • What is a latency percentile (p50/p95/p99)?
    • What are distance computations per query?
    • What is build time, in benchmarking?
    • What is peak build RAM?
    • What is update throughput?
    • What is energy per query?
    • What is the difference between a cold cache and a warm cache?
    • What is the difference between a singleton query and a batch query?
    • What is a confidence interval in benchmarking?
    • What is a reproducibility manifest?
    • What is ground-truth computation?
    • What is a Pareto frontier for recall versus latency?
    • What is a benchmark operating point?
    • What is a cherry-picked benchmark result?
    • What is a recall-versus-latency trade-off curve?
    • What is thread-count scaling?
    • What is hardware-environment reporting?
    • What is insertion-order reporting?
    • What is seed reporting?
  • Datasets and benchmark suites
    • What is the SIFT1M dataset?
    • What is the GIST1M dataset?
    • What is the GloVe embedding dataset?
    • What is the BIGANN dataset?
    • What is the DEEP1B dataset?
    • What is the ANN-Benchmarks methodology?
    • What is the VIBE benchmark?
    • What is Big ANN Benchmarks?
    • What is a synthetic intrinsic-dimension dataset?
    • What is a filtered benchmark dataset?
  • Applications and use cases
    • What is semantic search?
    • What is recommendation-system retrieval?
    • What is candidate generation and ranking?
    • What is two-stage reranking?
    • What is image similarity search?
    • What is face and instance retrieval?
    • What is duplicate detection?
    • What is cross-modal retrieval?
    • What is a joint embedding space?
    • What is retrieval-augmented generation (RAG)?
    • What is passage embedding?
    • What is document chunking?
    • What is cross-encoder reranking?
    • What is multi-vector document retrieval?
    • What are user and item embeddings?
    • What is popularity skew in recommendations?
    • What is business-rule filtering?
    • What is fresh-item insertion in a recommender system?
    • What is text-to-image retrieval?
    • What is update freshness in retrieval systems?
  • Failure modes and debugging concepts
    • What causes a recall regression?
    • What causes a latency spike in search?
    • What causes an out-of-memory error during index build?
    • What is a metric mismatch bug?
    • What is a normalization inconsistency?
    • What is insertion-order recall variance?
    • What is a stale query parameter after reload?
    • What is a filtered-query collapse?
    • What is delete accumulation?
    • What is serialization corruption?
    • What is a thread race condition?
    • What causes insufficient top-k results?
    • What is damaged graph connectivity?
    • What is the difference between cosine similarity and cosine distance?
    • What causes a wrong-embedding-dimensionality bug?
    • What is an ID-to-vector mapping bug?
  • Frontier research concepts
    • What is a self-tuning ANN parameter?
    • What is dynamic graph-topology maintenance?
    • What is predicate-robust graph connectivity?
    • What is hardware-aware graph topology?
    • What is learned entry-point selection?
    • What is learned routing in ANN search?
    • What is query-distribution-aware construction?
    • What is adversarial robustness in ANN search?
    • What is privacy leakage from an embedding index?
    • What is energy-aware approximate search?
    • What is graph aging?
    • What is index drift over time?
    • What is accuracy-certified search?
    • What is distributed graph repair?
Home / Docs / Applications and use cases / What is retrieval-augmented generation (RAG)?

What is retrieval-augmented generation (RAG)?

Created: Sep 23, 20261 min read

Content coming soon.

← PreviousWhat is a joint embedding space?Next →What is passage embedding?

On this page

    © 2026 Hierarchical Navigable Small World