Home Knowledge Base ONNX is an open model interchange specification that represents computation graphs, typed tensors, operators, attributes and parameters across training and inference ecosystems.

ONNX is an open model interchange specification that represents computation graphs, typed tensors, operators, attributes and parameters across training and inference ecosystems. It lets teams train in one framework, validate a portable graph and deploy through runtimes and hardware execution providers without rewriting the model by hand. ONNX Runtime is a widely used inference engine with CPU, GPU and accelerator execution providers. The standardized operator set evolves by opset; portability depends on the exact graph, opset and provider implementation, not an approximate operator count. A production definition states the service or pipeline boundary, tenants, workload and data classes, dependency graph, consistency and durability expectations, capacity envelope, latency and availability objectives, failure model, trust zones, deployment units, ownership, and evidence required for release. Architecture diagrams and service-level indicators must refer to the same boundary. Specify exporter and framework versions, opset, dynamic axes, input/output signature, external data, custom domains, preprocessing/postprocessing, precision, runtime/provider and numerical tolerances.

Architecture, control plane, and operating behavior. A framework traces or scripts a model into ONNX graph IR, shape inference and graph optimization fold constants and rewrite patterns, runtime partitions supported nodes among execution providers, and target kernels execute tensors on CPU/GPU/NPU. Export representative paths, validate schema, inspect graph, run a reference backend, optimize or quantize, select providers, compile/cache if supported, package model plus tokenizer/preprocessing, and compare target outputs and performance. ONNX offers broad interchange; TorchScript ties to PyTorch execution and has changing strategic status; TensorFlow SavedModel preserves TensorFlow functions; Core ML targets Apple devices; TensorRT engines are optimized artifacts for NVIDIA targets. The operational stack spans clients and producers, APIs or ingestion, queues and schedulers, stateless and stateful compute, accelerators, memory and storage, network fabrics, identity and policy, artifact registries, observability, automation, and human operations. Control-plane decisions and data-plane work are separated so overload or compromise in one does not silently corrupt the other. Evaluation combines correctness and model quality with throughput, p50/p95/p99 latency, queue depth, saturation, availability, error and retry rates, freshness, data loss, recovery time, recovery point, capacity, utilization, memory, network, energy, cost, and operator toil. Service-level objectives use user-visible good events, explicit windows, and error budgets rather than infrastructure uptime alone.

Implementation, infrastructure, and failure modes. Avoid data-dependent Python during export, define dynamic dimensions deliberately, keep custom ops versioned, fold preprocessing cautiously, use external tensor data for huge models, test shape inference, pin opset/provider and retain an unoptimized reference. Execution providers map graph partitions to CPU, CUDA/TensorRT, DirectML, OpenVINO and vendor NPUs. Unsupported nodes cause partition boundaries, copies or CPU fallback that can erase acceleration. Export captures wrong branch, dynamic shapes become static, semantic differences hide behind tolerance, custom ops vanish, quantization metadata is wrong, provider fallback is silent, graph optimizers change numerics or model exceeds protobuf/storage expectations. Implementation favors immutable artifacts, declarative configuration, typed schemas, idempotent operations, bounded retries with jitter, deadlines, backpressure, health and readiness probes, least privilege, encrypted transport and storage, progressive rollout, reproducible environments, and complete telemetry. Automation has dry-run, approval, audit, and rollback paths. AI infrastructure joins CPUs, GPUs or NPUs, HBM, host memory, NICs and DPUs, PCIe and scale-up links, leaf-spine networks, local and shared storage, power delivery, and cooling. Topology, NUMA locality, bandwidth, failure domains, thermal headroom, and accelerator memory determine delivered behavior and must be visible to schedulers. Common failures include retry storms, queue collapse, stale health signals, split brain, partial writes, incompatible schemas, silent data corruption, time skew, dependency amplification, capacity fragmentation, noisy neighbors, credential leakage, unbounded state, monitoring blind spots, and recovery procedures that exist only on paper. A healthy component does not prove a healthy user journey.

Verification, security, and lifecycle controls. Compare framework and ONNX outputs/gradients where relevant across shapes and edge values, inspect partitions, test every provider, serialize/load, quantize, benchmark warm/cold and verify preprocessing and tokenizer parity. Operator and shape coverage, numerical error, fallback count, partition copies, startup, latency, throughput, memory, artifact size, portability, quality and deployment success matter. Model packages require provenance, signatures, vulnerability/custom-op review, licenses, access, retention, model cards, safety evaluation and controlled conversion pipeline. Verification combines unit, contract and property tests, schema compatibility, load and soak tests, chaos and fault injection, security review, backup restoration, failover and rollback drills, dependency degradation, regional evacuation where applicable, data reconciliation, shadow traffic, canaries, and end-to-end synthetic checks. Tests run against production-like scale and permissions. Source, data, configuration, environment, model, registry metadata, infrastructure definition, dependency, image, driver, firmware, deployment, experiment, approval, incident, and rollback artifacts remain linked. Continuous controls detect drift, expired credentials, unowned resources, stale backups, regressions, policy exceptions, and unsupported versions. Owners define access, segregation of duties, data classification, residency, retention and deletion, vendor and supply-chain review, incident severity, communications, audit evidence, RTO/RPO or SLO exceptions, cost attribution, and change authority. Sensitive model and experiment artifacts receive the same integrity and confidentiality controls as source and production data.

