GPTQ (Generative Pre-trained Transformer Quantization)
Post-training quantization method that compresses LLMs to 4-bit with minimal accuracy loss using group-wise quantization.
When to use GPTQ
Use GPTQ when:
- Need to fit large models (70B+) on limited GPU memory
- Want 4× memory reduction with <2% accuracy loss
- Deploying on consumer GPUs (RTX 4090, 3090)
- Need faster inference (3-4× speedup vs FP16)
Use AWQ instead when:
- Need slightly better accuracy (<1% loss)
- Have newer GPUs (Ampere, Ada)
- Want Marlin kernel support (2× faster on some GPUs)
Use bitsandbytes instead when:
- Need simple integration with transformers
- Want 8-bit quantization (less compression, better quality)
- Don't need pre-quantized model files
Quick start
Installation
Load pre-quantized model
Quantize your own model
Group-wise quantization
How GPTQ works:
- Group weights: Divide each weight matrix into groups (typically 128 elements)
- Quantize per-group: Each group has its own scale/zero-point
- Minimize error: Uses Hessian information to minimize quantization error
- Result: 4-bit weights with near-FP16 accuracy
Group size trade-off:
Example:
Quantization configurations
Standard 4-bit (recommended)
Performance:
- Memory: 4× reduction (70B model: 140GB → 35GB)
- Accuracy: ~1.5% perplexity increase
- Speed: 3-4× faster than FP16
High accuracy (3-bit with larger groups)
Trade-off:
- Memory: 5× reduction
- Accuracy: ~3% perplexity increase
- Speed: 5× faster (but less accurate)
Maximum accuracy (4-bit with small groups)
Trade-off:
- Memory: 3.5× reduction (slightly larger)
- Accuracy: ~0.8% perplexity increase (best)
- Speed: 2-3× faster (kernel overhead)
Kernel backends
ExLlamaV2 (default, fastest)
Performance: 1.5-2× faster than Triton
Marlin (Ampere+ GPUs)
Requirements:
- NVIDIA Ampere or newer (A100, H100, RTX 40xx)
- Compute capability ≥ 8.0
Triton (Linux only)
Performance: 1.2-1.5× faster than CUDA backend
Integration with transformers
Direct transformers usage
QLoRA fine-tuning (GPTQ + LoRA)
Performance benchmarks
Memory reduction
Enables:
- 70B on single A100 80GB (vs 2× A100 needed for FP16)
- 405B on 3× A100 80GB (vs 11× A100 needed for FP16)
- 13B on RTX 4090 24GB (vs OOM with FP16)
Inference speed (Llama 2-7B, A100)
Accuracy (perplexity on WikiText-2)
Excellent quality preservation - less than 2% degradation!
Common patterns
Multi-GPU deployment
CPU offloading
Batch inference
Finding pre-quantized models
TheBloke on HuggingFace:
- https://huggingface.co/TheBloke
- 1000+ models in GPTQ format
- Multiple group sizes (32, 128)
- Both CUDA and Marlin formats
Search:
Download:
Supported models
- LLaMA family: Llama 2, Llama 3, Code Llama
- Mistral: Mistral 7B, Mixtral 8x7B, 8x22B
- Qwen: Qwen, Qwen2, QwQ
- DeepSeek: V2, V3
- Phi: Phi-2, Phi-3
- Yi, Falcon, BLOOM, OPT
- 100+ models on HuggingFace
References
- Calibration Guide [blocked] - Dataset selection, quantization process, quality optimization
- Integration Guide [blocked] - Transformers, PEFT, vLLM, TensorRT-LLM
- Troubleshooting [blocked] - Common issues, performance optimization
Resources
- GitHub: https://github.com/AutoGPTQ/AutoGPTQ
- Paper: GPTQ: Accurate Post-Training Quantization (arXiv:2210.17323)
- Models: https://huggingface.co/models?library=gptq
- Discord: https://discord.gg/autogptq


