Repository navigation
superbit_lsh v0.1.0
A lightweight, in-memory vector index for approximate nearest-neighbor (ANN) search using Locality-Sensitive Hashing.
Highlights
- Random hyperplane LSH (SimHash) for cosine, Euclidean, and dot-product similarity
- Multi-probe querying for improved recall without extra tables
- Thread-safe concurrent access via
parking_lot::RwLock - Builder pattern for ergonomic index configuration
- Auto-tuning --
suggest_paramsrecommends optimal parameters for a target recall - Runtime metrics -- lock-free atomic counters for query latency, candidates, and hit rates
Optional Features
| Flag | Effect |
|---|---|
parallel |
Parallel bulk insert and batch query via rayon |
persistence |
Save/load index to disk (serde + bincode + JSON) |
python |
Python bindings via PyO3 |
full |
Enables parallel + persistence |
Install
[dependencies]
superbit_lsh = "0.1"Performance
Benchmarked on 768-dimensional vectors (release mode):
| Dataset Size | LSH Query | Brute-force | Speedup |
|---|---|---|---|
| 10k vectors | 4.6 us | 1.04 ms | 226x |
| 100k vectors | 34.5 us | 60.6 ms | 1,756x |