NGT-labs/NGT

Nearest Neighbor Search with Neighborhood Graph and Tree for High-dimensional Data

What it solves

NGT addresses the challenge of performing high-speed approximate nearest neighbor (ANN) searches across massive volumes of high-dimensional vector data, which typically ranges from several ten to several thousand dimensions.

How it works

The project provides three primary indexing methods to balance speed, memory, and scale:

  • NGT: A hybrid approach combining graph and tree-based indexing.
  • QG (Quantized Graph): A quantized graph-based method designed for higher performance than the standard NGT approach.
  • QBG (Quantized Blob Graph): A specialized method capable of handling billions of objects.

To optimize resource usage, NGT supports shared memory (via memory-mapped files) to handle datasets larger than available RAM and provides various quantization options (scalar and product quantization) to reduce the data footprint.

Who it’s for

It is designed for developers and researchers working with high-dimensional vector spaces who need a fast, scalable way to retrieve similar items from a large dataset.

Highlights

  • Broad Distance Support: Supports L1, L2, Cosine similarity, Angular, Hamming, Jaccard, Poincare, Lorentz, and Inner product.
  • Massive Scalability: QBG can handle billions of objects.
  • Multi-Language Bindings: Available for Python, Ruby, PHP, Rust, Go, C, and C++.
  • Memory Efficiency: Supports shared memory for indices that exceed physical memory limits.

Related

  • Project
  • Project
  • Project
  • Project
  • Project