Expand description
Quantization error tracking for INT8/binary quantization.
This module measures and bounds quantization error introduced by INT8 or binary quantization, enabling monitoring of search quality degradation over time.
§Overview
Quantization reduces memory usage and speeds up distance computations, but at the
cost of precision. The QuantizationErrorTracker accumulates per-vector error
measurements and exposes rolling statistics (MSE, MAE, p99 MSE, SNR) to help
operators decide when re-indexing or parameter tuning is necessary.
§Example
use ipfrs_semantic::quantization_error::{QuantizationErrorTracker, QErrorError};
let mut tracker = QuantizationErrorTracker::new();
let original = vec![0.1_f32, 0.2, 0.3, 0.4];
let quantized = vec![0.1_f32, 0.2, 0.3, 0.4]; // perfect quantization
let err = tracker.compute_error(&original, &quantized).unwrap();
assert!(err.mse < 1e-9);
tracker.record(err);
assert_eq!(tracker.history_len(), 1);Structs§
- Quantization
Error - Quantization error metrics for a single vector pair.
- Quantization
Error Tracker - Tracks quantization error across a rolling window of vectors.
Enums§
- QError
Error - Errors that can be returned from
QuantizationErrorTrackeroperations.