Skip to main content

hermes_core/structures/vector/
mod.rs

1//! Vector indexing data structures
2//!
3//! This module provides a modular architecture for vector search:
4//!
5//! ## Module Structure
6//!
7//! - `ivf` - Core IVF (Inverted File Index) infrastructure
8//!   - `CoarseCentroids` - k-means clustering for coarse quantization
9//!   - `SoarConfig` / `MultiAssignment` - SOAR geometry-aware assignment
10//!
11//! - `quantization` - Residual product quantization
12//!   - `PQCodebook` - the index-global OPQ codebook
13//!
14//! - `index` - Segment payloads for the production ANN implementations
15//!   - `IVFPQIndex` - float vectors with residual PQ codes
16//!   - `BinaryIvfIndex` - exact packed binary vectors
17//!
18//! ## SOAR (Spilling with Orthogonality-Amplified Residuals)
19//!
20//! The IVF module includes Google's SOAR algorithm for improved recall:
21//! - Assigns vectors to multiple clusters (primary + secondary)
22//! - Secondary clusters chosen to have orthogonal residuals
23//! - Improves recall by 5-15% with ~1.3-2x storage overhead
24
25pub mod index;
26pub mod ivf;
27mod kmeans;
28pub mod quantization;
29
30// IVF core
31pub use ivf::{CoarseCentroids, CoarseConfig, IvfProbePlan, MultiAssignment, SoarConfig};
32
33// Quantization
34pub use quantization::{DistanceTable, PQCodebook, PQConfig};
35
36// Indexes
37pub use index::{
38    BinaryCoarseQuantizer, BinaryIvfConfig, BinaryIvfIndex, IVFPQConfig, IVFPQIndex, IvfPqQueryPlan,
39};