Skip to main content

GitHub Release Website Apache License Version 2.0 PyPI Downloads

Neural Network Compression Framework (NNCF)

Neural Network Compression Framework (NNCF) provides a suite of post-training and training-time algorithms for optimizing inference of neural networks in OpenVINO™ with a minimal accuracy drop.

NNCF is designed to work with models from PyTorch, TorchFX, ONNX and OpenVINO™.

NNCF provides samples that demonstrate the usage of compression algorithms for different use cases and models. See compression results achievable with the NNCF-powered samples on the NNCF Model Zoo page.

The framework is organized as a Python* package that can be built and used in a standalone mode. The framework architecture is unified to make it easy to add different compression algorithms for both PyTorch deep learning frameworks.

For more information about NNCF, see:

Table of contents

Key Features

Post-Training Compression Algorithms

Compression algorithm OpenVINO PyTorch TorchFX ONNX
Post-Training Quantization Supported Supported Experimental Supported
Weights Compression Supported Supported Experimental Supported
Activation Sparsity Not supported Experimental Not supported Not supported

Training-Time Compression Algorithms

Compression algorithm PyTorch
Quantization Aware Training Supported
Weight-Only Quantization Aware Training with LoRA and NLS Supported
Pruning Supported
  • Automatic, configurable model graph transformation to obtain the compressed model.
  • Common interface for compression methods.
  • GPU-accelerated layers for faster compressed model fine-tuning.
  • Distributed training support.
  • Git patch for prominent third-party repository (huggingface-transformers) demonstrating the process of integrating NNCF into custom training pipelines.
  • Exporting PyTorch compressed models to ONNX* checkpoints compressed models to SavedModel or Frozen Graph format, ready to use with OpenVINO™ toolkit.

Installation Guide

For detailed installation instructions, refer to the Installation guide.

NNCF can be installed as a regular PyPI package via pip:

pip install nncf

NNCF is also available via conda:

conda install -c conda-forge nncf

System requirements of NNCF correspond to the used backend. System requirements for each backend and the matrix of corresponding versions can be found in installation.md.

Third-party Repository Integration

NNCF may be easily integrated into training/evaluation pipelines of third-party repositories.

Used by

  • HuggingFace Optimum Intel

    NNCF is used as a compression backend within the renowned transformers repository in HuggingFace Optimum Intel. For instance, the command below exports the Llama-3.2-3B-Instruct model to OpenVINO format with INT4-quantized weights:

    optimum-cli export openvino -m meta-llama/Llama-3.2-3B-Instruct --weight-format int4 ./Llama-3.2-3B-Instruct-int4
    
  • Ultralytics

    NNCF is integrated into the Intel OpenVINO export pipeline, enabling quantization for the exported models.

  • ExecuTorch

    NNCF is used as primary quantization framework for the ExecuTorch OpenVINO integration.

  • torch.compile

    NNCF is used as primary quantization framework for the torch.compile OpenVINO integration.

  • OpenVINO Training Extensions

    NNCF is integrated into OpenVINO Training Extensions as a model optimization backend. You can train, optimize, and export new models based on available model templates as well as run the exported models with OpenVINO.

  • Microsoft Olive

    NNCF is used to quantize OpenVINO IR and ONNX models for the OpenVINO integration.

NNCF Compressed Model Zoo

List of models and compression results for them can be found at our NNCF Model Zoo page.

Citing

@article{kozlov2020neural,
    title =   {Neural network compression framework for fast model inference},
    author =  {Kozlov, Alexander and Lazarevich, Ivan and Shamporov, Vasily and Lyalyushkin, Nikolay and Gorbachev, Yury},
    journal = {arXiv preprint arXiv:2002.08679},
    year =    {2020}
}

Telemetry

NNCF as part of the OpenVINO™ toolkit collects anonymous usage data for the purpose of improving OpenVINO™ tools. You can opt-out at any time by running the following command in the Python environment where you have NNCF installed:

opt_in_out --opt_out

More information available on OpenVINO telemetry.

Release files for nncf 3.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nncf 3.4.0
File Size Uploaded
nncf-3.4.0.tar.gz 559.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nncf 3.4.0
File Interpreter ABI Platform
nncf-3.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.4 MB

Release files / nncf-3.4.0.tar.gz

Download URL nncf-3.4.0.tar.gz
Size 559.3 kB
Tags Source
SHA-256 checksum
How to use checksums
40b835e275b091197b853344de98ebe1026b58acfb83ffe69b9a0be305371d66
BLAKE2b-256 checksum
How to use checksums
fa1cd48fd3a520ec492867fb59679b30bf1e39468b73a7e24184e36f0dc3b8de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / nncf-3.4.0-py3-none-any.whl

Download URL nncf-3.4.0-py3-none-any.whl
Size 797.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc1b8b2fec7ac76462d8156df8c1b415e95ff3fc453e494787c64ea413f6663c
BLAKE2b-256 checksum
How to use checksums
168b4c1f567ae289c36e48557ec9889c0d3b153e05cf8b043e342939e494a5d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

3.4.0 This release

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.17.0

2 release files

2.16.0

2 release files

2.14.1

2 release files

2.14.0

2 release files

2.13.0

2 release files

2.12.0

2 release files

2.11.0

2 release files

2.10.0

2 release files

2.9.0

2 release files

2.8.1

2 release files

2.8.0

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page