Quantization practice problems

22 problems · 0 solved

Quantization stores model weights and activations with fewer bits, such as int8 or int4 instead of float32. This shrinks memory and speeds up inference, which is how large models run on smaller GPUs and laptops. It is like saving a photo with fewer colours: done well, you hardly notice the difference. The trick is choosing scales so the error stays small. In these problems you will quantize activations to uint8 with a scale and zero point, quantize weights to int8 and measure the error, compare per-channel and per-tensor schemes, unpack int4 weights from bytes, round float32 to bfloat16, apply group-wise int4 quantization, search for an activation-aware scale before rounding, migrate activation outliers with SmoothQuant, quantize a weight row GPTQ-style with error feedback, and build block-wise 4-bit codebook quantization with double-quantized scales. Start with the Easy problems on scales, zero points and per-channel error. Then do bfloat16, group-wise int4 and SmoothQuant, and finish with GPTQ and codebook quantization. Teams deploying LLMs depend on quantization to cut cost, and interviewers often ask how it affects accuracy and speed.

Easy 5

Medium 11

Hard 6

Related topics

All practice problems