Local & Offline
~9 min readUpdated: November 2026

Onnx2TEE: Graph-Aware ONNX Partitioning for Arm TrustZone Edge AI

Onnx2TEE Graph-Aware ONNX Partitioning for Arm TrustZone Edge AI

Onnx2TEE (arXiv:2611.33262, Oak Ridge National Laboratory & Tennessee Tech) is an automated pipeline that partitions non-sequential ONNX models between a Rich Execution Environment (REE) and an Arm TrustZone OP-TEE enclave. On NVIDIA Jetson AGX Orin (64 MiB TEE RAM), it isolates 96.96–97.06% of model weights inside single graph-aware segments.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

Onnx2TEE: Graph-Aware ONNX Partitioning for Arm TrustZone Edge AI: Onnx2TEE (arXiv:2611.33262, Oak Ridge National Laboratory & Tennessee Tech) is an automated pipeline that partitions non-sequential ONNX models between a Rich Execution Environment (REE) and an Arm TrustZone OP-TEE enclave. On NVIDIA Jetson AGX Orin (64 MiB TEE RAM), it isolates 96.96–97.06% of model weights inside single graph-aware segments. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.

Key Architectural Takeaways
Quick Implementation Exampleonnx2tee-edge-verifier.ts
onnx2tee-edge-verifier.tstypescript
import { createAgent } from '@smoke-monkey/harness';
const edgeSecurityAgent = createAgent({
agentId: 'onnx2tee-jetson-builder',
provider: 'ollama',
model: 'qwen2.5-coder:14b',
workspacePath: process.cwd(),
permissions: {
read_file: 'allow',
write_file: 'allow',
run_command: 'ask',
},
});
async function partitionEdgeModel() {
const task = await edgeSecurityAgent.run(
'Export YOLO26n to static ONNX opset 18, compute Onnx2TEE single-tensor cut points, ' +
'and verify Trusted Application heap remains strictly below 64 MiB for Jetson AGX Orin OP-TEE v3.19.'
);
console.log('TEE Partition Plan:', task.summary);
}
partitionEdgeModel().catch(console.error);
Video Guides

Watch: Related Video Guides

Edge AI on the NVIDIA Jetson Orin Nano: TensorRT, Hand-Written CUDA, Contention, and Power

ONNX Explained with Example | Quick ML Tutorial

What Is Onnx2TEE? Protecting Edge Model Weights Under 64 MiB TEE Limits

Onnx2TEE (arXiv:2611.33262) is an automated, model-independent compilation pipeline from Oak Ridge National Laboratory and Tennessee Technological University that splits ONNX computation graphs across an untrusted Rich Execution Environment (REE) and a hardware-isolated Trusted Execution Environment (TEE). On compromised edge hosts where privileged OS attackers can dump process memory, TEEs prevent model weight exfiltration—but strict enclave memory caps (default 64 MiB on Jetson AGX Orin) make executing entire modern networks inside the TEE infeasible.

Earlier split-inference methods either pruned models, offloaded layers to remote servers, or shoved bloated ML runtimes inside the enclave. Onnx2TEE takes a compiler approach: it parses static-shape ONNX opset 18 graphs, locates topological bottlenecks where dataflow collapses to a single tensor, and compiles native C code using the GlobalPlatform TEE API so zero general-purpose ML runtime enters the trusted computing base (TCB).

Graph-Aware Segmentation & Extreme Parameter Concentration

Because modern vision backbones contain skip connections and parallel branches, naive layer-by-layer cuts force multiple intermediate tensors across the REE/TEE boundary. Onnx2TEE's segmentation algorithm places cut boundaries $P_k$ strictly where all active graph edges converge to a single tensor, guaranteeing dependency preservation with minimal cross-world shared memory.

Evaluating on NVIDIA Jetson AGX Orin (ARM Cortex-A78AE, JetPack v5.1.2 / L4T r35.4.1, Arm TrustZone with OP-TEE v3.19 and 64 MiB TEE RAM) revealed massive parameter skew across segments:

Model EvaluatedParametersONNX OpsetGraph Segments ($S_n$)Peak Single-Segment Weight ConcentrationFull Model Fits in 64 MiB TEE?
MNIST Classifier CNN206,9221810 segments (S_1..S_10)97.06% in Segment S_8 (128-unit FC)Yes (all partitions deployable)
Ultralytics YOLO26n2,400,0001819 segments (S_1..S_19)96.96% in Segment S_17 (neck/feature-fusion)No (requires partitioned execution)

Crucially, adding an adjacent segment can sometimes shrink TEE heap memory: absorbing a node that fans out into fewer or smaller boundary tensors reduces the duplicated shared-memory input/output buffers required at the REE/TEE border.

Protect Parameter-Dense Segments First

Segment count does not correlate with weight protection. Protecting just Segment 8 on MNIST or Segment 17 on YOLO26n shields ~97% of trained parameters while leaving lightweight front-end convolutions in the REE.

TEE Memory Validation, World-Switching Latency & Reproduction

Onnx2TEE validates every candidate partition $(P_i, P_j)$ prior to cross-compilation by summing embedded model weights, intermediate activation scratchpads, and duplicated shared-memory I/O buffers. Any configuration exceeding the 64 MiB OP-TEE heap budget is flagged as undeployable before flashing.

Benchmarking with clock_gettime(CLOCK_MONOTONIC) on Jetson AGX Orin confirmed that world-switching (Secure Monitor calls, TA construction/destruction, and session open/close) dominates small networks: for MNIST, even the lightest TEE partition incurred 93% higher latency than REE-only execution, whereas placing weight-heavy Segment S_8 inside the TEE added minimal extra overhead compared to lighter segments. For the 2.4M-parameter YOLO26n network, compute inside the TEE forms a much larger share of total latency relative to transition overhead.

bash
# 1. Export PyTorch model with static input shape and ONNX opset 18
python3 -c "import torch; torch.onnx.export(model, dummy_in, 'yolo26n.onnx', opset_version=18)"

# 2. Cross-compile REE Client App + OP-TEE v3.19 Trusted App for Jetson L4T r35.4.1
# Verify OP-TEE TA heap allocation fits within default 64 MiB TrustZone DRAM
./onnx2tee_pipeline --model yolo26n.onnx --tee-heap-limit-mb 64 --target aarch64-jetson-optee
Google Search Questions & Answers

Frequently Asked Questions

Q:How does Onnx2TEE decide where to split non-sequential models like YOLO26n?

Onnx2TEE identifies topological cut points in the ONNX computational graph where parallel branches and skip connections converge down to a single tensor, producing 19 valid segments for YOLO26n while minimizing REE-to-TEE shared memory copies.

Q:Why doesn't Onnx2TEE put the entire model inside Arm TrustZone?

Default OP-TEE v3.19 memory on NVIDIA Jetson AGX Orin is capped at 64 MiB. While a 206K-parameter CNN fits completely, larger detectors like 2.4M-parameter YOLO26n exceed the TEE heap budget unless partitioned.

Q:What percentage of model weights can a single Onnx2TEE segment protect?

Because weights cluster heavily in specific layers, Segment 8 captures 97.06% of the MNIST CNN's parameters and Segment 17 captures 96.96% of YOLO26n's parameters.

Q:Does Onnx2TEE require Python or ONNX Runtime inside the Trusted Execution Environment?

No. Onnx2TEE compiles model-specific C code against the GlobalPlatform TEE API and embeds weights directly inside the Trusted Application binary, keeping the Trusted Computing Base minimal.

Related Alternatives & Comparisons

Related Architecture Guides

View all guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness