OptimizedScalarQuantizer

class OptimizedScalarQuantizer(similarityFunction: VectorSimilarityFunction, lambda: Float = DEFAULT_LAMBDA, iters: Int = DEFAULT_ITERS)

This is a scalar quantizer that optimizes the quantization intervals for a given vector. This is done by optimizing the quantiles of the vector centered on a provided centroid. The optimization is done by minimizing the quantization loss via coordinate descent.

Local vector quantization parameters was originally proposed with LVQ in Similarity search in the blink of an eye with compressed indices This technique builds on LVQ, but instead of taking the min/max values, a grid search over the centered vector is done to find the optimal quantization intervals, taking into account anisotropic loss.

Anisotropic loss is first discussed in depth by Accelerating Large-Scale Inference with Anisotropic Vector Quantization by Ruiqi Guo, et al.

Constructors

Link copied to clipboard
constructor(similarityFunction: VectorSimilarityFunction, lambda: Float = DEFAULT_LAMBDA, iters: Int = DEFAULT_ITERS)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class QuantizationResult(val lowerInterval: Float, val upperInterval: Float, val additionalCorrection: Float, val quantizedComponentSum: Int)

Quantization result containing the lower and upper interval bounds, the additional correction

Functions

Link copied to clipboard

Quantize the vector to the multiple bit levels.

Link copied to clipboard

Quantize the vector to the given bit level.