Understanding AI Hardware

Precision and Quantization for Local Inference

Plan accuracy gates when reducing precision: understand PyTorch quantization modes, calibration data, and how INT8/INT4 trade memory and quality on real prompts.

Quick Answer & Decision Summary

Plan accuracy gates when reducing precision: understand PyTorch quantization modes, calibration data, and how INT8/INT4 trade memory and quality on real prompts.

Scope & Audience: ML engineers and platform teams shipping quantized local models. ·

Who this is for

ML engineers and platform teams shipping quantized local models.

Learning objectives

  • Distinguish training-time, post-training and runtime quantization paths.
  • Define a calibration set and accuracy metric before changing bit-width.
  • Relate weight-only versus activation quantization to memory and latency.
  • Document dtype and quant scheme in the model artifact manifest.
  • Reject brochure TOPS claims that omit the precision used in measurement.

Precision is a product decision, not a flag

Reducing numeric precision is the most common way to fit local models into Mini PC and edge memory envelopes. It is also an easy way to silently degrade quality if you treat quantization as a checkbox. Bit-width changes the numeric contract of the artifact you ship; treat it like a versioned product SKU.

PyTorch’s quantization documentation describes multiple approaches, including post-training quantization and quantization-aware patterns, with explicit attention to observers, qconfigs and backend availability. Your stack may use GGUF quants, ONNX/ORT quant tools or vendor compilers instead—but the discipline is identical: name the scheme, calibrate, measure, pin.

Never compare latency across precisions without stating the dtype. An INT8 NPU number and an FP16 GPU number answer different questions. Capacity planning wants bytes and bandwidth; product acceptance wants task metrics at the shipped precision.

Track quantization SKUs in the same registry as model names so support tickets cite Q4_K_M versus INT8-PTQ instead of “the compressed one.”

Require sign-off from both ML and platform owners before shipping a coarser bit-width to production.

Operational addendum 1 for precision-quantization: keep manifests, measurements, power envelopes and rejection reasons written beside the model hash; unspoken tribal knowledge is not a deployment strategy for SER-002 chapter 3. Rehearse the acceptance checks after every runtime or BSP bump, and refuse silent EP fallbacks on the hot path.

Operational addendum 7 for precision-quantization: keep manifests, measurements, power envelopes and rejection reasons written beside the model hash; unspoken tribal knowledge is not a deployment strategy for SER-002 chapter 3. Rehearse the acceptance checks after every runtime or BSP bump, and refuse silent EP fallbacks on the hot path.

Weight-only versus weights-and-activations

Weight-only quantization compresses parameters while keeping activations in higher precision. It primarily shrinks storage and memory bandwidth for weight reads—often the limiter for single-stream LLM decode. Activation quantization additionally constrains the dynamic tensors in the forward pass and can unlock integer pipelines on NPUs and some DSPs.

Edge vision deployments frequently need both: INT8 weights and activations to match compiler expectations on accelerators that lack wide FP units. LLM GGUF-style deployments on CPUs often use multi-bit weight quants with higher-precision accumulators. Copying a vision INT8 recipe onto an LLM—or the reverse—without measuring task quality is cargo-cult compression.

Record which tensors are quantized in the manifest. “Q4” without naming weight-only versus full integer paths is not reproducible. Include calibration method (minmax, histogram, entropy) when the toolchain exposes it.

When activations stay high precision, document expected bandwidth savings from weight-only paths so capacity planners do not assume NPU integer pipelines.

Operational addendum 2 for precision-quantization: keep manifests, measurements, power envelopes and rejection reasons written beside the model hash; unspoken tribal knowledge is not a deployment strategy for SER-002 chapter 3. Rehearse the acceptance checks after every runtime or BSP bump, and refuse silent EP fallbacks on the hot path.

Operational addendum 8 for precision-quantization: keep manifests, measurements, power envelopes and rejection reasons written beside the model hash; unspoken tribal knowledge is not a deployment strategy for SER-002 chapter 3. Rehearse the acceptance checks after every runtime or BSP bump, and refuse silent EP fallbacks on the hot path.

Calibration data and accuracy gates

Post-training quantization needs representative calibration inputs. If you calibrate on clean centered ImageNet crops but production sees night-time RTSP frames, the scales will be wrong. Build a calibration corpus from production-like captures and freeze it beside the model hash.

ONNX Runtime quantization tooling documents how to produce quantized ONNX models and emphasizes configuration choices that affect operator support and accuracy. After quantization, run the same evaluation harness you use for the FP baseline: top-1/top-5, F1, exact-match, or rubric scores for generative tasks. Set a maximum allowed drop before the artifact can be tagged releasable.

For generative models, automated metrics alone mislead. Keep a small human or golden-prompt suite that catches refusal regressions, code breakage and language mixups that BLEU-style scores miss. Gate releases on both automatic and golden suites.

