Notes

Quantization-Aware Training (LLM)

Most compression of a language model happens after training is finished: take the trained weights, round them down, hope the damage is small. Quantization-aware training reverses the order — it lets the model know, while it is still learning, that its weights will end up coarse.

Rounding inside the training loop

The forward pass quantizes each weight to the target precision before using it, so the loss the model sees is the loss it will actually have once deployed. Gradients cannot flow through a rounding step, so a straight-through estimator passes them around it, and the optimizer keeps a full-precision master copy of every weight to accumulate the tiny updates that rounding would otherwise swallow. The model drifts toward weights that sit comfortably on the quantization grid.

Why bother at LLM scale

At 8 bits, post-training methods lose almost nothing and this effort is wasted. The case appears at 3 bits and below, where GPTQ or AWQ start to cost real accuracy and there is nothing left to recover afterwards. Work such as LLM-QAT and the 1-bit BitNet line exists because extreme precisions are only reachable this way.

The price

Because gradients touch the whole network, this is training-scale compute, not a calibration pass over a few hundred samples. In practice it runs as a short quantization-aware fine-tune over a few billion tokens rather than full pretraining, and is reserved for models that will ship at very low precision. Note that QLoRA is not this: there the quantized base stays frozen and only adapters learn.

Quantization-aware training simulates low-precision arithmetic during training: weights are rounded to the target bit-width in the forward pass while full-precision copies accumulate gradient updates, so the model learns weights that survive compression instead of being compressed after the fact. It matters at 3 bits and below, where post-training quantization loses accuracy nothing can recover. The price is training-scale compute, so it is reserved for models destined to ship very small.

Imagine a singer who knows her album will mostly be heard through cheap phone speakers. If she rehearses that way from the start, she chooses notes that survive the squeeze. Shrinking a language model usually happens at the end, like squashing a finished recording. Quantization-aware training does the opposite: while the system is still learning, it is made to practise with the rough, low-detail version of its own numbers. It therefore learns in a way that holds up once compressed. This costs far more effort than compressing afterwards, so it is used only when the model has to be made very small indeed.