Expand description
§Embedding Compression Codec
Production-quality codec for compressing dense embedding vectors using multiple pure-Rust algorithms: scalar quantization, product quantization, delta coding, run-length encoding, and hybrid PQ+RLE.
§Supported Methods
ScalarQuantization— uniform min-max quantization to N bitsProductQuantization— split into subvectors, quantize each independentlyDeltaCoding— delta-encode sorted values, then scalar quantizeRunLengthEncoding— RLE on quantized valuesHybridPQ— product quantization + RLE on residuals
§Example
use ipfrs_semantic::{EmbeddingCompressionCodec, EccMethod, EccCodecConfig};
let mut codec = EmbeddingCompressionCodec::new();
let id = codec.register_codec("my-sq8", EccMethod::ScalarQuantization, 8, 64);
let embedding = vec![0.1f64; 128];
let compressed = codec.compress(id, &embedding).unwrap();
let decompressed = codec.decompress(&compressed).unwrap();
let mse = codec.reconstruction_error(&embedding, &decompressed);
assert!(mse < 1e-3);Structs§
- EccCodec
Config - Configuration for creating a new codec.
- EccCodec
Spec - Registered codec specification stored in the codec registry.
- EccCodec
Stats - Aggregate statistics returned by
EmbeddingCompressionCodec::codec_stats. - EccCompressed
- Output of a compression operation.
- EccCompression
Record - One entry in the codec’s compression audit log.
- Embedding
Compression Codec - Codec for compressing dense embedding vectors.
Enums§
- EccError
- Errors produced by
EmbeddingCompressionCodec. - EccMethod
- Compression algorithm used by a codec.
Type Aliases§
- EccCodec
Id - Numeric identifier for a registered codec.
- EccEmbedding
Compression Codec - Type alias for the codec itself.