/ˌoʊ.ɛnˈɛks/

noun … “an open format for representing and interoperating machine learning models.”

ONNX, short for Open Neural Network Exchange, is a standardized, open-source format designed to facilitate the exchange of machine learning models across different frameworks and platforms. Instead of tying a model to a specific ecosystem, ONNX provides a common representation that allows models trained in one framework, such as PyTorch or TensorFlow, to be exported and deployed in another, like Caffe2, MXNet, or Julia’s Flux ecosystem, without requiring complete retraining or manual conversion.

The ONNX format encodes models as a computation graph, detailing nodes (operations), edges (tensors), data types, and shapes. It supports operators for a wide range of machine learning tasks, including linear algebra, convolution, activation functions, and attention mechanisms. Models serialized in ONNX can be optimized and executed efficiently across CPUs, GPUs, and other accelerators, leveraging frameworks’ backend runtimes while maintaining accuracy and consistency.

ONNX enhances interoperability and production deployment. For example, a Transformer model trained in PyTorch can be exported to ONNX and then deployed on a high-performance inference engine like ONNX Runtime, which optimizes execution for various hardware targets. This reduces friction in moving models from research to production, supporting tasks like natural language processing, computer vision with CNN-based architectures, and generative modeling with GPT or VAE networks.

ONNX is closely associated with related technologies like ONNX Runtime, a high-performance engine for model execution, and converter tools that translate between framework-specific model formats and the ONNX standard. This ecosystem enables flexible workflows, such as fine-tuning a model in one framework, exporting it to ONNX for deployment on different hardware, and integrating it with other AI pipelines.

An example of exporting a model to ONNX in Python:

import torch
import torchvision.models as models

model = models.resnet18(pretrained=True)
dummy_input = torch.randn(1, 3, 224, 224)
torch.onnx.export(model, dummy_input, "resnet18.onnx") 

The intuition anchor is that ONNX acts as a universal “model passport”: it lets machine learning models travel seamlessly between frameworks, hardware, and platforms while retaining their learned knowledge and computational integrity, making AI development more flexible and interoperable.