liveBook · Manning

ONNX

As explained in LLMs in Production

ONNX is an open model format and ecosystem for representing neural-network models across different frameworks, tools, and hardware environments.

ONNX acts as a practical middle layer between model frameworks and hardware-specific deployment. Instead of writing conversions for every framework–device pairing, developers export to an intermediate representation that vendors can compile for GPUs, TPUs, CPUs, and other hardware. section 6.1.1

The main production trade-off is simpler interoperability rather than eliminating deployment work:

  • Frameworks such as PyTorch and TensorFlow export models to ONNX or other intermediate representations. section 6.1.1
  • Hardware vendors then convert the representation into machine code optimized for their devices. section 6.1.1
  • Export and compilation still require compatible tooling and expertise in both model architecture and hardware architecture. section 6.1.1

Exporting a model

A command-line workflow can export a Hugging Face model to ONNX and request optimization: `optimum-cli export onnx --model WizardLM/WizardCoder-1B-V1.0 ./models_onnx --optimize O1`.

How LLMs in Production covers it

How deep it goes
Explains ONNX as an intermediate representation and motivates its conversion architecture, but stops short of representation internals.
Examples
Uses an Optimum CLI command to export WizardCoder to ONNX with O1 optimization.
What it assumes
Assumes familiarity with machine-learning frameworks and hardware targets while treating framework-to-hardware conversion as the central problem.
What you can do after
Apply it via Optimum to export a model into an optimized ONNX deployment artifact.
How it connects
Connects PyTorch, TensorFlow, TorchScript, MLIR, hardware vendors, and machine-code compilation.

Also explained in

Compare how 7 books explain ONNX →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of LLMs in Production. The section links point to the parts of the book it draws on.