Qwen3-8B quantized with torchao int4 weight only quantization, using hqq algorithm for improved accuracy, by PyTorch team.
Use it directly or serve using vLLM for 62% VRAM reduction (6.27 GB needed) and 1.2x speedup on A100 GPUs.
Inference with vLLM
Install vllm nightly and torchao nightly to get some recent changes:
1# Client
2curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
3 "model": "pytorch/Qwen3-8B-INT4",
4 "messages": [
5 {"role": "user", "content": "Give me a short introduction to large language models."}
6 ],
7 "temperature": 0.6,
8 "top_p": 0.95,
9 "top_k": 20,
10 "max_tokens": 32768
11}'
Note: please use VLLM_DISABLE_COMPILE_CACHE=1 to disable compile cache when running this code, e.g. VLLM_DISABLE_COMPILE_CACHE=1 python example.py, since there are some issues with the composability of compile in vLLM and torchao,
this is expected be resolved in pytorch 2.8.
Our INT4 model is only optimized for batch size 1, so expect some slowdown with larger batch sizes, we expect this to be used in local server deployment for single or a few users where the decode tokens per second will matters more than the time to first token.
Results
A100
Benchmark (Latency)
Qwen3-8B
Qwen3-8B-INT4
latency (batch_size=1)
3.47s
2.93s (1.18x speedup)
H100
Benchmark (Latency)
Qwen3-8B
Qwen3-8B-INT4
latency (batch_size=1)
2.46s
1.40s (1.76x speedup)
Int4 weight only is optimized for batch size 1 and short input and output token length, please stay tuned for models optimized for larger batch sizes or longer token length.
Abstract: We present TorchAO, a PyTorch-native model optimization framework leveraging quantization and sparsity to provide an end-to-end, training-to-serving workflow for AI models. TorchAO supports a variety of popular model optimization techniques, including FP8 quantized training, quantization-aware training (QAT), post-training quantization (PTQ), and 2:4 sparsity, and leverages a novel tensor subclass abstraction to represent a variety of widely-used, backend agnostic low precision data types, including INT4, INT8, FP8, MXFP4, MXFP6, and MXFP8. TorchAO integrates closely with the broader ecosystem at each step of the model optimization pipeline, from pre-training (TorchTitan) to fine-tuning (TorchTune, Axolotl) to serving (HuggingFace, vLLM, SGLang, ExecuTorch), connecting an otherwise fragmented space in a single, unified workflow. TorchAO has enabled recent launches of the quantized Llama 3.2 1B/3B and LlamaGuard3-8B models and is open-source at this https URL .
PyTorch has not performed safety evaluations or red teamed the quantized models. Performance characteristics, outputs, and behaviors may differ from the original models. Users are solely responsible for selecting appropriate use cases, evaluating and mitigating for accuracy, safety, and fairness, ensuring security, and complying with all applicable laws and regulations.
Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the licenses the models are released under, including any limitations of liability or disclaimers of warranties provided therein.