What is AI scalar quantisation?

Scalar quantisation is a quantisation method compressing an embedding by converting each dimension separately, usually from a 32-bit floating point value to an 8-bit integer; each dimension's value range is split into equal bins and a value is stored as its bin's code.

Unlike product quantisation, which splits a vector into sub-vectors each represented by the nearest centroid in a learned codebook for far higher compression, scalar quantisation treats each dimension independently, is simpler and costs less accuracy. Binary quantisation is the extreme case of one bit per dimension.

Topic
Embeddings, document processing and RAG
Also known as
Int8 quantisation, SQ

How AI scalar quantisation works

  1. Each dimension's minimum and maximum (or percentile bounds) are found from sample vectors.
  2. Each dimension's range is split into 256 equal bins for 8 bits.
  3. Each value is stored as the integer code of its bin.
  4. Search computes similarity on the codes; top candidates can be rescored with full vectors.

In more detail

The affine mapping formula and SIMD distance computation

Scalar quantisation typically uses an affine mapping: the minimum is subtracted from each value and the result is divided by a scale and rounded to an integer, the scale being the value range divided by one less than the number of codes the bit width allows. Inner products or L2 distances computed directly on integer codes still account for these scale and offset terms through SIMD integer instructions, such as AVX-512 VNNI or ARM dot-product instructions.

Oversampling and full-precision rescoring

Production vector databases pair scalar quantisation with a two-stage search pipeline: first retrieving an oversampled candidate set (for instance, top 4x requested results) using fast in-memory INT8 codes, then rescoring those candidates with full-precision vectors stored on disk or in secondary memory to recover near-100% recall.

Quantile clipping, outliers and distribution drift

Using strict min/max bounds stretches all bins to cover outliers, wasting precision where most coordinates cluster. Enterprise engines therefore use percentile clipping (e.g., 99% quantile) or per-dimension versus global bounds; however, if newly ingested documents shift the embedding distribution, periodic recalibration is needed to prevent silent recall degradation.

4-bit scalar quantisation, LVQ and RaBitQ

Beyond standard INT8 scalar quantisation, 4-bit scalar quantisation (INT4/SQ4) and Locally-adaptive Vector Quantisation (LVQ) offer 8x compression over FP32 with tight error bounds, while RaBitQ provides theoretically bounded error for ultra-compact binary-like codes, making hybrid MRL truncation plus SQ8/SQ4 a common RAG baseline.

Commonly confused terms

TermHow it differs
Model weight quantisationModel weight quantisation (e.g., GPTQ, AWQ, GGUF Q4_K_M) compresses neural network parameters to speed up LLM inference and reduce VRAM; embedding scalar quantisation compresses stored document vectors inside a vector database index for similarity search.
Matryoshka representation learning and dimension truncationMatryoshka Representation Learning (MRL) reduces vector size by truncating trailing dimensions (e.g., 1536 to 256 dimensions) during embedding training, whereas scalar quantisation keeps all dimensions and reduces the bit-width per dimension (e.g., 32 bits to 8 bits).

Why AI scalar quantisation matters for on-premises AI

Storing 8-bit codes instead of 32-bit values cuts vector data to a quarter, helping large in-house indexes fit the same hardware. The paper proposing quantisation for integer-only neural network inference shows integer arithmetic runs more efficiently than floating point on common hardware, improving the accuracy versus latency trade-off. The paper describing a widely used vector search library counts vector compression among its core functions and treats method choice as a trade-off of speed, memory and accuracy.

ON-PREMISES EXAMPLE

A travel company compresses embeddings of its hotel and tour descriptions with scalar quantisation, retiring the full-precision index once validation queries show retrieval precision has not fallen below its accepted threshold.

Common questions

How much accuracy does scalar quantisation cost?

It depends on model and data and should be measured with validation queries. Rescoring top candidates with full vectors reduces the loss.

How does it differ from binary quantisation?

Scalar quantisation usually stores each dimension in 8 bits, binary in one bit. Binary takes far less space but loses more information.

Sources

In the glossary: Glossary, R to Z

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.