Skip to content
Blog

Scalar Quantisation and int8 Vector Storage in Production

How scalar quantisation converts float32 embeddings to int8 for 4x smaller storage and faster scans, with practical accuracy safeguards.

Published on • November 22, 2026

AI Assistant

Introduction

If product quantisation feels heavy-handed, scalar quantisation (SQ) is the simpler cousin: round each number in the vector to a smaller numeric type. Convert float32 embeddings to int8 and you cut storage and bandwidth by 4× with a degradation profile that is easy to understand — and usually easy to defend.

How Scalar Quantisation Works

Instead of learning codebooks (as PQ does), scalar quantisation applies a per-dimension (or global) mapping from floats to a discrete grid:

  1. Observe the value range of each dimension (or the whole vector): [min, max].
  2. Divide that range into 255 intervals (for int8).
  3. Map every float to the nearest integer level; store the int8.
  4. At query time, either dequantise on the fly or compute distances directly in integer arithmetic.
q(x) = round((x − min) / (max − min) × 255)   // → 0..255

Variants include uniform quantisation (equal-width bins), non-uniform bins (fit a distribution), and asymmetric distance computation — where the query stays float and only the database is quantised, avoiding double error.

SQ vs PQ

Scalar quantisation (int8)Product quantisation
MechanismPer-value roundingSubvector codebook lookup
Compression4× (float32 → int8)8–64×
ErrorSmall, bounded per valueLarger, structural
Recall impactTypically 0.98–0.99+0.90–0.97 (needs rescore)
ImplementationTrivialRequires trained codebooks
Distance computeFast integer opsTable lookups + adds

SQ is the “almost free” compression: 4× memory for a fraction of a recall point. PQ is the aggressive one for when 4× is not enough.

Production Considerations

  • Calibrate on real data. Min/max per dimension from a sample of your actual corpus; outliers stretch ranges and waste levels. Percentile clipping (e.g., 1st–99th) often helps.
  • Keep a rescore path. Store int8 in the hot index; rescore the top-100 candidates from float originals (or from a coarser store) if you need the last recall points.
  • Watch the metric. SQ interacts better with dot product/Euclidean under asymmetric computation than with plain cosine on quantised query and database.
  • int8 SIMD is fast. Modern CPUs multiply int8 pairs in wide registers; many workloads get faster scans despite the dequant step, because memory bandwidth — not arithmetic — is the bottleneck.
  • A/B against ground truth. Measure recall@10 vs your float baseline before shipping; int8 regressions are usually < 1%.

When to Use int8 SQ

  • Memory is ~4× too large with float32 but PQ feels like overkill
  • You want simple, explainable compression with no training step
  • Latency is bandwidth-bound and you suspect smaller data will scan faster
  • Combined with PQ for a two-stage design (int8 or PQ for scan, float for rescore)

Conclusion

Scalar quantisation is the pragmatic middle ground of vector compression: divide each dimension’s range into 256 levels, store bytes instead of floats, and recover almost all recall — especially with a rescore stage. For most production teams’ first step below float32, int8 is the right move.

References