Format/runtimePortabilityOptimization targetStrengthLimitation
ONNX plus RuntimeCross-framework/providersCPU/GPU/NPU EPsOpen interchange and runtimeOpset/export/provider gaps
PyTorch export/runtimePyTorch ecosystemPyTorch backendsTraining-code affinityCross-ecosystem coupling
TensorFlow SavedModelTensorFlow ecosystemTF Serving/TFLiteRich TF function assetsFramework coupling
Core MLApple platformsCPU/GPU/Neural EngineNative Apple deploymentPlatform-specific conversion
TensorRT engineNVIDIA targetSpecific GPU/runtimeAggressive kernel optimizationHardware/version portability
<svg viewBox="0 0 760 470" xmlns="http://www.w3.org/2000/svg" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif">
  <rect width="760" height="470" fill="#0d1117" rx="8"/>
  <text x="380" y="28" fill="#e6edf3" font-size="21" font-weight="700" text-anchor="middle">Open Neural Network Exchange (ONNX) Architecture</text>
  <text x="380" y="48" fill="#8b98a5" font-size="12" text-anchor="middle">Intermediate Representation (IR), Graph Optimization, Operator Sets (Opset) &amp; Execution Providers</text>

  <g transform="translate(25, 75)">
    <rect width="165" height="340" fill="#161b22" stroke="#30363d" stroke-width="1.5" rx="6"/>
    <text x="82.5" y="25" fill="#79c0ff" font-size="13" font-weight="600" text-anchor="middle">1. Training Frameworks</text>

    <rect x="12" y="45" width="141" height="110" fill="#0d1117" stroke="#30363d" rx="4"/>
    <text x="82.5" y="70" fill="#58a6ff" font-size="11" font-weight="600" text-anchor="middle">PyTorch / TensorFlow</text>
    <text x="82.5" y="90" fill="#8b98a5" font-size="10" text-anchor="middle">JAX / Keras / MindSpore</text>
    <text x="82.5" y="110" fill="#8b98a5" font-size="10" text-anchor="middle">Dynamic Computational Graph</text>
    <text x="82.5" y="130" fill="#3fb950" font-size="10" font-weight="600" text-anchor="middle">Export Engine</text>

    <rect x="12" y="190" width="141" height="140" fill="#0d1117" stroke="#30363d" rx="4"/>
    <text x="82.5" y="210" fill="#58a6ff" font-size="11" font-weight="600" text-anchor="middle">torch.onnx.export()</text>
    <text x="82.5" y="230" fill="#8b98a5" font-size="10" text-anchor="middle">Tracing vs Scripting</text>
    <text x="82.5" y="250" fill="#8b98a5" font-size="10" text-anchor="middle">Opset Versioning (1-21)</text>
    <text x="82.5" y="270" fill="#8b98a5" font-size="10" text-anchor="middle">Symbolic Shape Inference</text>
    <text x="82.5" y="300" fill="#3fb950" font-size="10" font-weight="600" text-anchor="middle">Standardized Serialization</text>
  </g>

  <g transform="translate(205, 75)">
    <rect width="165" height="340" fill="#161b22" stroke="#30363d" stroke-width="1.5" rx="6"/>
    <text x="82.5" y="25" fill="#79c0ff" font-size="13" font-weight="600" text-anchor="middle">2. ONNX IR Graph</text>

    <rect x="12" y="45" width="141" height="110" fill="#0d1117" stroke="#30363d" rx="4"/>
    <text x="82.5" y="70" fill="#d2a8ff" font-size="11" font-weight="600" text-anchor="middle">Protobuf Spec (.onnx)</text>
    <text x="82.5" y="90" fill="#8b98a5" font-size="10" text-anchor="middle">Nodes, Tensors, Attributes</text>
    <text x="82.5" y="110" fill="#8b98a5" font-size="10" text-anchor="middle">Single Static Graph</text>
    <text x="82.5" y="130" fill="#3fb950" font-size="10" font-weight="600" text-anchor="middle">Vendor-Neutral Format</text>

    <rect x="12" y="190" width="141" height="140" fill="#0d1117" stroke="#30363d" rx="4"/>
    <text x="82.5" y="210" fill="#d2a8ff" font-size="11" font-weight="600" text-anchor="middle">Graph Optimization</text>
    <text x="82.5" y="230" fill="#8b98a5" font-size="10" text-anchor="middle">Constant Folding</text>
    <text x="82.5" y="250" fill="#8b98a5" font-size="10" text-anchor="middle">Node Fusion (Conv+BN+ReLU)</text>
    <text x="82.5" y="270" fill="#8b98a5" font-size="10" text-anchor="middle">Dead Code Elimination</text>
    <text x="82.5" y="300" fill="#3fb950" font-size="10" font-weight="600" text-anchor="middle">Maximal Execution Speed</text>
  </g>

  <g transform="translate(385, 75)">
    <rect width="165" height="340" fill="#161b22" stroke="#30363d" stroke-width="1.5" rx="6"/>
    <text x="82.5" y="25" fill="#79c0ff" font-size="13" font-weight="600" text-anchor="middle">3. ONNX Runtime (ORT)</text>

    <rect x="12" y="45" width="141" height="110" fill="#0d1117" stroke="#30363d" rx="4"/>
    <text x="82.5" y="70" fill="#f0883e" font-size="11" font-weight="600" text-anchor="middle">Execution Providers</text>
    <text x="82.5" y="90" fill="#8b98a5" font-size="10" text-anchor="middle">CUDA / TensorRT (NVIDIA)</text>
    <text x="82.5" y="110" fill="#8b98a5" font-size="10" text-anchor="middle">ROCm (AMD) / OpenVINO</text>
    <text x="82.5" y="130" fill="#3fb950" font-size="10" font-weight="600" text-anchor="middle">DirectML (Windows)</text>

    <rect x="12" y="190" width="141" height="140" fill="#0d1117" stroke="#30363d" rx="4"/>
    <text x="82.5" y="210" fill="#f0883e" font-size="11" font-weight="600" text-anchor="middle">Quantization Engine</text>
    <text x="82.5" y="230" fill="#8b98a5" font-size="10" text-anchor="middle">INT8 Dynamic / Static</text>
    <text x="82.5" y="250" fill="#8b98a5" font-size="10" text-anchor="middle">FP16 Mixed Precision</text>
    <text x="82.5" y="270" fill="#8b98a5" font-size="10" text-anchor="middle">Weight-Only Quantization</text>
    <text x="82.5" y="300" fill="#3fb950" font-size="10" font-weight="600" text-anchor="middle">Memory Footprint Reduction</text>
  </g>

  <g transform="translate(565, 75)">
    <rect width="165" height="340" fill="#161b22" stroke="#30363d" stroke-width="1.5" rx="6"/>
    <text x="82.5" y="25" fill="#79c0ff" font-size="13" font-weight="600" text-anchor="middle">4. Target Deployments</text>

    <rect x="12" y="45" width="141" height="110" fill="#0d1117" stroke="#30363d" rx="4"/>
    <text x="82.5" y="70" fill="#3fb950" font-size="11" font-weight="600" text-anchor="middle">Production Infrastructure</text>
    <text x="82.5" y="90" fill="#8b98a5" font-size="10" text-anchor="middle">Cloud Servers &amp; Microservices</text>
    <text x="82.5" y="110" fill="#8b98a5" font-size="10" text-anchor="middle">Mobile (iOS / Android)</text>
    <text x="82.5" y="130" fill="#3fb950" font-size="10" font-weight="600" text-anchor="middle">Edge NPU Accelerators</text>

    <rect x="12" y="190" width="141" height="140" fill="#0d1117" stroke="#30363d" rx="4"/>
    <text x="82.5" y="210" fill="#3fb950" font-size="11" font-weight="600" text-anchor="middle">Cross-Platform Standard</text>
    <text x="82.5" y="230" fill="#8b98a5" font-size="10" text-anchor="middle">Zero Vendor Lock-In</text>
    <text x="82.5" y="250" fill="#8b98a5" font-size="10" text-anchor="middle">High Latency Consistency</text>
    <text x="82.5" y="270" fill="#8b98a5" font-size="10" text-anchor="middle">Enterprise AI Standard</text>
    <text x="82.5" y="300" fill="#3fb950" font-size="10" font-weight="600" text-anchor="middle">Optimal Model Serving</text>
  </g>

  <text x="380" y="452" fill="#6b7684" font-size="11" text-anchor="middle">Universal Machine Learning Model Serialization, Optimization and Multi-Hardware Execution Pipeline</text>
