Skip to main content

Module turbo_index

Module turbo_index 

Source
Expand description

turbovec-backed approximate nearest-neighbour table.

This module provides TurboTable, a SIMD-search ANN container that drops in alongside crate::index::HnswIndex when a table’s crate::encoding::Codec is one of the Turbovec* variants. The table holds:

  • a turbovec::TurboQuantIndex storing every vector in its 2/3/4-bit packed form (where the 8x to 16x compression and SIMD scoring kernels live);
  • a slot-to-id and id-to-slot map so external NodeId handles survive turbovec’s positional layout;
  • a parallel Vec<Option<NodeId>> indexed by turbovec slot, used to translate the search results’ positional indices back into stable ids.

Concurrency mirrors the HNSW path: the storage layer holds a per-table Mutex across an insert / search call.

§Distance handling

turbovec returns an inner-product-style similarity score per candidate. To honour crate::distance::Distance semantics, TurboTable L2-normalises queries and stored vectors at ingest time when the table’s metric is Cosine or Euclidean, so the SIMD score becomes an estimate of cos(theta). The reported SearchResult::score is then mapped to the metric’s smaller-is-closer convention so the result aligns with the rest of the engine.

Structs§

TurboTable
Approximate-nearest-neighbour table backed by turbovec::TurboQuantIndex.