ONNX and runtimes
/ ON-niks and RUN-times /
ONNX (Open Neural Network Exchange) is a shared file format for trained models — a common language that lets a model built in one framework be loaded and run by tools from another. A runtime is the engine that actually executes a model efficiently on a given piece of hardware. Think of ONNX as the PDF of machine learning: you might write a document in any word processor, but saving it as a PDF means anyone can open it anywhere. The runtime is the PDF reader that displays it fast on your particular device.
Why this matters concretely: models are often trained in one ecosystem (with its own way of describing networks) but need to run somewhere completely different — a phone, a browser, an embedded chip, a cloud server with special accelerators. Without a common format, every such move means painful, error-prone rewriting. Exporting to ONNX decouples 'how the model was built' from 'where it runs.' A runtime like ONNX Runtime then takes that file and applies hardware-specific optimizations — fusing operations, picking the fastest implementation for the chip — to make inference quick.
Why it matters: this is the unglamorous plumbing that lets the same model run across wildly different environments, and good runtimes can speed up inference substantially over a naive setup. The honest caveats: the export step is not always smooth — exotic or custom operations sometimes don't translate, versions drift, and a converted model occasionally behaves subtly differently and must be re-verified. ONNX is a widely used standard but not the only one, and 'export and pray' is a real failure mode; always test the converted model gives the same answers.
A team trains an image model on cloud GPUs, exports it to ONNX, and the same file then runs in three places: a web browser, an Android app, and an edge device — each using a runtime tuned for its own hardware, no rewriting of the model required.
Train once, export to a shared format, run anywhere — the role ONNX is built to play.
Exporting a model to a portable format is not guaranteed to be lossless or bug-free. Unusual operations may fail to convert, and numerical results can drift slightly. Treat conversion as something to verify with side-by-side tests, not assume.