MCPcopy Create free account
hub / github.com/intel/neural-compressor

github.com/intel/neural-compressor @v3.9

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.9 ↗ · + Follow
5,570 symbols 25,014 edges 557 files ⚖ Apache-2.0 2,703 documented · 49% 1 cross-repo links updated 2d agov3.9 · 2026-07-02★ 2,6941 open issues

Browse by type

Functions 4,695 Types & classes 839 Endpoints 36
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Intel® Neural Compressor

An open-source Python library supporting popular model compression techniques on mainstream deep learning frameworks (PyTorch, TensorFlow, and JAX)

python version license coverage Downloads

Architecture   |   Workflow   |   Documentations


Intel® Neural Compressor aims to provide popular model compression techniques such as Static Quantization, Dynamic Quantization, SmoothQuant, Weight-Only Quantization, Quantization-Aware Training, Mixed Precision, etc.

What's New

  • [2026/03] FP8 quantization support for Keras/JAX (experimental)
  • [2026/03] FP8 KV cache/Attention static quantization with AutoRound (experimental)
  • [2025/12] NVFP4 quantization experimental support
  • [2025/10] MXFP8 / MXFP4 quantization experimental support
  • [2025/09] FP8 dynamic quantization, including Linear, FusedMoE on Intel Gaudi AI Accelerators
  • [2025/05] FP8 static quantization of DeepSeek V3/R1 model on Intel Gaudi AI Accelerators
  • [2025/03] VLM quantization in transformers-like API on Intel CPU/GPU

Installation

Choose the necessary framework dependencies to install based on your deploy environment.

Install Framework for PyTorch Backend (on-demand)

Intel Neural Compressor supports PyTorch with CPU, GPU and HPU. Please install the corresponding PyTorch version based on your hardware environment. * Install intel_extension_for_pytorch for CPU
Install intel_extension_for_pytorch for Intel GPU
Use Docker Image with torch installed for HPU
Note: There is a version mapping between Intel Neural Compressor and Gaudi Software Stack, please refer to this table and make sure to use a matched combination.
* Install torch for other platform

Install Neural Compressor from pypi

# Framework extension API + PyTorch dependency
pip install neural-compressor-pt
# Framework extension API + TensorFlow dependency
pip install neural-compressor-tf
# Framework extension API + JAX dependency, available since v3.8
# JAX only support build from source installation method before [PyPI support](https://github.com/pypi/support/issues/10012) is available
INC_JAX_ONLY=1 pip install . 

Note: Further installation methods can be found under Installation Guide. check out our FAQ for more details.

Getting Started

After successfully installing these packages, try your first quantization program. Following example code demonstrates FP8 Quantization, it is supported by Intel Gaudi2 AI Accelerator.
To try on Intel Gaudi2, docker image with Gaudi Software Stack is recommended, please refer to following script for environment setup. More details can be found in Gaudi Guide.

Run a container with an interactive shell, more info

docker run -it --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --net=host --ipc=host vault.habana.ai/gaudi-docker/1.24.0/ubuntu24.04/habanalabs/pytorch-installer-2.10.0:latest

Note: Since Habana software >= 1.21.0, PT_HPU_LAZY_MODE=0 is the default setting. However, most low-precision functions (such as convert_from_uint4) do not support this setting. Therefore, we recommend setting PT_HPU_LAZY_MODE=1 to maintain compatibility.

Run the example,

from neural_compressor.torch.quantization import (
    FP8Config,
    prepare,
    convert,
)

import torch
import torchvision.models as models

model = models.resnet18()
qconfig = FP8Config(fp8_config="E4M3")
model = prepare(model, qconfig)

# Customer defined calibration. Below is a dummy calibration
model(torch.randn(1, 3, 224, 224).to("hpu"))

model = convert(model)

output = model(torch.randn(1, 3, 224, 224).to("hpu")).to("cpu")
print(output.shape)

More FP8 quantization doc.

Following example code demonstrates weight-only large language model loading on Intel Gaudi2 AI Accelerator.

from neural_compressor.torch.quantization import load

model_name = "TheBloke/Llama-2-7B-GPTQ"
model = load(
    model_name_or_path=model_name,
    format="huggingface",
    device="hpu",
    torch_dtype=torch.bfloat16,
)

Note: Intel Neural Compressor will convert the model format from auto-gptq to hpu format on the first load and save hpu_model.safetensors to the local cache directory for the next load. So it may take a while to load for the first time.

Documentation

Overview
Architecture Workflow APIs Examples
PyTorch Extension APIs
Overview
Dynamic Quantization Static Quantization Smooth Quantization
Weight-Only Quantization FP8 Quantization Mixed Precision
MX Quantization NVFP4 Quantization
Tensorflow Extension APIs
Overview Static Quantization Smooth Quantization
Transformers-like APIs
Overview
JAX Extension APIs
Overview
Other Modules
Auto Tune

Selected Publications/Events

Note: View Full Publication List.

Additional Content

Communication

  • GitHub Issues: mainly for bug reports, new feature requests, question asking, etc.
  • Email: welcome to raise any interesting research ideas on model compression techniques by email for collaborations.

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 3,278
Function 1,417
Class 839
Route 36

Languages

Python100%

Modules by API surface

neural_compressor/torch/algorithms/fp8_quant/_quant_common/helper_modules.py181 symbols
neural_compressor/torch/algorithms/layer_wise/modified_pickle.py132 symbols
neural_compressor/torch/quantization/config.py109 symbols
neural_compressor/torch/algorithms/smooth_quant/utility.py101 symbols
neural_compressor/tensorflow/utils/model_wrappers.py86 symbols
neural_compressor/jax/quantization/layers_static.py74 symbols
neural_compressor/torch/utils/auto_accelerator.py68 symbols
test/common/test_common.py61 symbols
neural_compressor/common/base_config.py57 symbols
examples/tensorflow/nlp/bert_large_squad_model_zoo/quantization/ptq/data_process.py56 symbols
neural_compressor/torch/algorithms/fp8_quant/_core/scale_methods/ops_quantizer.py54 symbols
neural_compressor/torch/algorithms/fp8_quant/_core/quantized_func_wrappers/hpu/hpu_quantized_func_wrapper.py54 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add neural-compressor \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page