inisis/OnnxSlim

A Toolkit to Help Optimize Onnx Model

What it solves

OnnxSlim reduces the complexity of ONNX models by removing unnecessary operators. This process slims down the model while maintaining the same accuracy, which leads to improved inference speed and faster model loading times.

How it works

It provides a Python package and a command-line interface to process ONNX models. Users can either run a simple bash command to slim a model or use the onnxslim.slim() function within a Python script to optimize the graph structure of the model.

Who it’s for

It is designed for AI developers and ML engineers who need to optimize their models for deployment, particularly those using the ONNX format to target various hardware accelerators or inference engines.

Highlights

  • Integrated into major frameworks like NVIDIA TensorRT-Model-Optimizer, HuggingFace Optimum, and transformers.js.
  • Proven performance in LLM inference optimization challenges (ranking 1st in AICAS 2024 and 2025).
  • Widely adopted by projects such as Ultralytics and MNN-LLM.
  • Simple installation via pip.

Related

  • Project
  • Project
  • Project
  • Project
  • Project