AI/TLDR

GPTQModel

Quantize LLMs with GPTQ, AWQ and more across many chips

Overview

GPTQModel is a Python toolkit for quantizing large language models. It is the successor to AutoGPTQ and lets you compress a model's weights to lower bit-widths, such as 4-bit, so the model takes less memory and runs faster while keeping output quality close to the original.

It is aimed at ML engineers and practitioners who want to deploy LLMs on limited hardware. You load a model with a quantization config, calibrate it on a small dataset, and save a compressed checkpoint you can serve later.

Within the quantization and compression space, it bundles several methods (GPTQ, AWQ, GGUF, FP8 and others) and runs across NVIDIA GPUs, Intel CPU/XPU and Huawei Ascend NPU, and it integrates with the Hugging Face Transformers, PEFT and Optimum stack.

What it does

  • Supports several quantization methods, including GPTQ, AWQ, GGUF, FP8, EXL3, QQQ and ParoQuant
  • Runs across a range of hardware: NVIDIA GPUs, Intel CPU and XPU, and Huawei Ascend NPU through native torch kernels
  • JIT-compiled CUDA kernels that build only what you use, shrinking the wheel and skipping unused code paths
  • Wide model coverage across many recent LLM and MoE families, with handling for Mixture-of-Experts routing during quantization
  • Works alongside the Hugging Face stack, with support for Transformers, PEFT and Optimum for both GPTQ and AWQ
  • Optional extras for serving backends such as vLLM, SGLang and BitBLAS

Getting started

Install the package from PyPI, then load a model with a quantization config, calibrate it on a small dataset, and save the quantized weights.

Install GPTQModel

Install from PyPI with pip or uv. You can add optional serving backends as extras.

bashbash
pip install -v gptqmodel

Quantize a model

Load a base model with a GPTQConfig, calibrate on a small text dataset, then save the 4-bit result.

pythonpython
from datasets import load_dataset
from gptqmodel import GPTQConfig, GPTQModel

model_id = "meta-llama/Llama-3.2-1B-Instruct"
quant_path = "Llama-3.2-1B-Instruct-gptqmodel-4bit"

calibration_dataset = load_dataset(
    "allenai/c4",
    data_files="en/c4-train.00001-of-01024.json.gz",
    split="train"
).select(range(1024))["text"]

quant_config = GPTQConfig(bits=4, group_size=128)
model = GPTQModel.load(model_id, quant_config)
model.quantize(calibration_dataset, batch_size=1)
model.save(quant_path)

Run inference

Load a quantized model and generate text.

pythonpython
model = GPTQModel.load("ModelCloud/Llama-3.2-1B-Instruct-gptqmodel-4bit-vortex-v2.5")
result = model.generate("Uncovering deep insights begins with")[0]
print(model.tokenizer.decode(result))

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Shrink a large language model to 4-bit so it fits on a smaller GPU or on multiple consumer cards
  • Prepare quantized checkpoints to serve with backends like vLLM or SGLang for cheaper, faster inference
  • Compress Mixture-of-Experts models using the routing and fail-safe controls built for uneven expert quantization
  • Quantize models for non-NVIDIA hardware such as Intel CPU/XPU or Huawei Ascend NPU

How GPTQModel compares

GPTQModel alongside other open-source quantization & compression tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
BitNet★ 39.6kMicrosoft's inference framework for running extremely low-bit (1.58-bit) quantized LLMs efficiently on CPUs.
bitsandbytes★ 8.3kA library that adds 8-bit and 4-bit quantization to PyTorch models, widely used for loading and fine-tuning LLMs in low memory.
AWQ★ 3.6kThe reference implementation of Activation-aware Weight Quantization for compressing LLMs to 4-bit with little accuracy loss.
LLM Compressor★ 3.5kA library for applying quantization and sparsity methods to LLMs to produce compressed models that run faster in vLLM.
torchao★ 2.9kPyTorch's native library for quantizing and applying low-bit data types to models for faster training and inference.
Intel Neural Compressor★ 2.7kAn Intel toolkit for compressing models through quantization, pruning, and distillation across multiple deep-learning frameworks.
GPTQModel★ 1.2kQuantize LLMs with GPTQ, AWQ and more across many chips
Optimum Quanto★ 1kA Hugging Face PyTorch toolkit for quantizing model weights and activations to formats like int8, int4, and float8.