{"id":1500,"date":"2026-12-04T20:51:03","date_gmt":"2026-12-04T20:51:03","guid":{"rendered":"https:\/\/techlizard.com\/?p=1500"},"modified":"2026-12-04T20:51:03","modified_gmt":"2026-12-04T20:51:03","slug":"llm-quantization-explained","status":"publish","type":"post","link":"https:\/\/techlizard.com\/?p=1500","title":{"rendered":"LLM Quantization Explained"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong class=\"\">Quantization<\/strong> is a technique used to make Large Language Models (LLMs) smaller and faster by reducing the precision of the numbers used to represent their &#8220;weights&#8221; (the learned parameters of the model).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Think of it as <strong class=\"\">compressing<\/strong> the model so that it can run on consumer hardware (like a laptop or a single GPU) instead of requiring a massive data center.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a breakdown of how it works, why we do it, and the trade-offs involved.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. The Basic Concept: Precision vs. Size<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When an LLM is first trained, its weights are usually stored in high-precision formats, such as <strong class=\"\">FP32<\/strong> (32-bit Floating Point).<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong class=\"\">FP32:<\/strong>\u00a0Uses 32 bits to represent a single number. It is extremely accurate but takes up a lot of memory.<\/li>\n\n\n\n<li><strong class=\"\">FP16 \/ BF16:<\/strong>\u00a0Uses 16 bits. This is the standard for &#8220;full-sized&#8221; inference.<\/li>\n\n\n\n<li><strong class=\"\">INT8 \/ INT4:<\/strong>\u00a0Uses 8 bits or 4 bits. These are much smaller.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong class=\"\">The Analogy:<\/strong> Imagine you are describing the color of a room.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong class=\"\">High Precision (FP32):<\/strong>\u00a0You describe the color as\u00a0<em>&#8220;A very specific shade of eggshell white with a hint of warm beige and a slight grey undertone.&#8221;<\/em>\u00a0(Very accurate, but takes a long time to say).<\/li>\n\n\n\n<li><strong class=\"\">Quantized (INT4):<\/strong>\u00a0You just say,\u00a0<em>&#8220;It&#8217;s off-white.&#8221;<\/em>\u00a0(Much faster to say, and for most people, it&#8217;s &#8220;good enough&#8221; to understand the room).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. Why do we need Quantization?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The primary reason is <strong class=\"\">VRAM (Video RAM) limits.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to run a <strong class=\"\">70B parameter model<\/strong> (like Llama-3 70B):<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong class=\"\">In FP16:<\/strong>\u00a0You would need about\u00a0<strong class=\"\">140 GB<\/strong>\u00a0of VRAM just to load the model. Most high-end consumer GPUs (like the RTX 4090) only have 24 GB.<\/li>\n\n\n\n<li><strong class=\"\">In 4-bit Quantization:<\/strong>\u00a0That same model only requires about\u00a0<strong class=\"\">35\u201340 GB<\/strong>\u00a0of VRAM. With further compression (like 3-bit), it can even fit into smaller setups.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong class=\"\">Quantization allows us to:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong class=\"\">Run larger models<\/strong>\u00a0on cheaper hardware.<\/li>\n\n\n\n<li><strong class=\"\">Increase inference speed<\/strong>\u00a0(calculating with integers is often faster than floating-point math).<\/li>\n\n\n\n<li><strong class=\"\">Reduce electricity and hosting costs.<\/strong><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">3. How is it done?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There are two main ways to apply quantization:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong class=\"\">Post-Training Quantization (PTQ):<\/strong>\u00a0This is the most common method. You take a finished, trained model and &#8220;squash&#8221; the weights down to a lower precision. It\u2019s fast and doesn&#8217;t require retraining the model.<\/li>\n\n\n\n<li><strong class=\"\">Quantization-Aware Training (QAT):<\/strong>\u00a0During the actual training process, the model is taught to &#8220;expect&#8221; lower precision. This usually results in a much higher-quality model because it learns to compensate for the loss of detail, but it is much more computationally expensive.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4. Common Quantization Formats<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you\u2019ve been looking at models on Hugging Face, you\u2019ve probably seen these terms:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong class=\"\">GGUF:<\/strong>\u00a0Popular for running models on CPUs (via\u00a0<code>llama.cpp<\/code>). It allows for &#8220;layer-offloading,&#8221; where you can run part of the model on your GPU and part on your RAM.<\/li>\n\n\n\n<li><strong class=\"\">EXL2 \/ GPTQ:<\/strong>\u00a0Optimized for high-speed inference on NVIDIA GPUs.<\/li>\n\n\n\n<li><strong class=\"\">AWQ (Activation-aware Weight Quantization):<\/strong>\u00a0A smarter way to quantize that protects the most &#8220;important&#8221; weights of the model to maintain high accuracy.<\/li>\n\n\n\n<li><strong class=\"\">NF4 (NormalFloat 4):<\/strong>\u00a0Often used with\u00a0<strong class=\"\">QLoRA<\/strong>, a method that allows people to &#8220;fine-tune&#8221; massive models on consumer hardware.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">5. The Trade-off: Accuracy vs. Efficiency<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;cost&#8221; of quantization is <strong class=\"\">Perplexity<\/strong>. Perplexity is a measure of how &#8220;confused&#8221; the model is.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>As you move from 16-bit to 8-bit, the drop in intelligence is usually almost unnoticeable.<\/li>\n\n\n\n<li>As you move down to 4-bit, the model stays very capable but might start making slightly more &#8220;hallucinations&#8221; or lose some nuance in complex reasoning.<\/li>\n\n\n\n<li>If you go too low (like 2-bit), the model usually becomes incoherent and starts outputting gibberish.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Summary Table<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Format<\/th><th class=\"has-text-align-left\" data-align=\"left\">Precision<\/th><th class=\"has-text-align-left\" data-align=\"left\">VRAM Usage (for 70B Model)<\/th><th class=\"has-text-align-left\" data-align=\"left\">Quality<\/th><th class=\"has-text-align-left\" data-align=\"left\">Best Use Case<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\"><strong class=\"\">FP16<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">High<\/td><td class=\"has-text-align-left\" data-align=\"left\">~140 GB<\/td><td class=\"has-text-align-left\" data-align=\"left\">Maximum<\/td><td class=\"has-text-align-left\" data-align=\"left\">Research \/ Production Servers<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><strong class=\"\">INT8<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">Medium<\/td><td class=\"has-text-align-left\" data-align=\"left\">~70 GB<\/td><td class=\"has-text-align-left\" data-align=\"left\">Near-Lossless<\/td><td class=\"has-text-align-left\" data-align=\"left\">High-end Workstations<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><strong class=\"\">INT4<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">Low<\/td><td class=\"has-text-align-left\" data-align=\"left\">~35-40 GB<\/td><td class=\"has-text-align-left\" data-align=\"left\">Very Good<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong class=\"\">Consumer GPUs (Most common)<\/strong><\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><strong class=\"\">2-bit<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">Very Low<\/td><td class=\"has-text-align-left\" data-align=\"left\">~20 GB<\/td><td class=\"has-text-align-left\" data-align=\"left\">Poor<\/td><td class=\"has-text-align-left\" data-align=\"left\">Experimental \/ Very tiny hardware<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Quantization is a technique used to make Large Language Models (LLMs) smaller and faster by reducing the precision of the numbers used to represent their &#8220;weights&#8221; (the learned parameters of the model). Think of it as compressing the model so that it can run on consumer hardware (like a laptop or a single GPU) instead [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1501,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-1500","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-explainer"],"_links":{"self":[{"href":"https:\/\/techlizard.com\/index.php?rest_route=\/wp\/v2\/posts\/1500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techlizard.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techlizard.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techlizard.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techlizard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1500"}],"version-history":[{"count":1,"href":"https:\/\/techlizard.com\/index.php?rest_route=\/wp\/v2\/posts\/1500\/revisions"}],"predecessor-version":[{"id":1502,"href":"https:\/\/techlizard.com\/index.php?rest_route=\/wp\/v2\/posts\/1500\/revisions\/1502"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techlizard.com\/index.php?rest_route=\/wp\/v2\/media\/1501"}],"wp:attachment":[{"href":"https:\/\/techlizard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techlizard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techlizard.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}