Quantization lowers weight precision, for example from FP16 to INT8 or INT4. Distillation trains a small "student" model to mimic a large "teacher". Both shrink footprint and cost.

Quantization and distillation compared

Quantization, distillation & model-size tradeoffsDiagram with these labels, in reading order: Apply Quantization; Apply Distillation; Resulting Model; Benefits; Full Precision; Model (FP32); Quantization; (FP16 to INT8/INT4); Distillation; (Teacher-Student); Smaller Model; (7B or less); Cost & Latency; Reduction.Apply QuantizationApply DistillationResulting ModelResulting ModelBenefitsBenefitsFull PrecisionModel (FP32)Quantization(FP16 to INT8/INT4)Distillation(Teacher-Student)Smaller Model(7B or less)Cost & LatencyReduction
Model optimization techniques overview
TechniqueWhat changesTypical use
QuantizationWeights drop from FP16 to INT8 or INT4, cutting weight memory about 2 to 4 times. GGUF, AWQ and GPTQ are examples.Constrained hardware, such as self-hosted setups and edge devices
DistillationA smaller student trains on the outputs of a larger teacher, so it needs fewer parameters.High-volume tasks where teacher data can be generated

Quantization lets larger models run on smaller GPUs, usually with a small drop in quality at 8-bit and a larger one at 4-bit. A distilled 7 billion parameter model can approach a 70 billion parameter model on a narrow task, though results vary.

Distillation works by feeding the student the teacher's outputs. The student learns to reproduce the teacher's behavior with fewer parameters, which yields a smaller model that keeps much of the accuracy on the target task and uses fewer resources.

The two techniques can be combined. That makes it feasible to run capable models where compute is limited and to deploy them more efficiently.

Where the quality loss shows up first

Both techniques resemble lossy compression or minification. In AI the loss is in model quality, and it is not uniform. Edge cases and complex reasoning tend to degrade first, which can cause unexpected failures. Quantized models can falter on reasoning because of the reduced precision, most often at 4-bit and below.

Quality versus efficiency The savings are large, and the quality loss concentrates in edge cases.

Match model size to the task

A common default is to run the largest model available. That wastes money and adds latency on simple queries. A quantized or distilled model can give comparable results on easier tasks at lower cost and with faster responses. Picking by task demand avoids over-provisioning.

  • Quantize when hardware is limited.
  • Distill when volume is high and you can generate teacher data.
  • Keep full precision for the most complex reasoning.

Serving costs fall, which makes local or edge models more economical.

Example scenario: inference slows after quantization

Suppose inference time rises 30% against a 200 ms ceiling, with accuracy dropping as well. Both figures are illustrative. Aggressive quantization can reduce accuracy, and it can also slow inference when the hardware lacks fast low-precision kernels.

Quantization, distillation & model-size tradeoffsDiagram with these labels, in reading order: High Inference Latency; Check Quantization Levels; Check Distillation Quality; Analyze Weight Precision; Loss; Evaluate Student-Teacher; Gap; Adjust Quantization to; INT8; Improve Distillation; Process.High Inference LatencyCheck Quantization LevelsCheck Distillation QualityAnalyze Weight PrecisionLossEvaluate Student-TeacherGapAdjust Quantization toINT8Improve DistillationProcess
Debugging model efficiency issues
  1. Check the quantization configuration and its effect on performance.
  2. Measure latency and throughput in production against the baseline.
  3. Log accuracy after quantization and compare it with the values before.

Fine-tuning the quantized model can recover accuracy, with a possible small latency increase. Monitor latency and accuracy against thresholds you set, for instance 200 ms and accuracy within 2% of the original, both illustrative.

Back to the knowledge baseRequest an assessment