SPTAG builds large-scale vector indexes with space-partition trees and relative neighborhood graphs for fast ANN queries.
Overview
SPTAG (Space Partition Tree And Graph) is a C++ library from Microsoft Research and Bing for approximate nearest neighbor search on high-dimensional vectors compared by L2 or cosine distance. It offers SPTAG-KDT and SPTAG-BKT index types tuned for different dimensionality trade-offs.
An index builder and searcher cooperate: balanced k-means or kd-tree partitions seed graph searches, with relative neighborhood graphs improving connectivity. The project supports fresh vector updates, deletion, insertion, and distributed serving scenarios.
Build instructions cover Linux dependencies such as SWIG, CMake, and Boost, plus Windows Visual Studio solutions and optional Docker images placing binaries under /app/Release/. Python wrappers and tutorials describe online services.
MIT licensing applies to the codebase. Verification relies on bundled test executables after compilation.
Key features
- Kd-tree and BKT graph indexes
- L2 and cosine distance metrics
- Online insert and delete support
- Distributed serving toolkits
- C++ core with Python wrapper
- Docker build image
- CMake and Visual Studio builds
- Large-scale ANN search focus
Use cases
- Semantic search backends
- Billion-scale vector retrieval
- Embedding index services
- Research ANN benchmarking