Version the calibration corpus; a floating “random sample of production” is not auditable after an incident.

Operational addendum 3 for precision-quantization: keep manifests, measurements, power envelopes and rejection reasons written beside the model hash; unspoken tribal knowledge is not a deployment strategy for SER-002 chapter 3. Rehearse the acceptance checks after every runtime or BSP bump, and refuse silent EP fallbacks on the hot path.

Hardware support is uneven across dtypes

Not every execution provider accelerates every quantized op. An INT8 graph may partially fall back to CPU, destroying the latency win while keeping the accuracy loss. After quantization, dump the EP assignment and fail CI if hot-path nodes leave the intended device.

NPUs and some mobile accelerators are happiest with static shapes plus integer pipelines. GPUs may prefer FP16/BF16 tensor cores and treat aggressive INT4 as a memory optimization more than an arithmetic one, depending on kernels. Re-read chapter 1: device role and precision travel together.

Power and thermals shift with precision too. Lower bit-width can raise tokens per joule, but only if the kernels actually run on the accelerator. Measure wall power at the shipped dtype during the soak test from chapter 2.

Add canary traffic at the new precision beside the old for a soak window when risk is high; compare task metrics, not only latency.

Operational addendum 4 for precision-quantization: keep manifests, measurements, power envelopes and rejection reasons written beside the model hash; unspoken tribal knowledge is not a deployment strategy for SER-002 chapter 3. Rehearse the acceptance checks after every runtime or BSP bump, and refuse silent EP fallbacks on the hot path.

Practical ladder: choose the coarsest precision that passes

Start from the highest precision that fits your latency and memory budgets, then step down only while accuracy gates stay green. A useful local ladder for LLMs is FP16/BF16 → 8-bit weights → 4-bit weights, stopping at the first level that meets both capacity and quality. For vision classifiers on edge NPUs, begin with the vendor’s supported INT8 path rather than inventing a custom FP16 route the compiler rejects.

Keep the parent higher-precision artifact in object storage even if production serves a quant. Rollback is part of quantization hygiene: when a compiler upgrade shifts scales, you need a known-good parent to requantize.

Hand the pinned quantized artifact to chapter 4—model formats and runtimes—where operator coverage and file formats decide whether that precision can actually execute on the chosen EP.

Record joules or wall watts at each precision step on the same host to prove efficiency claims.

Operational addendum 5 for precision-quantization: keep manifests, measurements, power envelopes and rejection reasons written beside the model hash; unspoken tribal knowledge is not a deployment strategy for SER-002 chapter 3. Rehearse the acceptance checks after every runtime or BSP bump, and refuse silent EP fallbacks on the hot path.

Checklist before you ship a quantized build

Confirm: scheme name, bit-widths per tensor class, calibration corpus hash, accuracy delta versus baseline, EP map with no surprise CPU fallback on the hot path, memory worksheet updated, and golden prompts reviewed.

Publish those fields in the internal release note even if the public article stays high level. Future you will not remember why Q5_K_M beat Q4_K_M on your support tickets.

If any checkbox fails, do not “ship and watch.” Quantization bugs show up as subtle product quality issues that users blame on the model brand, not your bit-width.

Refuse vendor slides that omit dtype from TOPS or FPS numbers; send them the checklist from this chapter as the reply template.

Operational addendum 6 for precision-quantization: keep manifests, measurements, power envelopes and rejection reasons written beside the model hash; unspoken tribal knowledge is not a deployment strategy for SER-002 chapter 3. Rehearse the acceptance checks after every runtime or BSP bump, and refuse silent EP fallbacks on the hot path.

Technical Glossary

SODIMM
Small Outline Dual In-Line Memory Module — compact modular RAM form factor used in laptops and most socketed Mini PCs.
NPU
Neural Processing Unit — dedicated silicon block optimized for low-power, fixed-precision AI inference.
UCFF
Ultra-Compact Form Factor — roughly 4x4 inch (10x10 cm) Mini PC motherboard and chassis class (typically 0.5–1.5 L).
PCIe lane
A point-to-point serial data link (Tx/Rx pair) connecting the CPU to NVMe SSDs, NICs, or expansion cards.
ECC
Error-Correcting Code memory — detects and corrects single-bit memory errors for unattended server stability.
UEFI
Unified Extensible Firmware Interface — modern system firmware controlling boot, power limits, fan curves, and auto power-on.
NAND
Non-volatile flash memory cells used inside SSDs; endurance and sustained write behavior depend on controller and cache.

Sources

Claim-to-source map

Related technologies

Next Step
Model formats and runtimes
Read next guide →Buying checklist →

Continue learning

View Structured Data Asset (JSON) · DA-RIG-ART-016 · Central Intelligence Hub Ready