Overview
AWQ (Activation-aware Weight Quantization) is the reference implementation from MIT Han Lab for shrinking large language models down to 3-bit or 4-bit weights. Instead of treating every weight the same, it looks at which weights matter most for the model's activations and protects them during quantization, so the smaller model keeps most of its accuracy.
It is meant for engineers who need to run LLMs and vision-language models on tighter hardware budgets, from cloud GPUs down to edge devices like the NVIDIA Jetson Orin. The repo ships an AWQ search step, a pre-computed model zoo for families such as Llama-1/2/3, OPT, CodeLlama, StarCoder, Vicuna, and VILA, plus a memory-efficient 4-bit Linear layer and CUDA kernels for fast inference.
As a quantization and compression tool, AWQ sits ahead of the serving stack: you quantize a model once, then load the result. The method is also integrated into wider tooling such as Hugging Face Transformers, vLLM, TensorRT-LLM, and LMDeploy, and the companion TinyChat project uses it for on-device LLM/VLM chat.
What it does
- Activation-aware INT3/INT4 weight quantization that keeps accuracy close to the full-precision model
- AWQ search to find quantization scales, plus a real backend that dumps deployable quantized weights
- Pre-computed AWQ model zoo for Llama-1/2/3, OPT, CodeLlama, StarCoder, Vicuna, VILA, and LLaVA
- Memory-efficient 4-bit Linear layer in PyTorch with CUDA kernels for context and decoding stages
- Support for instruction-tuned and multi-modal models (e.g. Vicuna, VILA) including video understanding
- TinyChat companion for on-device LLM/VLM inference on edge GPUs, reporting up to ~2.7-2.9x speedups over FP16
Getting started
AWQ runs as a Python package with a CUDA kernel you build from source. Clone the repo, set up the environment, then run the AWQ search and quantization steps.
Install AWQ and the CUDA kernel
Clone the repository, create a Python 3.10 environment, install the package in editable mode, then build the W4A16 inference kernel.
git clone https://github.com/mit-han-lab/llm-awq
cd llm-awq
conda create -n awq python=3.10 -y
conda activate awq
pip install --upgrade pip
pip install -e .
cd awq/kernels
python setup.py installRun the AWQ search
Search for the per-channel scales on your model and dump them to a cache file. This computes the activation-aware scaling used during quantization.
python -m awq.entry --model_path /PATH/TO/LLAMA3/llama3-8b \
--w_bit 4 --q_group_size 128 \
--run_awq --dump_awq awq_cache/llama3-8b-w4-g128.ptGenerate real 4-bit weights
Load the search result and write out the quantized model with the real backend, ready to load for inference.
mkdir quant_cache
python -m awq.entry --model_path /PATH/TO/LLAMA3/llama3-8b \
--w_bit 4 --q_group_size 128 \
--load_awq awq_cache/llama3-8b-w4-g128.pt \
--q_backend real --dump_quant quant_cache/llama3-8b-w4-g128-awq.ptLoad and evaluate the quantized model
Load the real quantized weights and check perplexity on WikiText-2 to confirm accuracy held up.
python -m awq.entry --model_path /PATH/TO/LLAMA3/llama3-8b \
--tasks wikitext --w_bit 4 --q_group_size 128 \
--load_quant quant_cache/llama3-8b-w4-g128-awq.ptCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Compressing a Llama-3 or other LLM to 4-bit so it fits in less GPU memory while keeping accuracy
- Running LLM or vision-language chatbots on edge devices like Jetson Orin with TinyChat
- Producing AWQ-quantized checkpoints to serve through vLLM, TensorRT-LLM, or LMDeploy
- Cutting inference cost and latency for instruction-tuned and multi-modal models
How AWQ compares
AWQ alongside other open-source quantization & compression tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| BitNet | ★ 39.6k | Microsoft's inference framework for running extremely low-bit (1.58-bit) quantized LLMs efficiently on CPUs. |
| bitsandbytes | ★ 8.3k | A 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.6k | Activation-aware 4-bit weight quantization for compressing and accelerating LLMs |
| LLM Compressor | ★ 3.5k | A library for applying quantization and sparsity methods to LLMs to produce compressed models that run faster in vLLM. |
| torchao | ★ 2.9k | PyTorch's native library for quantizing and applying low-bit data types to models for faster training and inference. |
| Intel Neural Compressor | ★ 2.7k | An Intel toolkit for compressing models through quantization, pruning, and distillation across multiple deep-learning frameworks. |
| GPTQModel | ★ 1.2k | A model quantization toolkit, successor to AutoGPTQ, that compresses LLMs with GPTQ, AWQ, and other methods across many chips. |
| Optimum Quanto | ★ 1k | A Hugging Face PyTorch toolkit for quantizing model weights and activations to formats like int8, int4, and float8. |