pub struct WarpIndexConfig {
pub nbits: u8,
pub num_centroids: usize,
pub token_dim: usize,
pub min_training_samples: Option<usize>,
pub kmeans_iterations: usize,
}Expand description
Configuration for WARP index construction.
These parameters control the compression quality and index structure. The default values provide a good balance of memory efficiency and retrieval quality for most use cases.
§Parameter Guidance
| Corpus Size | nbits | num_centroids |
|---|---|---|
| < 100K docs | 4 | 256 |
| 100K - 1M | 2 | 1024 |
| > 1M docs | 2 | 4096 |
Fields§
§nbits: u8Bits per dimension for residual quantization (2 or 4).
- 2-bit: 16× compression, ~3-5% MRR loss
- 4-bit: 8× compression, ~1-2% MRR loss
num_centroids: usizeNumber of centroids for IVF clustering.
More centroids provide finer-grained partitioning but require more memory for centroid storage. Typical values: 256-4096.
token_dim: usizeToken embedding dimension (e.g., 128 for ColBERT).
min_training_samples: Option<usize>Minimum training samples for codec training.
Should be at least 10 × num_centroids for stable clustering. If None, defaults to 10 × num_centroids.
kmeans_iterations: usizeK-means iterations for centroid training.
Implementations§
Source§impl WarpIndexConfig
impl WarpIndexConfig
Sourcepub fn new(nbits: u8, num_centroids: usize, token_dim: usize) -> Self
pub fn new(nbits: u8, num_centroids: usize, token_dim: usize) -> Self
Create a new configuration with the specified parameters.
Sourcepub fn with_min_training_samples(self, samples: usize) -> Self
pub fn with_min_training_samples(self, samples: usize) -> Self
Set the minimum training samples.
Sourcepub fn with_kmeans_iterations(self, iterations: usize) -> Self
pub fn with_kmeans_iterations(self, iterations: usize) -> Self
Set the k-means iterations.
Sourcepub fn effective_min_training_samples(&self) -> usize
pub fn effective_min_training_samples(&self) -> usize
Get the effective minimum training samples.
Sourcepub fn packed_residual_size(&self) -> usize
pub fn packed_residual_size(&self) -> usize
Calculate packed residual size in bytes.
Trait Implementations§
Source§impl Clone for WarpIndexConfig
impl Clone for WarpIndexConfig
Source§fn clone(&self) -> WarpIndexConfig
fn clone(&self) -> WarpIndexConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WarpIndexConfig
impl Debug for WarpIndexConfig
Source§impl Default for WarpIndexConfig
impl Default for WarpIndexConfig
Source§impl<'de> Deserialize<'de> for WarpIndexConfig
impl<'de> Deserialize<'de> for WarpIndexConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for WarpIndexConfig
impl RefUnwindSafe for WarpIndexConfig
impl Send for WarpIndexConfig
impl Sync for WarpIndexConfig
impl Unpin for WarpIndexConfig
impl UnsafeUnpin for WarpIndexConfig
impl UnwindSafe for WarpIndexConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().