---
title: "Making LLMs lighter with AutoGPTQ and transformers"
description: "AutoGPTQ is now integrated into Hugging Face Transformers (via Optimum), letting users quantize and run LLMs at 8, 4, 3 or 2 bits with the GPTQ post-training method."
url: "https://swe.quest/articles/making-llms-lighter-with-autogptq-and-transformers-6a1ce27ee3288303"
canonical: "https://huggingface.co/blog/gptq-integration"
source: "Hugging Face"
published: "2023-08-23"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 10
tags: ["inference","llms","performance","hardware"]
---

# Making LLMs lighter with AutoGPTQ and transformers

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2023-08-23, 10 min read, Announcement. Original: [https://huggingface.co/blog/gptq-integration](https://huggingface.co/blog/gptq-integration)

## Summary

AutoGPTQ is now integrated into Hugging Face Transformers (via Optimum), letting users quantize and run LLMs at 8, 4, 3 or 2 bits with the GPTQ post-training method. GPTQ needs a calibration dataset and quantizes only the weights: int4 weights are dequantized on the fly in a fused kernel while compute stays in fp16. That gives nearly 4x memory savings with negligible accuracy loss at 4-bit. On an A100 at batch size 1, Llama-2-7B with the exllama kernel dropped peak memory from about 29 GB to 10.5 GB with slightly better per-token latency than fp16. Text-Generation-Inference can now serve a 70B model on a single 80GB GPU and PEFT adapters can be fine-tuned on top, but the kernels slow down at larger batch sizes and W4A8 or Triton kernels remain open work.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)

## Prerequisites

- LLM inference basics ([easy posts on Inference & serving](https://swe.quest/tags/inference.md?difficulty=easy))
- model quantization concepts ([easy posts on Inference & serving](https://swe.quest/tags/inference.md?difficulty=easy))
- Hugging Face Transformers

## Keywords

GPTQ, AutoGPTQ, Hugging Face Transformers, Optimum, Text-Generation-Inference, PEFT, exllama, ROCm

## Related posts

- [Overview of natively supported quantization schemes in 🤗 Transformers](https://swe.quest/articles/overview-of-natively-supported-quantization-schemes-in-transformers-c1bfbebb9330add3.md): Hugging Face · 2023-09-12 · Medium · 9 min read · Inference & serving, Model training, LLMs, Performance engineering
  bitsandbytes and GPTQ (via auto-gptq), the two quantization schemes built into Transformers, trade off differently. bitsandbytes needs no calibration data, works on any model with nn.Linear layers across modalities, and lets LoRA adapters merge without degradation.
- [Making LLMs even more accessible with bitsandbytes, 4-bit quantization and QLoRA](https://swe.quest/articles/making-llms-even-more-accessible-with-bitsandbytes-4-bit-quantization-and-qlora-7bc797d3e83b0ec6.md): Hugging Face · 2023-05-24 · Medium · 14 min read · Inference & serving, Model training, LLMs, Python
  bitsandbytes now integrates 4-bit quantization into Hugging Face transformers, letting most accelerate-loadable models (text, vision, multimodal) run in 4-bit and be fine-tuned via QLoRA, which backpropagates through a frozen 4-bit base model into LoRA adapters.
- [Transformers now runs llama.cpp quants](https://swe.quest/articles/transformers-now-runs-llama-cpp-quants-cff2353854049dc6.md): Hugging Face · 2026-09-22 · Medium · 11 min read · Inference & serving, LLMs, Python, Performance engineering
  Hugging Face transformers can now load GGUF (llama.cpp) quantized checkpoints via \`from\_pretrained(..., gguf\_file=...)\` and serve them through \`transformers serve\` with an OpenAI-compatible API.
- [A Gentle Introduction to 8-bit Matrix Multiplication for transformers at scale using transformers, accelerate and bitsandbytes](https://swe.quest/articles/a-gentle-introduction-to-8-bit-matrix-multiplication-for-transformers-at-scale-af5b5f40a9067e95.md): Hugging Face · 2022-08-17 · Medium · 21 min read · Inference & serving, LLMs, Machine learning, Hardware
  LLM.int8() makes 8-bit inference of 175B-class transformers possible with no measurable quality loss.
- [Optimizing your LLM in production](https://swe.quest/articles/optimizing-your-llm-in-production-aa5bbb901928fa57.md): Hugging Face · 2023-09-15 · Medium · 31 min read · Inference & serving, LLMs, Performance engineering, Python
  Serving billion-parameter LLMs efficiently comes down to three levers: lower precision, Flash Attention, and inference-friendly architectures such as ALiBi, rotary embeddings, Multi-Query Attention and Grouped-Query Attention.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
