Systems session 2/4 · Learner course

CPU vs GPU and quantization

Hardware fit depends on workload shape. Quantization can reduce model-weight memory, but compatibility, latency, and task quality still require measurement.

Prefill is parallel across positions; decode is sequentialPrefillDecodeall prompt tokens at onceone token at a time
Prefill is parallel across positions; decode is sequential

What you will be able to do

2-hour session

CPU and GPU roles

CPUs excel at general control flow, preprocessing, and modest workloads. GPUs expose many parallel arithmetic units and high memory bandwidth for dense tensor operations. Prefill is highly parallel; autoregressive decode remains sequential across token positions.

Memory estimate

A first weight-memory estimate is parameters × bits per weight ÷ 8. It excludes KV cache, activations, allocator overhead, runtime buffers, metadata, and sometimes unquantized layers.

Quantization release gate

Compare the quantized candidate with a higher-precision baseline on representative tasks. Record quality, time to first token, inter-token latency, throughput, peak memory, hardware, runtime, and artifact hash.

Open the interactive — CPU vs GPU Open the interactive — quantization

Quick check

Does a smaller model file guarantee lower latency?

Show answer

No. Kernel support, dequantization, workload, and hardware can make a smaller artifact slower.

Does weight quantization automatically shrink KV cache?

Show answer

No. KV-cache precision and weight precision are separate choices.

Practise this

Work the three labs, then check yourself against the 10-question quiz.

Go to the exercises · Take the quiz