Overview
LLM Compressor (`llmcompressor`) is a Python library for shrinking large language models so they run faster and use less memory when served. It applies quantization and sparsity methods to a model's weights, activations, KV cache, and attention, then saves the result in the `compressed-tensors` format.
It is built for engineers who deploy models with vLLM. Models load directly from Hugging Face repositories, get compressed with a chosen scheme, and are saved back out ready for vLLM to serve. It also supports DDP and disk offloading so very large models can be compressed.
Within the quantization and compression category, it sits between your trained model and your serving stack: you pick a precision (such as FP8, INT8, INT4, or NVFP4) and an algorithm (such as GPTQ, AWQ, or SmoothQuant), and it produces a smaller checkpoint that vLLM can run.
What it does
- Quantization for weights, activations, KV cache, and attention, including W8A8 (int8/fp8), W4A16, and microscale formats like NVFP4, MXFP4, and MXFP8
- A range of algorithms: simple PTQ, GPTQ, AWQ, SmoothQuant, AutoRound, and rotation-based methods (SpinQuant, QuIP)
- Loads Hugging Face models and repositories directly and saves to the compressed-tensors format that vLLM can serve
- DDP and disk offloading support for compressing very large models
- Works across model types, including MoE LLMs and vision-, audio-, and language multimodal models
Getting started
Install the library, then run a one-shot quantization pass on a Hugging Face model and save the compressed result for vLLM.
Install
Install the package from PyPI.
pip install llmcompressorQuantize and save a model
Load a model, configure a quantization recipe, apply it with oneshot, and save the result in compressed-tensors format.
from compressed_tensors.offload import dispatch_model
from transformers import AutoModelForCausalLM, AutoTokenizer
from llmcompressor import oneshot
from llmcompressor.modifiers.quantization import QuantizationModifier
MODEL_ID = "Qwen/Qwen3-30B-A3B"
# Load model.
model = AutoModelForCausalLM.from_pretrained(MODEL_ID)
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
# Configure the quantization algorithm and scheme.
recipe = QuantizationModifier(
targets="Linear",
scheme="FP8_BLOCK",
ignore=["lm_head", "re:.*mlp.gate$"],
)
# Apply quantization.
oneshot(model=model, recipe=recipe)
# Save to disk in compressed-tensors format.
SAVE_DIR = MODEL_ID.split("/")[1] + "-FP8-BLOCK"
model.save_pretrained(SAVE_DIR)
tokenizer.save_pretrained(SAVE_DIR)Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Reduce the memory footprint and serving cost of a model before deploying it with vLLM
- Produce FP8 or INT4 checkpoints from a Hugging Face model to fit on smaller or fewer GPUs
- Compress very large models using DDP and disk offloading when they don't fit in memory
- Quantize MoE or multimodal (vision/audio) models for production inference
How LLM Compressor compares
LLM Compressor 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 | The reference implementation of Activation-aware Weight Quantization for compressing LLMs to 4-bit with little accuracy loss. |
| LLM Compressor | ★ 3.5k | Quantize and compress LLMs for faster inference with 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. |