Self-hosted service
NVIDIA/Model-Optimizer avatar
NVIDIA/Model-Optimizer

NVIDIA Model Optimizer: A Unified Toolchain for Compressing LLMs and Diffusion Models

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

3,810 stars599 forksPythonApache-2.0

At a glance

What is it?
NVIDIA Model Optimizer (ModelOpt) bundles quantization, pruning, distillation, NAS, and speculative decoding into one Python library, producing checkpoints ready for TensorRT-LLM, vLLM, and SGLang. It is a serious option for teams deploying large models on NVIDIA hardware, but its breadth comes with a steep learning curve and tight ecosystem coupling.
Who is it for?
Adopt Model Optimizer if you are deploying large language or diffusion models on NVIDIA GPUs and need a single, supported path from a Hugging Face or PyTorch checkpoint to a quantized, pruned, or distilled artifact for TensorRT-LLM, vLLM, or SGLang. Skip it if you are working outside the NVIDIA ecosystem, need a lightweight tool for a single technique, or cannot afford the time to learn its API and configuration.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What Problem It Solves and Who It Is For

Model Optimizer addresses a specific pain: turning a large trained model into something that runs fast enough and small enough for production inference. The README lists the input formats as Hugging Face, PyTorch, and ONNX, and the output as an optimized quantized checkpoint ready for deployment in TensorRT-LLM, TensorRT, vLLM, or SGLang. The intended user is an engineer or research team that has already trained or fine-tuned a model and now needs to compress it without losing too much accuracy. The library bundles techniques that are often scattered across separate tools: quantization (including FP8 and NVFP4), pruning, neural architecture search, distillation, speculative decoding, and sparsity. That breadth is the main selling point. Instead of stitching together a custom pipeline, you get one Python API that composes these methods and exports to a format the inference engine can consume. The customer stories in the README, such as Domyn compressing Colosseum-355B to 260B and Bielik.AI building a 7B model with 33% smaller size and 50% faster inference, suggest that the tool is aimed at serious production deployments, not just experiments.

The Mechanism: From Hugging Face Checkpoint to Deployable Quantized Artifact

The core flow is a three-stage pipeline. First, you load a model from Hugging Face, PyTorch, or ONNX. Second, you apply one or more optimization techniques through the Python API. Third, you export an optimized checkpoint that the downstream inference framework can load directly. The README emphasizes that the library is integrated with NVIDIA Megatron-Bridge, Megatron-LM, and Hugging Face Accelerate for training-required techniques like quantization-aware training (QAT) and distillation. That integration matters because some optimizations, such as pruning followed by distillation, require a training loop. The library does not just do post-training quantization; it also supports quantization-aware distillation, which the blog post about Nemotron 3.5 Lightning describes as recovering accuracy from aggressive NVFP4 quantization. The export API is unified for both transformers and diffusers models, which means the same code path can handle an LLM or a diffusion model. The actual data flow is not detailed in the README, but the repository layout shows example directories for different workflows, such as hf_ptq for post-training quantization and megatron_bridge for training-based methods. The key point is that the output is not a generic ONNX file; it is a checkpoint that is specifically tailored for the target inference engine, which is why the README says it is 'ready for deployment' in those frameworks.

Getting It Running: Installation and First Steps from the Repository

The README points to the PyPI package nvidia-modelopt, and the documentation lives at nvidia.github.io/Model-Optimizer. To install, you would typically run pip install nvidia-modelopt, though the exact command is not in the cleaned README. The repository contains example directories that show real usage. For instance, the examples/hf_ptq directory has a README with a support matrix for quantizing models like Llama 4. The examples/megatron_bridge/tutorials directory includes an end-to-end tutorial for Nemotron-3-Nano-30B-A3B that demonstrates pruning, two-phase distillation, and FP8 quantization. The README also mentions a unified Hugging Face export API that supports both transformers and diffusers models. To get started, you would likely clone the repository, look at the example scripts, and adapt them to your model. The configuration keys are not listed in the README, so you have to rely on the documentation site and the example code. The release cadence is active, with version 0.46.0 released in August 2026 and a 0.47.0rc0 following shortly after. That suggests the API is still evolving, so you should pin the version you use and check the release notes for breaking changes.

