GPTQ (GPT Quantization) is a post-training quantization algorithm that compresses model weights to 4-bit or lower precision with minimal accuracy loss. It operates layer-by-layer, using second-order information (Hessian matrices) to correct quantization errors, enabling the execution of large models like Llama 2 70B on a single consumer-grade GPU. This technique is a cornerstone of inference optimization, directly reducing memory footprint and compute cost.
Glossary
GPTQ

What is GPTQ?
GPTQ is a post-training quantization algorithm designed to compress large language models for efficient inference.
The algorithm is highly efficient, requiring only a few hours of calibration on a GPU and a small dataset. It is closely related to other weight-only quantization methods like AWQ but differs in its precise, greedy optimization per layer. GPTQ is implemented in popular libraries such as AutoGPTQ and is a standard format for deploying compressed models on platforms like Hugging Face, making it essential for cost and resource management in production LLM serving.
Key Characteristics of GPTQ
GPTQ is a state-of-the-art, layer-wise quantization algorithm designed to compress large language models to 4-bit or lower precision with minimal accuracy degradation, enabling efficient inference on consumer-grade hardware.
Layer-Wise Quantization
GPTQ operates layer-by-layer, quantizing the weights of one layer at a time while using the Hessian matrix (a measure of second-order curvature) to correct the error introduced in the previous layer. This iterative, greedy approach minimizes the overall perturbation to the model's output.
- Process: For each layer, it solves a layer-wise reconstruction problem.
- Benefit: Achieves higher accuracy than one-shot, global quantization methods by accounting for inter-layer dependencies.
Optimal Brain Quantization (OBQ) Foundation
GPTQ is a massively scaled and optimized implementation of the Optimal Brain Quantization (OBQ) framework. OBQ treats weight quantization as a per-layer reconstruction problem, where it quantizes weights one at a time and immediately updates the remaining, unquantized weights to compensate for the error.
- Core Idea: Quantize the weight that introduces the least additional error, then optimally adjust all other weights in the layer.
- GPTQ's Innovation: Introduces lazy batch updates and fast matrix inversion (Cholesky decomposition) to make OBQ practical for models with billions of parameters, reducing the time complexity from O(n³) to O(n²).
Second-Order Information (Hessian)
The algorithm's accuracy stems from its use of second-order information via the Hessian matrix (H). The Hessian captures not just the gradient (direction of steepest ascent) but the curvature of the loss landscape around the current weights.
- Role: The inverse Hessian (H⁻¹) is used to compute the optimal adjustment to the remaining weights after quantizing a single weight.
- Advantage: This provides a much more accurate correction than first-order methods, as it understands how changing one weight affects the error contribution of all others.
Extreme Compression (2-4 bit)
GPTQ is specifically designed for extremely low-bit quantization, most commonly targeting 4-bit (INT4) and even 2-bit precision. This reduces the model's memory footprint by 4x to 16x compared to standard 16-bit (FP16) precision.
- Typical Result: A 7B parameter model shrinks from ~14GB (FP16) to ~3.5GB (INT4).
- Hardware Enablement: Allows models like Llama 2 7B or Mistral 7B to run on a single consumer GPU (e.g., NVIDIA RTX 3090/4090) with 24GB of VRAM.
Calibration-Driven
GPTQ is a calibration-based post-training quantization (PTQ) method. It requires a small, representative calibration dataset (typically 128-512 samples) to perform its layer-wise error minimization.
- Function: The calibration data is passed through the layer being quantized to populate the Hessian matrix, which guides the weight selection and update process.
- No Retraining: Unlike Quantization-Aware Training (QAT), GPTQ does not require fine-tuning or backpropagation, making it a fast, single-pass compression technique.
Grouped Quantization
To maintain accuracy at very low bitwidths, GPTQ employs grouped quantization. Instead of quantizing an entire weight matrix with a single scale factor, it partitions the weights into blocks or groups (e.g., 128 weights per group) and quantizes each group independently.
- Purpose: Mitigates the error caused by outlier weights by limiting their influence to a small group.
- Trade-off: Slightly increases metadata overhead (storing a scale/zero-point per group) but is essential for 2-bit and 3-bit quantization stability.
How Does GPTQ Work?
GPTQ is a post-training quantization algorithm that compresses large language models to 4-bit or lower precision with minimal accuracy loss, enabling efficient inference on consumer-grade hardware.
GPTQ (GPT Quantization) is a layer-wise quantization algorithm that compresses model weights after training. It processes layers sequentially, using second-order information (Hessian matrices) to correct the error introduced by quantizing each weight. This method allows it to achieve 4-bit precision—reducing model memory footprint by 75%—with accuracy often matching the original 16-bit model. The process is calibration-based, requiring a small dataset to determine optimal quantization ranges without retraining.
The algorithm's core innovation is its optimal brain quantization approach, which treats weight quantization as a per-layer reconstruction problem. By analyzing how quantizing one weight affects others via the Hessian, it finds a compressed set of 4-bit integers and scaling factors that best approximate the original layer's output. This results in a quantized model that runs efficiently on GPUs with INT4 compute support, drastically lowering the hardware barrier for deploying models like Llama 2 or Mistral. The quantized weights are stored in a packed format, and dequantization happens on-the-fly during inference.
GPTQ vs. Other Quantization Methods
A technical comparison of post-training quantization algorithms for compressing large language models, focusing on accuracy, speed, and implementation complexity.
| Feature / Metric | GPTQ | AWQ (Activation-aware) | Standard INT8 PTQ |
|---|---|---|---|
Primary Mechanism | Layer-wise quantization using second-order Hessian information | Protects salient weights based on activation magnitude | Uniform quantization calibrated on a sample dataset |
Target Precision | Primarily 4-bit (INT4), supports 3-bit | Primarily 4-bit (INT4) | 8-bit (INT8) |
Accuracy Preservation | Minimal loss for 4-bit on most LLMs | High, often outperforms GPTQ on some models | Very high, near FP16 baseline |
Compression Ratio | 4x (vs. FP16) | 4x (vs. FP16) | 2x (vs. FP16) |
Inference Speedup | High (due to lower bit-width) | High (due to lower bit-width) | Moderate (2-3x vs. FP16) |
Memory Reduction | ~4x (for 4-bit) | ~4x (for 4-bit) | ~2x |
Requires Calibration Data | |||
Requires Retraining (QAT) | |||
Hardware Support | Widely supported on consumer GPUs (NVIDIA) | Widely supported on consumer GPUs (NVIDIA) | Universally supported (CPU/GPU, NVIDIA, AMD, etc.) |
Implementation Complexity | High (complex layer-wise optimization) | Moderate | Low (standardized in most frameworks) |
Typical Use Case | Maximizing performance on limited VRAM (e.g., consumer GPUs) | High-accuracy 4-bit quantization for sensitive tasks | General-purpose inference acceleration with max compatibility |
Frameworks and Implementations
GPTQ is a post-training quantization algorithm that compresses large language models to 4-bit or lower precision, enabling efficient inference on consumer-grade hardware. This section details its core mechanisms, implementation tools, and related optimization techniques.
Core Algorithm: Layer-Wise Quantization
GPTQ (GPT Quantization) is a post-training quantization (PTQ) algorithm that compresses model weights layer-by-layer to ultra-low precision (typically 4-bit). Its key innovation is using second-order information (Hessian matrices) to correct the error introduced by quantizing each weight, minimizing the overall performance degradation. The process involves:
- Optimal Brain Quantization: Treating weight quantization as a layer-wise reconstruction problem.
- Hessian-Based Updates: Using the Hessian to understand the impact of changing each weight, allowing for more accurate rounding decisions.
- Fixed-Point Precision: Storing weights as 4-bit integers (INT4) with a shared scaling factor, reducing memory footprint by ~75% compared to 16-bit (FP16) models.
Quantization Granularity: Group Size
A critical hyperparameter in GPTQ is the group size, which balances accuracy and compression. Weights within a layer are partitioned into groups, and each group shares a single quantization scaling factor.
- Smaller Group Size (e.g., 128): More scaling factors, leading to higher accuracy but slightly larger model size and slower inference.
- Larger Group Size (e.g., 1024): Fewer scaling factors, maximizing compression and speed but potentially reducing accuracy.
- Per-Channel vs. Per-Group: GPTQ typically uses per-group quantization, whereas other methods like AWQ may use per-channel. Tuning the group size is essential for achieving the best accuracy/size trade-off for a specific model and task.
Calibration Dataset
GPTQ requires a small, representative calibration dataset (typically 128-512 samples) to perform its layer-wise error correction. This dataset is used to:
- Activate the Model: Run forward passes to capture activation ranges and distributions.
- Compute the Hessian: Estimate the second-order information needed for optimal weight rounding.
- Minimize Output Discrepancy: Ensure the quantized layer's output closely matches the original full-precision layer's output. The quality and relevance of the calibration data directly impact the final quantized model's accuracy. Using domain-specific data can improve results for specialized tasks.
Comparison to AWQ
Activation-aware Weight Quantization (AWQ) is a major alternative to GPTQ. Both target 4-bit quantization but use different philosophies:
- GPTQ Focus: Weight-centric. Minimizes reconstruction error of the weights themselves using second-order information.
- AWQ Focus: Activation-aware. Identifies and preserves a small percentage of salient weights (based on activation magnitude) in higher precision (FP16) to better preserve output quality.
- Practical Differences: AWQ is often faster to apply (no Hessian calculation) and can be more accurate for some models, while GPTQ may offer better compression ratios. The choice depends on the target model and hardware.
Frequently Asked Questions
GPTQ is a leading post-training quantization algorithm for compressing large language models. These questions address its core mechanics, benefits, and practical implementation.
GPTQ is a post-training quantization algorithm that compresses model weights to ultra-low precision (typically 4-bit or lower) with minimal accuracy loss. It works by quantizing weights layer-by-layer, using second-order information (Hessian matrices) to correct the error introduced by rounding, ensuring the quantized layer's output closely matches the original. This process is highly efficient, often requiring only a few hours of calibration on a single GPU, and results in a model that runs significantly faster on consumer hardware.
Key steps:
- Layer-wise Quantization: The model is quantized one layer at a time, freezing all other layers.
- Hessian-based Correction: For each layer, GPTQ analyzes the Hessian (a matrix of second-order derivatives) to understand how each weight affects the overall output error. It uses this information to intelligently round weights, prioritizing accuracy for the most impactful parameters.
- Group-wise Quantization: Weights are processed in small blocks (e.g., groups of 128), which improves the stability and final accuracy of the quantization process.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
GPTQ is a core technique within the broader ecosystem of model optimization. These related concepts are essential for understanding its role in reducing LLM inference costs.
Model Quantization
Model quantization is the overarching compression technique that reduces the numerical precision of a model's weights and activations. This decreases memory footprint and accelerates computation. GPTQ is a specific, advanced form of quantization.
- Purpose: Enables larger models to fit on consumer hardware and reduces inference latency.
- Precision Levels: Common targets include FP16 (16-bit), INT8 (8-bit), and INT4 (4-bit), with GPTQ specializing in the latter.
- Trade-off: The primary challenge is minimizing the accuracy loss associated with lower precision.
Post-Training Quantization (PTQ)
Post-Training Quantization (PTQ) is the category of methods to which GPTQ belongs. PTQ applies compression to a pre-trained model without any retraining, offering a fast deployment path.
- Process: Uses a small calibration dataset to analyze weight distributions and set quantization parameters.
- Advantage vs. QAT: Much faster and less resource-intensive than Quantization-Aware Training, but may have a higher accuracy trade-off.
- Typical Use Case: The standard approach for quantizing massive foundation models like Llama or Mistral where full retraining is prohibitively expensive.
AWQ (Activation-aware Weight Quantization)
AWQ is a competing state-of-the-art PTQ method, like GPTQ, designed for 4-bit quantization. It uses a different core strategy to preserve accuracy.
- Core Idea: Identifies and protects a small subset of salient weights (around 1%) by keeping them in higher precision (FP16). These weights are chosen by observing activation magnitudes, not just the weights themselves.
- Difference from GPTQ: While GPTQ uses layer-wise reconstruction with second-order information, AWQ uses a per-channel scaling approach based on activations. AWQ is generally faster to apply but may have different accuracy characteristics depending on the model.
- Result: Enables efficient 4-bit inference with minimal accuracy degradation, often compared directly to GPTQ in benchmarks.
INT8 Quantization
INT8 Quantization is a more conservative and widely supported form of PTQ that uses 8-bit integers, offering a balance of performance and ease of use.
- Precision: Reduces memory usage by 75% compared to standard FP32 (32-bit floating point).
- Hardware Support: Extensively optimized on modern GPUs (NVIDIA Tensor Cores) and CPUs, leading to reliable speedups.
- Comparison to GPTQ: Less aggressive than 4-bit (INT4) methods like GPTQ. INT8 typically has negligible accuracy loss and is often used as a baseline or stepping stone before applying more extreme compression.
vLLM & PagedAttention
vLLM is a high-throughput inference serving engine. Its PagedAttention algorithm optimizes memory management for the KV Cache, which is complementary to weight quantization like GPTQ.
- Synergy: GPTQ reduces the model weight memory. PagedAttention reduces the memory waste of the KV Cache during generation.
- Combined Effect: Using a GPTQ-quantized model within vLLM can maximize the number of concurrent requests per GPU, driving down cost per token.
- Operational Impact: This combination is a standard production deployment strategy for cost-effective, high-concurrency LLM serving.
Inference Cost & Cost Per Token
Inference cost is the total financial expenditure of running an LLM. Cost per token is its fundamental unit economics. GPTQ directly targets these metrics.
- Cost Drivers: Dominated by GPU memory and compute time. GPTQ addresses both by shrinking the model.
- Quantitative Impact: A 4-bit GPTQ model requires ~4x less GPU memory for weights than its FP16 counterpart. This can allow a smaller, cheaper GPU instance to host the same model, or host more concurrent users on the same hardware.
- FinOps Relevance: GPTQ is a direct technical lever for engineering and FinOps teams to control and forecast cloud spend on LLM inference.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us