straylight-archive/Model-Optimizer

A unified library of SOTA model optimization techniques like quantization, pruning, distillation, speculative decoding, etc. It compresses deep learning models for downstream deployment frameworks like TensorRT-LLM, TensorRT, vLLM, etc. to optimize inference speed.

0

stars

361

commits

Python

primary language

Dec 24, 2025

updated

nvidia.github.io/Model-Optimizer/

README

Banner image

NVIDIA Model Optimizer

Documentation version license

Documentation | Roadmap


NVIDIA Model Optimizer (referred to as Model Optimizer, or ModelOpt) is a library comprising state-of-the-art model optimization techniques including quantization, distillation, pruning, speculative decoding and sparsity to accelerate models.

[Input] Model Optimizer currently supports inputs of a Hugging Face, PyTorch or ONNX model.

[Optimize] Model Optimizer provides Python APIs for users to easily compose the above model optimization techniques and export an optimized quantized checkpoint. Model Optimizer is also integrated with NVIDIA NeMo, Megatron-LM and Hugging Face Accelerate for training required inference optimization techniques.

[Export for deployment] Seamlessly integrated within the NVIDIA AI software ecosystem, the quantized checkpoint generated from Model Optimizer is ready for deployment in downstream inference frameworks like SGLang, TensorRT-LLM, TensorRT, or vLLM.

Latest News

Previous News

Install

To install stable release packages for Model Optimizer with pip from PyPI:

pip install -U nvidia-modelopt[all]

To install from source in editable mode with all development dependencies or to use the latest features, run:

# Clone the Model Optimizer repository
git clone git@github.com:NVIDIA/Model-Optimizer.git
cd Model-Optimizer

pip install -e .[dev]

You can also directly use the TensorRT-LLM docker images (e.g., nvcr.io/nvidia/tensorrt-llm/release:<version>), which have Model Optimizer pre-installed. Make sure to upgrade Model Optimizer to the latest version using pip as described above. Visit our installation guide for more fine-grained control on installed dependencies or for alternative docker images and environment variables to setup.

Techniques

TechniqueDescriptionExamplesDocs
Post Training QuantizationCompress model size by 2x-4x, speeding up inference while preserving model quality![LLMs] [diffusers] [VLMs] [onnx] [windows][docs]
Quantization Aware TrainingRefine accuracy even further with a few training steps![NeMo] [Hugging Face][docs]
PruningReduce your model size and accelerate inference by removing unnecessary weights![PyTorch][docs]
DistillationReduce deployment model size by teaching small models to behave like larger models![NeMo] [Hugging Face][docs]
Speculative DecodingTrain draft modules to predict extra tokens during inference![Megatron] [Hugging Face][docs]
SparsityEfficiently compress your model by storing only its non-zero parameter values and their locations[PyTorch][docs]

Pre-Quantized Checkpoints

Resources

Model Support Matrix

Model TypeSupport Matrix
LLM QuantizationView Support Matrix
Diffusers QuantizationView Support Matrix
VLM QuantizationView Support Matrix
ONNX QuantizationView Support Matrix
Windows QuantizationView Support Matrix
Quantization Aware TrainingView Support Matrix
PruningView Support Matrix
DistillationView Support Matrix
Speculative DecodingView Support Matrix

Contributing

Model Optimizer is now open source! We welcome any feedback, feature requests and PRs. Please read our Contributing guidelines for details on how to contribute to this project.

Top Contributors

Contributors

Happy optimizing!

Contributors

(top 30 of 42)

kevalmorabia97

128 commits

cjluo-nv

24 commits

gcunhase

20 commits

ajrasane

20 commits

straylight-archive/Model-Optimizer

A unified library of SOTA model optimization techniques like quantization, pruning, distillation, speculative decoding, etc. It compresses deep learning models for downstream deployment frameworks like TensorRT-LLM, TensorRT, vLLM, etc. to optimize inference speed.

0

stars

361

commits

Python

primary language

Dec 24, 2025

updated

nvidia.github.io/Model-Optimizer/

README

Banner image

NVIDIA Model Optimizer

Documentation version license

Documentation | Roadmap


NVIDIA Model Optimizer (referred to as Model Optimizer, or ModelOpt) is a library comprising state-of-the-art model optimization techniques including quantization, distillation, pruning, speculative decoding and sparsity to accelerate models.

[Input] Model Optimizer currently supports inputs of a Hugging Face, PyTorch or ONNX model.

[Optimize] Model Optimizer provides Python APIs for users to easily compose the above model optimization techniques and export an optimized quantized checkpoint. Model Optimizer is also integrated with NVIDIA NeMo, Megatron-LM and Hugging Face Accelerate for training required inference optimization techniques.

[Export for deployment] Seamlessly integrated within the NVIDIA AI software ecosystem, the quantized checkpoint generated from Model Optimizer is ready for deployment in downstream inference frameworks like SGLang, TensorRT-LLM, TensorRT, or vLLM.

Latest News

Previous News

Install

To install stable release packages for Model Optimizer with pip from PyPI:

pip install -U nvidia-modelopt[all]

To install from source in editable mode with all development dependencies or to use the latest features, run:

# Clone the Model Optimizer repository
git clone git@github.com:NVIDIA/Model-Optimizer.git
cd Model-Optimizer

pip install -e .[dev]

You can also directly use the TensorRT-LLM docker images (e.g., nvcr.io/nvidia/tensorrt-llm/release:<version>), which have Model Optimizer pre-installed. Make sure to upgrade Model Optimizer to the latest version using pip as described above. Visit our installation guide for more fine-grained control on installed dependencies or for alternative docker images and environment variables to setup.

Techniques

TechniqueDescriptionExamplesDocs
Post Training QuantizationCompress model size by 2x-4x, speeding up inference while preserving model quality![LLMs] [diffusers] [VLMs] [onnx] [windows][docs]
Quantization Aware TrainingRefine accuracy even further with a few training steps![NeMo] [Hugging Face][docs]
PruningReduce your model size and accelerate inference by removing unnecessary weights![PyTorch][docs]
DistillationReduce deployment model size by teaching small models to behave like larger models![NeMo] [Hugging Face][docs]
Speculative DecodingTrain draft modules to predict extra tokens during inference![Megatron] [Hugging Face][docs]
SparsityEfficiently compress your model by storing only its non-zero parameter values and their locations[PyTorch][docs]

Pre-Quantized Checkpoints

Resources

Model Support Matrix

Model TypeSupport Matrix
LLM QuantizationView Support Matrix
Diffusers QuantizationView Support Matrix
VLM QuantizationView Support Matrix
ONNX QuantizationView Support Matrix
Windows QuantizationView Support Matrix
Quantization Aware TrainingView Support Matrix
PruningView Support Matrix
DistillationView Support Matrix
Speculative DecodingView Support Matrix

Contributing

Model Optimizer is now open source! We welcome any feedback, feature requests and PRs. Please read our Contributing guidelines for details on how to contribute to this project.

Top Contributors

Contributors

Happy optimizing!

Contributors

(top 30 of 42)

kevalmorabia97

128 commits

cjluo-nv

24 commits

gcunhase

20 commits

ajrasane

20 commits

Languages

Python

98.6%