Deep Learning (DL) · Advanced level

Advanced level · Module 4: Deploying Deep Learning Models · Lesson 2 of 4

Compressing Models

Make models smaller and faster with quantisation, pruning and distillation while keeping accuracy.

In this lesson you will

  • Apply post-training quantisation
  • Describe pruning and knowledge distillation

Key concepts

quantisation (8-bit)accuracy droppruningknowledge distillation

The lesson

Quantisation stores weights and calculations in 8-bit integers instead of 32-bit floats, making models about four times smaller and often faster, with a small accuracy drop.

Pruning removes weights or channels that contribute little. Knowledge distillation trains a small 'student' model to imitate a large 'teacher', keeping much of its accuracy.

Measure size, speed and accuracy after each step; stop when the targets are met or accuracy drops too far.

Step by step

  1. Quantise the exported model.
  2. Measure size, speed and accuracy.
  3. Compare with the original.
  4. Decide whether to try distillation.

Practice activity

Compress the project model to meet the size and speed targets.

Expected result: A compressed model with measured trade-offs.

Check your understanding

  1. How much smaller does 8-bit quantisation make a 32-bit model, roughly?

    Show answer

    About four times smaller.

  2. What is knowledge distillation?

    Show answer

    Training a small model to imitate a larger one.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.