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` - TurboQuant training-free codec
12//! - `TqCodec` - derived rotation/codebook, no trained artifacts
13//!
14//! - `index` - Segment payloads for the production ANN implementations
15//! - `IvfTqIndex` - float vectors with TQ-coded centroid residuals
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(crate) mod progress;
29pub mod quantization;
30
31#[cfg(feature = "native")]
32pub(crate) use kmeans::estimated_euclidean_kmeans_distance_multiplier;
33
34// IVF core
35pub use ivf::{CoarseCentroids, CoarseConfig, IvfProbePlan, MultiAssignment, SoarConfig};
36
37// Quantization
38#[cfg(feature = "native")]
39pub use quantization::TqFlatBuilder;
40pub use quantization::{TqCodec, TqQueryPlan};
41
42// Indexes
43pub use index::{
44 BinaryCoarseQuantizer, BinaryIvfConfig, BinaryIvfIndex, IvfTqIndex, TqIvfEncodeScratch,
45 TqIvfQueryPlan, is_ivf_tq_cosine_generation, mark_ivf_tq_cosine_generation,
46};