Real Limitations: Where Model Optimizer Is the Wrong Tool

The most obvious limitation is that Model Optimizer is deeply tied to NVIDIA hardware and software. The output checkpoints are meant for TensorRT-LLM, TensorRT, vLLM, and SGLang, but the quantization formats like NVFP4 are NVIDIA-specific. If you are targeting AMD GPUs, Apple Silicon, or even CPU inference, this library is not for you. A second limitation is the complexity of the optimization techniques themselves. The README does not claim that you can apply pruning or QAT with a single line of code. The Megatron-Bridge integration suggests that training-based methods require a separate training framework, which adds setup overhead. The customer stories show that successful results, like Bielik.AI's 7B model, involve careful tuning of the pruning and distillation process. The README also notes that the library is 'seamlessly integrated' into the NVIDIA ecosystem, but that integration means you are locked into a specific stack. If your deployment pipeline uses a different inference server, you will have to convert the checkpoint yourself. Finally, the support matrix for quantization is not universal. The README mentions a support matrix in the hf_ptq example, which implies that not every model architecture is supported out of the box. You may need to write custom code for a model that is not in the matrix.

Alternatives: How It Differs from a Single-Tool Approach

The main alternative is to use a dedicated library for each optimization technique. For quantization, you could use something like AutoGPTQ or bitsandbytes, which are popular for post-training quantization of Hugging Face models. For pruning, you might use a framework like Torch Pruning or a model-specific tool. The difference in approach is that these tools are often narrower and less integrated. AutoGPTQ, for example, focuses on GPTQ quantization and can export to a format that vLLM or TensorRT-LLM can load, but it does not handle pruning or distillation. Model Optimizer aims to be a one-stop shop, which reduces the need to write glue code between separate libraries. However, that breadth comes with a cost: the API is larger, and you must understand how the techniques interact. Another alternative is to use the native quantization support in the inference engine itself. TensorRT-LLM has its own quantization examples, as the README links to, which can be simpler if you only need post-training quantization for a supported model. The trade-off is that you lose the ability to compose techniques like pruning plus distillation, which Model Optimizer supports through its Megatron-Bridge integration. For a team that only needs basic FP8 quantization, the native engine path might be faster to set up. For a team that needs aggressive compression, Model Optimizer offers a more complete toolkit.

Maintenance, Upgrade Cost, and License Implications

Model Optimizer is under active development, with a new release every few weeks. The version numbers are in the 0.4x range, which signals that the API is not yet stable. The release cadence means you should expect frequent updates, and you will need to track changes to avoid breakage. The README does not mention a deprecation policy, so upgrading from 0.46.0 to 0.47.0 could introduce breaking changes without warning. The repository is not archived, and the last push is recent, which is a good sign for maintenance, but it also means the project is still maturing. The license is Apache-2.0, which is permissive and allows commercial use, modification, and redistribution, provided you include the license and attribution. That is a low-risk license for most organizations. However, the license does not cover the downstream inference frameworks, which have their own licenses. You should also note that the library is distributed on PyPI as nvidia-modelopt, and the package name is consistent with the repository. The documentation site is the primary source for API details, and the README points to a roadmap in the GitHub issues, which suggests that the maintainers are open to community input. The practical cost of maintenance is not just updating the library; it is also re-validating your optimized checkpoints after each upgrade, because changes in the export format could affect the deployment engine's behavior.

Editorial conclusion

Adopt Model Optimizer if you are deploying large language or diffusion models on NVIDIA GPUs and need a single, supported path from a Hugging Face or PyTorch checkpoint to a quantized, pruned, or distilled artifact for TensorRT-LLM, vLLM, or SGLang. Skip it if you are working outside the NVIDIA ecosystem, need a lightweight tool for a single technique, or cannot afford the time to learn its API and configuration. Before committing, verify that your exact model architecture is in the support matrix for the technique you need, and test the exported checkpoint in your target inference engine, since the library does not guarantee that every combination of technique and model will produce a working or accurate result. The repository's own examples show that success often depends on fine-tuning the quantization or distillation recipe, so plan for an iterative validation cycle.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Community notes

Community notes