</svg>

Selection and production application. Use ONNX for cross-framework inference portability, target-native formats when platform integration dominates, and compiled engines for maximum fixed-target performance while preserving the portable source artifact. Vision, NLP, speech, recommendation, classical ML, edge, Windows, server and accelerator deployment use ONNX. ONNX connects training framework, exporter, graph optimizer, runtime, execution provider, drivers, hardware, model registry, CI and serving. The useful optimization and reliability boundary is the complete user-facing system. Improving a model server, network, registry, deployment controller, or pipeline stage can move the bottleneck or weaken consistency, safety, recoverability, and cost elsewhere, so decisions are validated end to end. A production definition states the service or pipeline boundary, tenants, workload and data classes, dependency graph, consistency and durability expectations, capacity envelope, latency and availability objectives, failure model, trust zones, deployment units, ownership, and evidence required for release. Architecture diagrams and service-level indicators must refer to the same boundary. Evaluation combines correctness and model quality with throughput, p50/p95/p99 latency, queue depth, saturation, availability, error and retry rates, freshness, data loss, recovery time, recovery point, capacity, utilization, memory, network, energy, cost, and operator toil. Service-level objectives use user-visible good events, explicit windows, and error budgets rather than infrastructure uptime alone. CFS connects this topic to semiconductor architecture, implementation, verification, manufacturing, packaging, test, and deployed AI-system tradeoffs across the platform.

onnxopen neural network exchangeonnx runtimemodel exchange formatexecution providerportable model

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.