Production engineering · about 20 minutes of study

Quantization

Quantization represents weights or activations using lower-precision formats. It can save memory and change speed, with quality and hardware-dependent trade-offs.

Before you start: Review KV cache first. Python-like examples use variables, lists and functions.

Guided concept walkthrough

Follow the mechanism

Baseline

Measure full-precision quality and memory.

1 / 4

A conceptual animation, not a live model trace. Play advances every five seconds and stops at the final stage.

Start with an everyday explanation

A photograph can be stored with fewer color levels. The file becomes smaller, but details may change and the reader must support the format.

See a concrete example

Seven billion parameters require about 14 GB at 16 bits or 3.5 GB at 4 bits before scales, metadata and runtime allocations. These are decimal GB, not total GPU memory.

A claim to question

Four-bit weights do not guarantee a fourfold throughput or concurrency increase.

Try before revealing the answer

Use the GPU calculator to compare 16-bit and 4-bit weights while keeping a long-context cache fixed.

Show the worked answer

Only the modeled weight allocation shrinks. KV state and overhead remain unless independently changed; cache-heavy workloads may still exceed capacity.

Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.

Your explanation and revision notes

Loading local notes…

Read the primary reference

Transformers cache strategies

The explanation and exercises are original teaching material. The linked source provides background; examples and assumed numbers here are not claims about a particular company.