Onnx

Open standard for machine learning interoperability

Last verified:

Visit Onnx

What is Onnx?

ONNX (Open Neural Network Exchange) is an open-source format and ecosystem for representing machine learning models, both deep learning and traditional ML. It provides an open source format for AI models that defines an extensible computation graph model, as well as definitions of built-in operators and standard data types. ONNX enables interoperability between different frameworks, allowing developers to train models in one framework like PyTorch or TensorFlow and deploy them using another for inference.

Key features include framework interoperability, allowing development in preferred frameworks without worrying about downstream inferencing implications. ONNX makes it easier to access hardware optimizations by providing compatibility with runtimes and libraries designed to maximize performance across hardware accelerators. The format focuses on inferencing capabilities and is serialized using Protocol Buffers. ONNX has two variants: the base definition for neural network technologies and ONNX-ML which includes additional types and operators for classical machine learning algorithms.

ONNX is designed for AI developers, machine learning engineers, and data scientists who need to move models between frameworks or deploy to production. It is particularly valuable for teams that use different frameworks for training versus deployment, hardware vendors who want to optimize for their platforms, and organizations seeking to prevent framework lock-in. As an LF AI graduate project with open governance, ONNX is a community-driven initiative with wide industry support from Microsoft, Facebook, IBM, Huawei, Intel, AMD, Arm, and Qualcomm.

Onnx pricing

Pricing model: Freemium

ONNX is completely free and open-source under the Apache 2.0 license. It is a community project with no paid tiers or commercial licensing fees. The ONNX Python package is published on PyPI and can be installed via pip install onnx. Weekly packages are also published on PyPI for experimentation and early testing. There are no premium features or enterprise plans - all functionality is available to everyone at no cost.

Onnx pros

  • Open-source format with Apache 2.0 license
  • Enables framework interoperability between PyTorch, TensorFlow, and others
  • Prevents vendor and framework lock-in
  • Wide hardware acceleration support across CPUs, GPUs, and AI accelerators
  • Standardized computation graph model for ML algorithms
  • Extensive built-in operator definitions
  • Supported by major tech companies including Microsoft and Meta
  • LF AI graduate project with open governance structure
  • Streamlines path from research to production
  • Protocol Buffers serialization for efficient storage
  • Active community with 20.2k GitHub stars
  • Used by over 49,000 projects
  • Includes ONNX-ML for classical machine learning algorithms
  • Shape and type inference capabilities
  • Graph optimization tools available
  • Python and C++ API support
  • Opset version conversion for model compatibility

Onnx cons

  • Conversion failures are common and often subtle between frameworks
  • Silent numeric errors where conversion succeeds but outputs differ
  • Operator coverage gaps where operators lack ONNX equivalents
  • Shape inference errors can occur during conversion
  • Opaque error messages make debugging difficult
  • Primarily focused on inferencing rather than training
  • Conversion process is fragile compared to native framework deployment
  • Some practitioners abandon ONNX after repeated conversion failures

Frequently asked questions about Onnx

What is ONNX?

ONNX (Open Neural Network Exchange) is an open-source artificial intelligence ecosystem that establishes open standards for representing machine learning algorithms and software tools. It provides an open source format for AI models, both deep learning and traditional ML, defining an extensible computation graph model along with built-in operators and standard data types. ONNX enables interoperability between different ML frameworks.

Which frameworks support ONNX?

ONNX is widely supported across many frameworks including PyTorch, TensorFlow, Keras, Chainer, MXNet, CNTK, Caffe2, and scikit-learn. Developers can export models from these frameworks to ONNX format and then run them in different runtime systems or on various hardware platforms. Native support exists for PyTorch, CNTK, MXNet, and Caffe2, with converters available for TensorFlow and CoreML.

What is ONNX used for?

ONNX is primarily used for inferencing (scoring) in machine learning. It enables developers to move machine learning models between different frameworks that may be used at different stages of development, such as training, architecture design, or deployment on mobile devices. It also provides a common representation that hardware vendors can use to apply optimizations to neural network models across multiple frameworks.

Is ONNX free to use?

Yes, ONNX is completely free and open-source under the Apache 2.0 license. It is a community project with no paid tiers or commercial licensing fees. The ONNX Python package is published on PyPI and can be installed via pip install onnx. All functionality is available to everyone at no cost.

What is the ONNX file format?

The ONNX container format is Protocol Buffers (protobuf). Models are serialized into a binary format with the .onnx file extension. Each computation dataflow graph is a list of nodes that form an acyclic graph, where nodes have inputs and outputs and each node is a call to an operator. Metadata documents the graph.

What is the difference between ONNX and ONNX-ML?

The base definition of ONNX includes the necessary support for machine learning algorithms based on neural network technologies. ONNX-ML includes additional types and standard operators commonly used in classical machine learning algorithms. The two variants were created to recognize the desire for some frameworks to go beyond neural network algorithms in a standardized fashion, while allowing other frameworks to support only neural networks.

How do I install ONNX?

ONNX released packages are published in PyPI and can be installed using pip install onnx. You can also install with optional reference implementation dependencies using pip install onnx[reference]. ONNX weekly packages are also published on PyPI to enable experimentation and early testing. The package provides abi3-compatible wheels working across multiple Python versions from 3.12 onwards.

Who maintains ONNX?

ONNX is a community project with open governance structure under the Linux Foundation AI (LF AI), where it became a graduate project in November 2019. It was originally developed by Facebook's PyTorch team and announced by Facebook and Microsoft in September 2017. The project has support from Microsoft, Meta, IBM, Huawei, Intel, AMD, Arm, Qualcomm, and many other companies in the ONNX ecosystem.

Can I convert models to ONNX from any framework?

You can export or convert models from many frameworks to the standard ONNX format, including TensorFlow, PyTorch, scikit-learn, Keras, Chainer, MXNet, and MATLAB. However, conversion failures are common and often subtle, with operator coverage gaps, silent numeric errors, shape inference errors, and opaque error messages being documented failure modes. Conversion should always be validated with test cases comparing outputs numerically.

What are the limitations of ONNX?

The main limitations include common and subtle conversion failures between frameworks, silent numeric errors where conversion succeeds but model outputs differ from the original, operator coverage gaps where operators lack ONNX equivalents, shape inference errors, and opaque error messages. The interoperability promise does not always match everyday reliability, and many practitioners report abandoning ONNX conversion after repeated failures.

Categories

Use cases

Browse all AI tools on NeedAnAI