optimum-quanto
A pytorch quantization backend for optimum.
What it is and what it does
Optimum Quanto is a PyTorch quantization backend that converts trained models to lower-precision representations—int2, int4, int8, or float8 for weights and activations—to reduce memory footprint and accelerate inference. It integrates with the optimum framework, offering both high-level APIs and a low-level API for vanilla PyTorch models. The package supports a full workflow: quantize a model, optionally calibrate activations on representative data, fine-tune if needed, freeze weights to integer values, and serialize using safetensors or pickle.
Designed for eager-mode execution (works with non-traceable models), Quanto automatically inserts quantization stubs and operations into the model graph. It supports mixed-precision matrix multiplications on CUDA (int8-int8, fp16-int4, bf16-int8, bf16-int4) and aims for accuracy comparable to full-precision models when using int8 or float8 weights with float8 activations. The package is actively maintained but still pre-alpha; torch.compiler compatibility and dynamic activation smoothing are listed as not yet implemented.
Use it for:
- Quantize large models to int4 or int8 to reduce memory requirements and fit models on resource-constrained devices.
- Compress model transformers to float8 for faster inference while preserving accuracy.
- Calibrate and fine-tune quantized models on representative data to recover accuracy lost during quantization.
- Serialize quantized model weights to safetensors format for efficient storage and distribution.
- Deploy quantized models by reducing memory footprint and leveraging accelerated kernels on CUDA.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A PyTorch quantization backend that reduces model size and memory by converting weights and activations to lower-precision integer or float8 formats while maintaining inference accuracy.
Yes, if you need to quantize PyTorch models for inference efficiency. The package is actively maintained, has no known vulnerabilities, and offers both high-level integration and low-level control. Install with caution if you depend on torch.compile or require production-grade stability—it is pre-alpha and some features remain unimplemented.
Install
optimum-quanto on PyPI
pip
pip install optimum-quantouv
uv add optimum-quantopoetry
poetry add optimum-quantoInstalling optimum-quanto
Before you install
Low friction installation as a pure Python wheel. Actively maintained with recent commits and a stable release cadence; marked pre-alpha but in active development with no known vulnerabilities.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install optimum-quanto
from optimum.quanto import quantize, qint8
import torch
model = torch.nn.Linear(10, 10)
quantize(model, weights=qint8, activations=qint8)
Requires torch, ninja, numpy, safetensors, and huggingface_hub as runtime dependencies; Python 3.9 or later.
Verify before relying
- Whether accelerated kernels are available for all target hardware (CUDA, MPS, CPU) or only a subset.
- Actual inference latency overhead compared to full-precision models on different hardware.
- Compatibility with torch.compile and whether that feature is production-ready.
- Support for quantization-aware training workflows and convergence behavior.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.9.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — torch, ninja, numpy, safetensors, huggingface_hub |
| Maintenance | actively maintained — 526 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 292,491/month — #7,963 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: optimum_quanto-0.2.7-py3-none-any.whl
Keywords: torch, quantization
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
torchaoTorchAO applies quantization and sparsity…
unclear · top 5,000 on PyPI
ai-edge-quantizerQuantizes LiteRT models to reduce size and…
permissive · top 15,000 on PyPI
optimumOptimum provides optimization tools to export…
permissive · top 5,000 on PyPI
diffqDiffQ performs differentiable quantization of…
noncommercial · top 15,000 on PyPI
optimum-intelOptimum Intel bridges Hugging Face Transformers…
permissive · top 15,000 on PyPI
qonnxQONNX provides Python utilities to work with…
permissive · top 15,000 on PyPI
comfy-kitchenComfy Kitchen provides optimized GPU kernels…
permissive · top 5,000 on PyPI
optimum-onnxExports Hugging Face transformer models to ONNX…
permissive · top 15,000 on PyPI
nvidia-modeloptApplies state-of-the-art model optimization…
permissive · top 15,000 on PyPI
flashoptimFlashOptim provides drop-in replacements for…
permissive · top 15,000 on PyPI