nncf
Neural Networks Compression Framework
What it is and what it does
NNCF is a framework for compressing neural networks to reduce inference latency and model size. It implements post-training algorithms (quantization, weight compression, activation sparsity) and training-time methods (quantization-aware training, pruning, weight-only quantization with LoRA). The framework works with PyTorch, TorchFX, ONNX, and OpenVINO models, offering a unified Python API for model graph transformation and compression.
The package is designed for practitioners who need to optimize models for deployment on resource-constrained devices or edge hardware. It integrates into third-party ecosystems including HuggingFace Optimum Intel, Ultralytics, ExecuTorch, and torch.compile, making it accessible within existing training and export pipelines. Runtime dependencies include networkx, numpy, scikit-learn, scipy, and visualization tools like pydot and rich.
Use it for:
- Quantize large language models (e.g., Llama) to INT4 weights for efficient OpenVINO deployment via HuggingFace Optimum.
- Apply post-training quantization to ONNX models without retraining to reduce inference latency.
- Fine-tune PyTorch models with quantization-aware training to maintain accuracy while reducing model size.
- Prune and sparsify neural networks during training to accelerate inference on edge devices.
- Export PyTorch models to OpenVINO format with INT4-quantized weights for production deployment.
- Integrate compression into custom training pipelines via the unified NNCF API and Git patch examples.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
NNCF provides post-training and training-time compression algorithms for neural networks, optimizing inference in OpenVINO, PyTorch, TorchFX, and ONNX with minimal accuracy loss.
Yes. NNCF is actively maintained, has no known vulnerabilities, installs with low friction, and is widely adopted in production ecosystems (HuggingFace, Ultralytics, ExecuTorch, torch.compile). Choose it if you need to compress models for inference optimization across PyTorch, ONNX, or OpenVINO. Requires Python 3.10+; verify backend-specific system requirements for your target framework.
Install
nncf on PyPI
pip
pip install nncfuv
uv add nncfpoetry
poetry add nncfInstalling nncf
Before you install
Low friction install as a pure Python wheel. Active maintenance with a recent release (9 days old) and steady repository activity. Requires Python 3.10 or later and pulls in 12 runtime dependencies including numpy, scikit-learn, and scipy.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and state significant changes.
Quickstart
pip install nncf
import nncf
from nncf import compress_model
# Compress a model loaded from PyTorch, ONNX, or OpenVINO
Requires Python 3.10 or later; backend-specific system requirements depend on whether you use PyTorch, ONNX, or OpenVINO models.
Verify before relying
- Specific accuracy drop ranges for different compression algorithms and model types.
- Performance benchmarks (inference speedup, model size reduction) for representative models.
- GPU memory requirements for training-time compression with distributed training.
- Compatibility matrix details between NNCF version 3.3.0 and specific PyTorch/ONNX/OpenVINO versions.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 12 — networkx, ninja, numpy, openvino-telemetry, packaging, psutil, pydot, rich, safetensors, scikit-learn, scipy, tabulate |
| Maintenance | actively maintained — 9 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,297,270/month — #4,091 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nncf-3.3.0-py3-none-any.whl
Keywords: bert, classification, compression, hawq, mixed-precision-training, mmdetection, nas, nlp, object-detection, pruning, quantization, quantization-aware-training, semantic-segmentation, sparsity, transformers
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
model-compression-toolkitCompresses and optimizes neural networks…
permissive · top 15,000 on PyPI
openvinoOpenVINO converts and optimizes deep learning…
permissive · top 5,000 on PyPI
nvidia-modeloptApplies state-of-the-art model optimization…
permissive · top 15,000 on PyPI
onnx-toolParse, analyze, optimize, and profile ONNX…
permissive · top 15,000 on PyPI
openvino-devProvides command-line tools and Python APIs to…
permissive · top 15,000 on PyPI
compressed-tensorsProvides a unified format for storing and…
permissive · top 5,000 on PyPI
torchaoTorchAO applies quantization and sparsity…
unclear · top 5,000 on PyPI
qonnxQONNX provides Python utilities to work with…
permissive · top 15,000 on PyPI
tensorflow-model-optimizationProvides quantization, pruning, and clustering…
permissive · top 15,000 on PyPI
optimum-intelOptimum Intel bridges Hugging Face Transformers…
permissive · top 15,000 on PyPI