spt-index
SPT Format progressive HNSW indexing with Layer A/B/C tiered search
Overview
spt-index implements a three-layer progressive HNSW (Hierarchical Navigable Small World) index for the SPT file format. Layer A provides coarse entry-point routing at sub-5ms load time (~0.70 recall), Layer B adds partial adjacency for hot regions (~0.85 recall), and Layer C delivers full HNSW adjacency at 0.95+ recall. This progressive model enables instant queries that improve as more index data loads.
Key Features
- Three-tier progressive loading -- Layer A/B/C with increasing recall and load time
- HNSW graph implementation -- full hierarchical navigable small world graph
- Distance functions -- cosine, dot product, and L2 distance built in
- Segment codec -- encode/decode index segments for on-disk storage
- no_std compatible -- works in embedded and WASM environments
Dependencies
No runtime dependencies. Self-contained with only rand as a dev-dependency.
Usage
rust
use spt_index::{ProgressiveIndex, HnswConfig, build_layer_a};
let config = HnswConfig::default();
// Build progressive index from vector data
// let layer_a = build_layer_a(&vectors, &config);API Reference
Core Types
| Type | Description |
|---|---|
ProgressiveIndex | Main index supporting incremental layer loading |
HnswGraph | Full HNSW graph with multi-layer navigation |
HnswConfig | Configuration for M, ef_construction, and layer parameters |
LayerA / LayerB / LayerC | Individual index tier implementations |
IndexSegData | On-disk segment representation |
IndexSegHeader | Segment header with codec metadata |
VectorStore | Trait for providing vectors to the index |
PartitionEntry | Entry point for coarse partition routing |