Skip to content

Commit 88b127d

Browse files
yiliu30hmellor
andauthored
Joint blog of Intel AutoRound + vLLM/LLM Compressor (#129)
Signed-off-by: yiliu30 <yi4.liu@intel.com> Signed-off-by: Yi Liu <yi4.liu@intel.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
1 parent c3ed0d0 commit 88b127d

File tree

1 file changed

+157
-0
lines changed

1 file changed

+157
-0
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
layout: post
3+
title: "Advancing Low‑Bit Quantization for LLMs: AutoRound x LLM Compressor"
4+
author: "Intel Neural Compressor Team, Red Hat AI Model Optimization Team"
5+
---
6+
7+
**Achieve faster, more efficient LLM serving without sacrificing accuracy!**
8+
9+
## TL;DR
10+
11+
We’re excited to announce that **[AutoRound](https://aclanthology.org/2024.findings-emnlp.662.pdf)**—Intel’s state‑of‑the‑art tuning‑based post‑training quantization (PTQ) algorithm—is now integrated into **[LLM Compressor](https://github.com/vllm-project/llm-compressor)**. This collaboration delivers:
12+
13+
- Higher accuracy for low bit-width quantization
14+
- Lightweight tuning (hundreds of steps, not thousands)
15+
- Zero additional inference overhead
16+
- Seamless compatibility with `compressed-tensors` and direct serving in [vLLM](https://github.com/vllm-project/vllm)
17+
- Streamlined workflow: quantize and serve models with just a few lines of code
18+
19+
Broader quantization schemes and model coverage are coming next—try it now and help shape what we build.
20+
21+
## What Is AutoRound?
22+
23+
**AutoRound** is an advanced post-training quantization (PTQ) algorithm designed for Large Language Models (LLMs) and Vision-Language Models (VLMs). It introduces three trainable parameters per quantized tensor: `V` (rounding offset/adjustment), `α` and `β` (learned clipping range controls). By processing decoder layers sequentially and applying signed gradient descent, AutoRound jointly optimizes rounding and clipping to minimize block‑wise output reconstruction error.
24+
25+
Core strengths:
26+
27+
- **Superior accuracy**, especially at very low bit‑widths
28+
- **Support multiple data types:** W4A16, MXFP8, MXFP4, FP8, NVFP4, with more on the way
29+
- **Mixed‑bit**, layer‑wise precision search for flexible accuracy–efficiency trade‑offs
30+
- Applicability across both **LLMs** and **VLMs**
31+
32+
AutoRound enables quantized models in a range of low‑bit formats that are designed to accelerate inference on **Intel® Xeon® processors**, **Intel® Gaudi® AI accelerators**, **Intel® Data Center GPUs**, **Intel® Arc™ B‑Series Graphics**, as well as other GPUs (e.g., CUDA‑based devices).
33+
34+
Looking forward, Intel is adding native support for FP8, MXFP8, and MXFP4 formats to its next-generation **Data Center GPUs, codenamed Crescent Island**. Models quantized with AutoRound will naturally scale to take advantage of these data types across the Intel AI hardware portfolio. This creates a consistent path from algorithmic innovation to real‑world deployment.
35+
36+
For more details, please refer to the paper [AutoRound (EMNLP 2024)](https://aclanthology.org/2024.findings-emnlp.662.pdf) and the GitHub repository [intel/auto-round](https://github.com/intel/auto-round).
37+
38+
## Why Integrate Into LLM Compressor?
39+
40+
**LLM** **Compressor** already provides a unified, modular system for compression primitives such as quantization and pruning. Integrating AutoRound into this ecosystem:
41+
42+
- Aligns with the existing modifier architecture (e.g., `GPTQModifier`)
43+
- Reuses the sequential calibration and layer‑onloading infrastructure
44+
- Enables future interoperability with richer multi‑modifier recipes
45+
- Produces quantized models that are ready for vLLM serving, enabling a clean workflow from compression to deployment
46+
47+
## Integration Overview
48+
49+
We completed the first stage of integration by introducing the new `AutoRoundModifier` into LLM Compressor, enabling production of `W{n}A16` (e.g., W4A16) compressed models that seamlessly load in vLLM, as implemented in [PR #1994](https://github.com/vllm-project/llm-compressor/pull/1994). With a straightforward configuration—just specify your model and calibration data—you can quickly generate high‑quality low‑bit checkpoints. This initial stage supports quantizing a range of dense LLMs, including the **Llama** and **Qwen** model families, and demonstrates robust compatibility for practical deployment.
50+
51+
## Try It Now (Quickstart)
52+
53+
### 1. Install
54+
55+
```bash
56+
git clone https://github.com/vllm-project/llm-compressor.git
57+
cd llm-compressor
58+
pip install -e .
59+
```
60+
61+
### 2. Load Model & Tokenizer
62+
63+
```python
64+
from transformers import AutoModelForCausalLM, AutoTokenizer
65+
MODEL_ID = "Qwen/Qwen3-8B"
66+
model = AutoModelForCausalLM.from_pretrained(MODEL_ID, torch_dtype="auto")
67+
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
68+
```
69+
70+
### 3. Prepare Calibration Data
71+
72+
```python
73+
from auto_round.calib_dataset import get_dataset
74+
NUM_CALIBRATION_SAMPLES = 128
75+
MAX_SEQUENCE_LENGTH = 2048
76+
ds = get_dataset(tokenizer=tokenizer,
77+
seqlen=MAX_SEQUENCE_LENGTH,
78+
nsamples=NUM_CALIBRATION_SAMPLES)
79+
```
80+
81+
### 4. Run Quantization using AutoRound
82+
83+
The AutoRound quantization can run on a variety of devices, including CPUs and GPUs. Quantization and serving may not happen on the same device. For example, you can quantize on a workstation with GPU and later deploy on AIPC.
84+
85+
```python
86+
from llmcompressor import oneshot
87+
from llmcompressor.modifiers.autoround import AutoRoundModifier
88+
89+
recipe = AutoRoundModifier(
90+
targets="Linear",
91+
scheme="W4A16",
92+
ignore=["lm_head"],
93+
iters=200,
94+
)
95+
96+
oneshot(
97+
model=model,
98+
dataset=ds,
99+
recipe=recipe,
100+
max_seq_length=MAX_SEQUENCE_LENGTH,
101+
num_calibration_samples=NUM_CALIBRATION_SAMPLES,
102+
shuffle_calibration_samples=False,
103+
)
104+
105+
SAVE_DIR = MODEL_ID.split("/")[-1] + "-W4A16-G128-AutoRound"
106+
model.save_pretrained(SAVE_DIR, save_compressed=True)
107+
tokenizer.save_pretrained(SAVE_DIR)
108+
```
109+
110+
In practice, **128 calibration samples + ~200 iterations** often reach stable convergence. Increase the number of samples or iterations if you are targeting extremely low bits or tighter accuracy targets.
111+
112+
### 5. Serve in vLLM
113+
114+
Once quantization is complete, the same compressed model can be served on different hardware, independent of the device used for tuning. For example, you can serve the quantized Qwen3‑8B‑W4A16‑G128‑AutoRound model on a single **Intel® Arc™ Pro B60 GPU**:
115+
116+
```bash
117+
vllm serve Qwen3-8B-W4A16-G128-AutoRound \
118+
--dtype=bfloat16 \
119+
--gpu-memory-utilization 0.8 \
120+
--max-num-batched-tokens 8192
121+
```
122+
123+
Note: Please install vLLM from PR [#29484](https://github.com/vllm-project/vllm/pull/29484/). When serving on XPU, you must run vLLM with the `--enforce-eager` flag.
124+
125+
### 6. Evaluate (Example: GSM8K with `lm_eval`)
126+
127+
```bash
128+
lm_eval --model vllm \
129+
--model_args pretrained="./Qwen3-8B-W4A16-G128-AutoRound,max_model_len=8192,max_num_batched_tokens=32768,max_num_seqs=128,gpu_memory_utilization=0.8,dtype=bfloat16,max_gen_toks=2048,enable_prefix_caching=False,enforce_eager=True" \
130+
--tasks gsm8k \
131+
--num_fewshot 5 \
132+
--limit 1000 \
133+
--batch_size 128
134+
135+
|Tasks|Version| Filter |n-shot| Metric | |Value| |Stderr|
136+
|-----|------:|----------------|-----:|-----------|---|----:|---|-----:|
137+
|gsm8k| 3|flexible-extract| 5|exact_match||0.911|± | 0.009|
138+
| | |strict-match | 5|exact_match||0.911|± | 0.009|
139+
```
140+
Note: The results may fluctuate due to non-determinism.
141+
142+
## Conclusion & Future Plans
143+
144+
With this first integration, AutoRound and LLM Compressor already provide a practical, production‑oriented path to low‑bit LLMs: W4A16 quantization is supported end‑to‑end, the workflow is simple to configure, and dense models such as Llama and Qwen are supported. The setup is robust, streamlined, and ready for practical deployment.
145+
146+
Looking ahead, we plan to extend support to additional schemes such as FP8, MXFP4, MXFP8, and NVFP4, add automatic mixed‑bit search for fine‑grained per‑layer optimization, and cover more model families, including Mixture‑of‑Experts (MoE) models. We also aim to deepen interoperability with other algorithms in LLM Compressor, which will allow AutoRound to combined into richer multi‑modifier recipes that serve both community use cases and Intel production workloads.
147+
148+
If you’d like to influence which formats, models, and workflows we prioritize next, please join the discussion in [RFC #1968](https://github.com/vllm-project/llm-compressor/issues/1968) and share your benchmarks or deployment requirements, or bring your feedback to the Intel Community so we can align the roadmap with real‑world needs.
149+
150+
### Acknowledgements
151+
152+
We wish to acknowledge the LLM Compressor and vLLM community. Specifically, we thank Kyle Sayers, Dipika Sikka, Brian Dellabetta, Charles Hernandez, Robert Shaw and Kunshang Ji for their invaluable feedback on the early proposal and their diligent review of the pull requests.
153+
154+
#### Related RFCs and PRs
155+
156+
[llm-compressor#1968](https://github.com/vllm-project/llm-compressor/issues/1968), [llm-compressor#1994](https://github.com/vllm-project/llm-compressor/pull/1994), [llm-compressor#2055](https://github.com/vllm-project/llm-compressor/pull/2055), [llm-compressor#2062](https://github.com/vllm-project/llm-compressor/pull/2062), [auto-round#993](https://github.com/intel/auto-round/pull/993), [auto-round#1053](https://github.com/intel/auto-round/pull/1053), [auto-round#1055](https://github.com/intel/auto-round/pull/1055), [auto-round#1072](https://github.com/intel/auto-round/pull/1072),
157+
[vllm#29484](https://github.com/vllm-project/vllm/pull/29484).

0 commit comments

Comments
 (0)