← Back to AI Engineering Mind Map
🤖 AI EngineeringID: scalar-quantization-sq8

Scalar Quantization (SQ8/SQ4)

SQ8/SQ4 标量量化
🎯Core Definition
Scalar Quantization (SQ) is a vector compression technique that independently maps each component of a high-dimensional vector to discrete fixed-point integers; SQ8 linearly projects 32-bit floating point (FP32) values across dimension ranges [mind,maxd][min_d, max_d] into 8-bit unsigned integers (uint8) via q=round(255⋅x−min⁡max⁡−min⁡)q = \text{round}\left(255 \cdot \frac{x - \min}{\max - \min}\right), while SQ4 compresses down to 4-bit nibbles, achieving 4x to 8x memory reduction.
💡Use Cases
Building massive vector indices (tens of millions to billions of vectors) under memory constraints in vector databases, serving as raw vector caching or coarse pruning for HNSW.
⚡Key Problems Solved
100M 1536-dimensional FP32 vectors require 614GB RAM for raw storage, exceeding single-node capacity; SQ8 compresses this to ~153GB and leverages AVX-512 / VNNI integer SIMD instructions for blazing fast distance calculation while maintaining 98%+ Recall@10.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Scalar Quantization (SQ8/SQ4).
Use Cases
In production engineering, what are the primary use cases for Scalar Quantization (SQ8/SQ4) and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Derive the SQ8 linear quantization and de-quantization formulas and source of precision loss?
2
What is the Recall difference between Global SQ and Per-Dimension SQ under heavy-tailed distribution?
3
How do modern CPU AVX-512 VNNI instructions accelerate int8 dot product operations?
4
Compare SQ8 vs PQ in terms of memory compression ratio, index construction time, and reconstruction error?
5
Why does SQ8 recall rate improve after applying outlier clipping / percentile thresholding?
Updated 2026-08-14
🎯
Verify Mastery: Practice Exam Questions for "Scalar Quantization (SQ8/SQ4)"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardVector Distance Metrics & L2 NormalizationNext Card →Product Quantization (PQ)

🔗 More AI Engineering Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/AI_Engineering/card/scalar-quantization-sq8
中文速览与面试要点

SQ8/SQ4 标量量化 (Scalar Quantization (SQ8/SQ4))

定义: 标量量化 (Scalar Quantization, SQ) 是一种针对高维向量各个分量进行独立线性定点映射的压缩技术;SQ8 将 32 位浮点数 (FP32) 按分量动态范围 [min_d, max_d] 线性映射为 8 位无符号整数 (uint8) q = round (255 x - - ),SQ4 则进一步压缩至 4 位半字节 (nibble);整体实现 4x (SQ8) 至 8x (SQ4) 的内存压缩。 使用场景: 向量数据库在内存受限环境下构建海量(千万至数亿级)向量索引,作为 HNSW 原始向量存储缓存层或粗排剪枝层。 解决的问题: 1 亿条 1536 维 FP32 向量裸存储需高达 614GB 内存,单机内存无法装载;SQ8 将其压缩至 153GB,且配合 AVX-512 / VNNI 指令集可直接在 int8 整数上并行计算距离,显著提升检索吞吐并保持 98%+ 的 Recall@10 召回率。

核心要点

  • 推导 SQ8 的线性量化与反量化 (De-quantization) 公式及精度损失来源?
  • 全局均匀量化 (Global SQ) 与分维度量化 (Per-Dimension SQ) 在长尾分布下的 Recall 差异?
  • 现代 CPU 的 AVX-512 VNNI 指令如何加速 int8 向量的点积运算?
  • 对比 SQ8 与 PQ (乘积量化) 在内存压缩比、索引构建时间与重构误差上的优劣?
  • 为什么在向量经过异常值截断 (Outlier Clipping / Min-Max Percentile) 后,SQ8 的召回率会有所上升?