Atlas · skill

ONNX

ONNX is an open representation for machine-learning models that describes computation as a graph of typed operations and parameters. Practitioners export and inspect models in this format to move them between compatible tools, preserving input semantics and checking operator versions rather than assuming export guarantees portable behavior.

toolModel Interchange & Portability

What it is

An ONNX model contains a graph, inputs and outputs, initializers and metadata, with operator semantics determined by imported domains and opset versions. The format separates the model representation from the framework that trained it and from the runtime that executes it. A runtime must support the relevant operators and types to evaluate the graph. This distinguishes ONNX from ONNX Runtime, one execution implementation, and from an optimized engine artifact built for specific hardware. Export translates framework behavior into the supported representation; dynamic shapes, custom operations and preprocessing can complicate that translation.

What the work involves

The practitioner chooses an export path and opset compatible with the target, declares input shapes and inspects the resulting graph. Structural validation should be followed by output comparison on representative inputs. Useful artifacts include the exported model, an input contract and parity checks against the source implementation. Preprocessing and tokenizer behavior need separate preservation if they are outside the graph. Deployment tests verify the target runtime's actual coverage instead of relying only on successful export in the training environment.

Illustrative example

A classifier trained in one framework must run in a different deployment stack. The team exports it to ONNX, records the opset and compares logits on the same normalized inputs. It discovers that preprocessing was previously performed outside the model and adds that contract to the deployment package. Tests include different permitted batch sizes and a malformed input, ensuring that portability covers the intended interface rather than one fixed example tensor.

Limits and common mistakes

A valid graph may use operators unsupported by the chosen runtime or execution provider. Export can change behavior through shape assumptions or missing external processing. Opset upgrades alter semantics and require compatibility checks. Quality requires structural validity, numerical parity and a complete input contract. ONNX facilitates interchange but does not guarantee identical performance, hardware support or task quality across every tool that can read the file.

Prerequisites

No prerequisites.

Related skills

Sources and further reading

  • ONNX concepts

    Explains graph structure, tensor values, operator domains and opset version semantics in ONNX models.

Last updated: 2026-10-10