Graph-and-tree search that grows past your RAM
NGT mixes neighborhood graphs with tree indexes so your vector search can scale from in-memory datasets to billions of quantized objects without switching libraries.
What it does NGT provides C++ libraries and command-line tools for approximate nearest neighbor search in high-dimensional spaces. It combines a neighborhood graph with a tree-based index, supports adding and removing vectors after initial build, and scales from standard in-memory indices up to billion-object datasets via optional quantization layers. Indices can also be memory-mapped to work with data larger than available RAM.
The interesting bit While most modern vector databases bet everything on graph-only methods, NGT keeps a tree in the mix and offers a clear escalation path from standard indices to heavily quantized ones. Recent releases have added scalar and product quantization alongside half-precision floats, suggesting the project is still evolving from its Yahoo Japan research roots into a practical, multi-modal search backend.
Key highlights
- Hybrid graph-and-tree indexing with dynamic object addition and removal
- Three search tiers: standard NGT, quantized graph (QG), and QBG for billion-scale datasets
- Memory-mapped shared memory support for out-of-core indices
- Wide distance metric support including L1, L2, cosine, angular, Hamming, Jaccard, and inner product
- Bindings for C++, C, Python, Go, Rust, Ruby, and PHP
Caveats
- QG and QBG depend on BLAS and LAPACK, and support fewer distance metrics than the base NGT method
- Shared memory mode lacks locking, so multiple processes must treat the index as read-only
- Contributions require accepting a Contributor License Agreement
Verdict A solid choice if you want a single library that can grow from a few million vectors to billions without abandoning its core architecture. Look elsewhere if you need a fully managed vector database or a zero-dependency, batteries-included Python package.
Frequently asked
- What is NGT-labs/NGT?
- NGT mixes neighborhood graphs with tree indexes so your vector search can scale from in-memory datasets to billions of quantized objects without switching libraries.
- Is NGT open source?
- Yes — NGT-labs/NGT is open source, released under the Apache-2.0 license.
- What language is NGT written in?
- NGT-labs/NGT is primarily written in C++.
- How popular is NGT?
- NGT-labs/NGT has 1.4k stars on GitHub.
- Where can I find NGT?
- NGT-labs/NGT is on GitHub at https://github.com/NGT-labs/NGT.