PyTorch 后端需按硬件单独安装对应版本的 intel_extension_for_pytorch 或 torch;Gaudi 软件栈与 Neural Compressor 有版本映射,需按文档表格匹配;低精度函数多不支持 PT_HPU_LAZY_MODE=0,建议设为 1;首次加载 GPTQ 模型会转换格式并缓存,耗时较长。
neural-compressor
intelApache-2.0活跃维护面向 PyTorch、TensorFlow 和 ONNX Runtime 的模型压缩工具,支持 INT8/FP8/INT4 等低比特量化和稀疏化,帮大模型在低精度下保持精度并降低显存与推理成本。
SOTA low-bit LLM quantization (INT8/FP8/MXFP8/INT4/MXFP4/NVFP4) & sparsity; leading model compression techniques on PyTorch, TensorFlow, and ONNX Runtime
pip install neural-compressor-pt
pip install neural-compressor-jaxREADME 未给出具体显存要求;主要面向 Intel Gaudi AI 加速器、Core Ultra、Xeon 可扩展处理器、Xeon CPU Max 系列及 Data Center GPU Flex/Max 系列,并有限测试 AMD CPU、ARM CPU 和 NVIDIA GPU。PyTorch 后端支持 CPU、GPU 和 HPU,需按硬件安装对应 PyTorch 版本。
Intel 开源的模型压缩库,支持 PyTorch/JAX 上的低比特量化与稀疏化
面向 PyTorch、TensorFlow 和 ONNX Runtime 的模型压缩工具,支持 INT8/FP8/INT4 等低比特量化和稀疏化,帮大模型在低精度下保持精度并降低显存与推理成本。
核心能力
- 支持 INT8/FP8/MXFP8/INT4/MXFP4/NVFP4 低比特量化
- 提供静态、动态、SmoothQuant、仅权重量化与量化感知训练
- 集成 AutoRound 量化 LLaMA、Qwen、DeepSeek 等大模型与 VLM
- 提供 transformers 风格 API 加载 GPTQ 等预量化模型
- 覆盖 Intel Gaudi、Core Ultra、Xeon 及 Flex/Max GPU
容易踩的坑
- v3.10Intel Neural Compressor Release 3.10最新正式版2026-09-29 · 2026-09-29 07:11 UTC
- Highlights
- Features
- Improvements
- Validated Hardware
- Validated Configurations
Highlights
- NVFP4 with E5M3 scaling experimental support for PyTorch
- Selective and mixed quantization support for Keras/JAX
Features
- Support NVFP4 with E5M3 scaling for PyTorch (Experimental)
- Support model-free quantization for PyTorch
- Add dynamic fused MoE bias support for GPT-OSS model on Gaudi
- Add vLLM QDQ plugin for accuracy benchmark based on simulation
- Support for selective and mixed quantization in Keras/JAX, allowing different model components to remain unchanged or use different quantization methods and configurations, including static or dynamic quantization, different data types, and other quantization options
- Support for quantization per channel for weights for Keras/JAX
Improvements
- Security issue fixes
- SDXL model MXFP8 PTQ example
- Kimi K2.6 MXFP4 PTQ example
- Minimax-M2.7 MXFP4 PTQ example
Validated Hardware
- Intel Gaudi Al Accelerators (Gaudi 2 and 3)
- Intel Xeon Scalable processor (4th, 5th and 6th Gen)
- Intel® Arc™ B-Series Graphics GPU (B60)
Validated Configurations
- Ubuntu 24.04 & Win 11
- Python 3.11, 3.12, 3.13
- PyTorch 2.12, 2.13, 2.14
- JAX 0.10
Notes
- It is recommended to use version v3.10 or later to mitigate code CVEs.
- v3.9Intel Neural Compressor Release 3.92026-07-02 · 2026-07-02 01:11 UTC
查看更新说明
- Highlights
- Features
- Improvements
- Validated Hardware
- Validated Configurations
Highlights
- INT8 quantization for ViT model for JAX framework
Features
- Support INT8 quantization for ViT model for Keras/JAX
- Support Out-of-place quantization for Keras/JAX
- Support quantization of BFloat16 models for Keras/JAX
- Support quantization for Conv2D, dot_product_attention for Keras/JAX
Improvements
- Improving performance with constant scales and weights support for Keras/JAX
- Handling uncalibrated model layers for Keras/JAX
- WAN series MXFP8 PTQ example
- DeepSeek V4 series mixed MXFP4/MXFP8 example
Validated Hardware
- Intel Gaudi Al Accelerators (Gaudi 2 and 3)
- Intel Xeon Scalable processor (4th, 5th and 6th Gen)
- Intel® Arc™ B-Series Graphics GPU (B60)
Validated Configurations
- Ubuntu 24.04 & Win 11
- Python 3.11, 3.12, 3.13
- PyTorch 2.10, 2.11, 2.12
- JAX 0.10
Notes
- It is recommended to use version v3.9 or later to mitigate code CVEs.
- v3.8Intel Neural Compressor Release 3.82026-06-02 · 2026-06-02 01:20 UTC
查看更新说明
- Highlights
- Features
- Improvements
- Validated Hardware
- Validated Configurations
Highlights
- Introduced new JAX framework experimental support
Features
- Support FP8 quantization for Keras/JAX (experimental)
- Support FP8 KV cache static quantization (experimental)
- Support FP8 Attention static quantization (experimental)
Improvements
- New Gemma3 FP8 PTQ example for Keras/JAX
- New ViT FP8 PTQ example for Keras/JAX
- Llama 3 series MXFP4 / MXFP8 PTQ example with FP8 KV & Attention
- Llama 4 Scout MXFP4 / MXFP8 PTQ example with FP8 KV & Attention
- Qwen3 MXFP4 / MXFP8 PTQ example with FP8 KV & Attention
- DeepSeek R1 MXFP4 / MXFP8 PTQ example with FP8 KV & Attention
- Transformers v5 support
- Removal of deprecated 2.x API
Validated Hardware
- Intel Gaudi Al Accelerators (Gaudi 2 and 3)
- Intel Xeon Scalable processor (4th, 5th and 6th Gen)
- Intel® Arc™ B-Series Graphics GPU (B580 and B60)
Validated Configurations
- Ubuntu 24.04 & Win 11
- Python 3.11, 3.12, 3.13
- PyTorch 2.9, 2.10
- JAX 0.9
Notes
- It is recommended to use version v3.8 or later to mitigate code CVEs.
- v3.7Intel Neural Compressor Release 3.72025-12-25 · 2025-12-25 03:50 UTC
查看更新说明
- Highlights
- Features
- Improvements
- Validated Hardware
- Validated Configurations
Highlights
- Introduced NVFP4 quantization experimental support and mixed bits (MXFP4 & MXFP8) autotuning on LLMs
Features
- Support NVFP4 Post-Training Quantization (PTQ) on LLM models (experimental)
- Support mixed bits (MXFP4 & MXFP8) autotuning on LLM models (experimental)
- Support MXFP8 PTQ on video generation diffusion model (experimental)
- Support MXFP4 Quantization-Aware Training (QAT) on LLM models (experimental)
Improvements
- Update of Llama 3 series example for NVFP4 and auto mixed-bits (MXFP4 & MXFP8) PTQ
- New LLM example (DeepSeek R1) for MXFP8, MXFP4, NVFP4 PTQ
- New LLM example (Qwen3-235B ) for MXFP8, MXFP4 PTQ
- New video generation diffusion example (FramePack) for MXFP8 PTQ
- Update of Llama3 example for MXFP4 QAT
- Removal of test purpose benchmarking feature for security consideration
Validated Hardware
- Intel Gaudi Al Accelerators (Gaudi 2 and 3)
- Intel Xeon Scalable processor (4th, 5th, 6th Gen)
- Intel Core Ultra Processors (Series 1 and 2)
- Intel Data Center GPU Max Series (1550)
- Intel® Arc™ B-Series Graphics GPU (B580 and B60)
Validated Configurations
- Ubuntu 24.04 & Win 11
- Python 3.10, 3.11, 3.12, 3.13
- PyTorch/IPEX 2.7, 2.8
- PyTorch 2.9
- v3.6Intel Neural Compressor Release 3.62025-10-24 · 2025-10-24 02:59 UTC
查看更新说明
- Highlights
- Features
- Improvements
- Validated Hardware
- Validated Configurations
Highlights
- Introduced new low precision data type quantization experimental support, including MXFP8 and MXFP4
Features
- Support MXFP8 Post-Training Quantization (PTQ) on LLM models (experimental)
- Support MXFP8 PTQ on diffusion models (experimental)
- Support MXFP4 PTQ on LLM models (experimental)
- Support Quantization-Aware Training (QAT) on LLM models (experimental)
Improvements
- New LLM example (Llama 3 series) for MXFP4 / MXFP8 PTQ
- New VLM example (Llama 4 Scout) for MXFP4 PTQ
- New diffusion example (Flux) for MXFP8 PTQ
- New LLM example (Llama 3) for MXFP8 QAT
- Static safe check for evaluation function in 2.x API
Validated Hardware
- Intel Gaudi Al Accelerators (Gaudi 2 and 3)
- Intel Xeon Scalable processor (4th, 5th, 6th Gen)
- Intel Core Ultra Processors (Series 1 and 2)
- Intel Data Center GPU Max Series (1550)
- Intel® Arc™ B-Series Graphics GPU (B580)
Validated Configurations
- Ubuntu 24.04 & Win 11
- Python 3.10, 3.11, 3.12
- PyTorch/IPEX 2.7, 2.8
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Intel® Neural Compressor
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.
-
Support advanced quantization of Large Language Models (LLMs) and Vision-Language Models (VLMs) such as LLaMA, Qwen, DeepSeek, Flux, FramePack, etc., across diverse quantization techniques and low-precision data types through integration with AutoRound.
-
Support a wide range of Intel hardware such as Intel Gaudi Al Accelerators, Intel Core Ultra Processors, Intel Xeon Scalable Processors, Intel Xeon CPU Max Series, Intel Data Center GPU Flex Series, and Intel Data Center GPU Max Series with extensive testing; support AMD CPU, ARM CPU, and NVidia GPU with limited testing.
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 + JAX dependency
pip install neural-compressor-jax
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=0is the default setting. However, most low-precision functions (such asconvert_from_uint4) do not support this setting. Therefore, we recommend settingPT_HPU_LAZY_MODE=1to 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
Selected Publications/Events
- arXiv: Faster Inference of LLMs using FP8 on the Intel Gaudi (Mar 2025)
- PyTorch landscape: PyTorch general optimizations (Mar 2025)
- Blog on SqueezeBits: [Intel Gaudi] #4. FP8 Quantization (Jan 2025)
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.