Demystifying Quantizations: Guide to Quantization Methods for LLMs A technical guide from Cast AI explains that quantization, the process of compressing LLM weights to lower-precision data types, is central to balancing throughput, memory, and inference costs, and clarifies that GGUF is a file format, not a quantization algorithm. The guide highlights that GPTQ was the first 4-bit method, AWQ improves accuracy via activation-aware scaling and runs 4.96 seconds vs. 8.78 seconds for GPTQ on a Mistral 7B benchmark on an A100-80GB, and SmoothQuant enables W8A8 integer inference. It notes that a 70B model requiring ~140 GB in fp16 fits on a single A100-80GB when quantized to Q4_K_M (~42 GB), making quantization a practical infrastructure decision. Selecting which LLM to deploy means balancing throughput, memory footprint, accuracy, and LLM inference costs https://cast.ai/blog/llm-inference-cost-optimization/ . Quantization sits at the center of that balance. It is the process of constraining a model’s values from a continuous or large set to a discrete, lower-precision set. The term “quantization” appears constantly alongside high-throughput serving engines like vLLM, SGLang, and Triton. Yet few resources make quantization methods approachable for practitioners who aren’t deep-learning researchers. Even the vLLM documentation lists GGUF under quantization options, which leads many readers to assume GGUF is a quantization algorithm. It is not. GGUF is a file format. This guide will make that distinction, and many others, clear. There is a well-known quote by Tim Dettmers that captures the essence of quantization research perfectly: “Quantization research is like printers. Nobody cares about printers. Nobody likes printers. But everybody is happy if printers do their job.” Tim Dettmers Key Takeaways - Quantization converts model weights and sometimes activations to lower-precision data types, reducing memory usage and, in many cases, improving inference speed. - Post-training quantization PTQ applies after training and is the practical default for open-source LLMs. Quantization-aware training QAT yields better accuracy at 4-bit and below but requires a full training run. - GPTQ W4A16 was the first method to compress LLMs to 4-bit precision. AWQ improves on it by applying activation-aware per-channel scaling to protect the most sensitive weights before quantization, resulting in better accuracy and faster inference. SmoothQuant enables full W8A8 integer inference by migrating quantization difficulty from activations to weights. - GGUF is a container file format, not a quantization algorithm. It packages weights, tokenizer, and metadata in one portable file. The weights inside a GGUF file can be quantized at various levels Q4 0, Q4 K M, Q5 K M, Q8 0 . - On a Mistral 7B benchmark on an A100-80GB, AWQ completes inference in 4.96 seconds vs. 8.78 seconds for GPTQ, a meaningful gap for latency-sensitive workloads. - Hardware support determines which quantization types actually accelerate inference. Not every GPU supports every format natively. - A 70B model that requires ~140 GB in fp16 fits on a single A100-80GB GPU when quantized to Q4 K M ~42 GB , making quantization a practical infrastructure decision, not just an accuracy trade-off. Why quantization? Recap of data types used in LLMs To understand quantization, start with a quick recap of the data types involved. When you download an open-source model, the neural network inside is essentially a collection of numbers stored across multiple files with accompanying metadata. The precision data type chosen for those numbers determines both model size and computational cost. Integers Integers are the most basic data type, represented as a sequence of bits. They are straightforward, efficient, and inexpensive to compute with, but they sacrifice precision. For example, representing a bank account balance solely with integers would be highly unreliable. The same trade-off applies when representing the weights of a large model. Floating-point number representation When you need to represent fractional values with high precision, floating-point number representation is the answer. The governing standard is IEEE 754 https://en.wikipedia.org/wiki/IEEE 754 . Single precision In a 32-bit representation: - 1 bit is reserved for the sign, allowing both positive and negative values. - 8 bits are allocated to the exponent, which defines the range of representable values: essentially how large or small a number can be. - 23 bits are used for the mantissa, which determines the level of precision. A 32-bit floating-point number single precision was the dominant format for training neural networks throughout most of deep learning history. Half precision The IEEE 754 standard also defines double precision 64-bit and half precision 16-bit . Double precision is not widely used in LLM deployment, so it is skipped here. Half precision has become the de facto standard for newly released models, with an important twist. Most recently published models do not follow the standard 16-bit format even when labeled as 16-bit. The twist: Google invented a format called bfloat brain floating point , which is now the standard for publishing unquantized models. bfloat The difference lies in how bf16 splits bits between exponent and mantissa. bfloat16 uses the same number of exponent bits as IEEE single-point precision fp32 , making conversion between bf16 and fp32 straightforward. It keeps the same dynamic range as fp32 but sacrifices precision in the mantissa. For LLM training and serving, this is a favorable trade-off: dynamic range matters more than fine-grained precision. 4-bit numbers Finally, consider 4-bit numbers such as int4 and fp4. Models can technically be quantized using binary or ternary schemes, but those fall outside the scope here. In practice, 4-bit precision is the lowest useful level applied in post-training quantization. Each format presents its own trade-offs. fp4 e1m2 prioritizes precision over dynamic range and can represent infinite or NaN values. fp4 e3m0 sacrifices that capability, making it unable to represent NaN or infinite values. The number of bits allocated to exponent vs. mantissa directly determines the range of values the format can handle. Model size impact is significant here. For the Qwen3-32B https://huggingface.co/Qwen/Qwen3-32B model, moving from fp16 to a 4-bit format means roughly 45 GB less memory needed. That difference determines which GPUs can run the model and how expensive inference becomes. Energy needed to execute per format With data types defined, it is worth examining the energy efficiency of different formats. The table below from Mark Horowitz’s Computing’s Energy Problem article https://gwern.net/doc/cs/hardware/2014-horowitz-2.pdf shows the energy required to perform specific operations depending on the numerical format used. The choice of number format and operation significantly impacts the efficiency of ML pipelines. Integer operations are substantially cheaper than floating-point operations of the same width. This is why reducing the precision of model weights translates directly into lower inference energy costs, not just lower memory usage. Intuition behind the neural network quantization: common types of values and operations Before diving into quantization algorithms, it helps to recall what a forward pass actually computes. The diagram below illustrates a single artificial neuron. Regardless of model architecture, each neuron applies weight adjustments followed by an activation function. The output is unbounded and can range from negative infinity to positive infinity. The sigma symbol in the diagram represents a placeholder for any general activation function, not specifically the sigmoid. Before the activation function applies, the output can span the entire real number range depending on inputs and weights. From this picture, the key components to keep in mind are: - Weights - Activations - Bias - Inputs Each quantization method handles these components differently when quantizing the network. Weights are quantized in all practical methods. Activation values are handled differently: some methods leave them in fp16, others quantize them too. That distinction drives most of the performance and accuracy differences between the approaches discussed later. Quantization: a short history Quantization as an idea did not originate in machine learning. It came from signal processing. Before 2017, quantization for neural networks was mostly an academic topic. Then the paper Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference https://arxiv.org/pdf/1712.05877 changed that. For the first time, researchers had solid evidence that they could apply quantization in production. TensorFlow Lite implemented the methods from that paper using a linear quantization approach. Two common methods were established in this era: - K-means-based quantization - Linear quantization Both methods originated well before the Transformer architecture. They were widely applied to convolutional neural networks CNNs , which at the time represented the primary commercial workload in deep learning. K-means-based quantization Weights in any given layer are typically normally distributed with a small number of outliers. The graph below shows the weight density of a pruned and fine-tuned model, where the distribution appears bimodal rather than normal. Values near zero were pruned, and the graph reproduces results from the Deep Compression https://arxiv.org/abs/1510.00149 paper. Once K-means quantization is applied, the weight distribution becomes discrete. Only a few centroids remain, as shown in the image below. In short: K-means clustering is applied to the input weights, finding 2