llmcompressor
A library for compressing large language models utilizing the latest techniques and research in the field for both training aware and post training techniques. The library is designed to be flexible and easy to use on top of PyTorch and HuggingFace Transformers, allowing for quick experimentation.
What it is and what it does
llmcompressor is a PyTorch-based library for compressing large language models through quantization, pruning, and related techniques. It integrates with Hugging Face models and outputs compressed checkpoints in the compressed-tensors format, which vLLM can load directly for inference. The library supports multiple quantization precisions (int8, fp8, NVFP4, MXFP4, etc.) and algorithms (GPTQ, AWQ, SmoothQuant, AutoRound, REAP), with built-in support for weight-only, weight-activation, KV cache, and attention quantization.
Typical usage involves loading a Hugging Face model, applying a compression recipe (via YAML configuration or Python API), and saving the result for deployment. The library handles distributed training (DDP) and disk offloading to compress very large models on limited hardware. It depends on torch, transformers, datasets, accelerate, and several specialized packages like auto-round and compressed-tensors.
Use it for:
- Reduce model size and memory footprint for single-GPU deployment of large models like Llama or Qwen variants.
- Apply post-training quantization (PTQ) to existing checkpoints without retraining, using calibration data.
- Compress Mixture-of-Experts models by pruning less-relevant experts while maintaining accuracy.
- Prepare quantized models for vLLM inference with guaranteed format compatibility.
- Experiment with different quantization schemes (W4A8, W8A16, NVFP4, etc.) on custom models.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
llmcompressor optimizes large language models for efficient deployment by applying quantization, pruning, and other compression techniques compatible with vLLM inference.
Yes. Active maintenance, no known vulnerabilities, permissive license, and low install friction make it a solid choice for anyone deploying LLMs with vLLM. The substantial dependency footprint (torch, transformers, etc.) is expected for this use case. Start with the step-by-step compression guide in the documentation to select an appropriate quantization scheme for your model and hardware.
Install
llmcompressor on PyPI
pip
pip install llmcompressoruv
uv add llmcompressorpoetry
poetry add llmcompressorInstalling llmcompressor
Before you install
Low friction install with a pure-Python wheel. Active maintenance with a recent release (3 days old) and 3678 repository stars. Requires 13 runtime dependencies including torch, transformers, and datasets—a substantial but standard ML stack.
License in practice
Apache 2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for production deployment scenarios.
Quickstart
pip install llmcompressor
from llmcompressor.transformers import SparseAutoModelForCausalLM
from transformers import AutoTokenizer
model = SparseAutoModelForCausalLM.from_pretrained(
"RedHatAI/Llama-2-7b-chat-hf-W4A8-GPTQ"
)
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
inputs = tokenizer("Hello world", return_tensors="pt")
outputs = model.generate(**inputs, max_length=50)
Requires Python 3.10+. torch and transformers must be installed; llmcompressor will not function without them. GPU recommended for practical compression workflows.
Verify before relying
- Whether quantized models maintain accuracy on downstream tasks beyond the calibration set used during compression.
- Performance gains and memory savings for specific model sizes and quantization schemes in your target hardware.
- Compatibility with vLLM versions beyond what the fact sheet documents.
Package facts
| License | Apache 2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 13 — loguru, pyyaml, numpy, requests, tqdm, torch, transformers, datasets, auto-round, accelerate, nvidia-ml-py, pillow, compressed-tensors |
| Maintenance | actively maintained — 3 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 221,408/month — #9,280 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: llmcompressor-0.13.0-py3-none-any.whl
Keywords: llmcompressor, llms, large language models, transformers, pytorch, huggingface, compressors, compression, quantization, pruning, sparsity, optimization, model optimization, model compression
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
auto-gptqQuantizes large language models to lower…
permissive · top 15,000 on PyPI
auto-roundAutoRound quantizes large language models and…
permissive · top 15,000 on PyPI
torchaoTorchAO applies quantization and sparsity…
unclear · top 5,000 on PyPI
vllmvLLM is a high-throughput inference and serving…
permissive · top 5,000 on PyPI
compressed-tensorsProvides a unified format for storing and…
permissive · top 5,000 on PyPI
nvidia-modeloptApplies state-of-the-art model optimization…
permissive · top 15,000 on PyPI
vllm-tpuvllm-tpu is a high-throughput LLM inference and…
permissive · top 15,000 on PyPI
mlx-lmMLX LM loads, generates text with, fine-tunes,…
permissive · top 5,000 on PyPI
lm-format-enforcerConstrains language model token generation to…
permissive · top 5,000 on PyPI
mineru-vl-utilsProvides a lightweight Python wrapper to…
permissive · top 15,000 on PyPI