Skip to navigation

Benchmark runtime

Runs on: gpu Dockerfile
First run can take longer while the worker pulls the configured Docker image.

Overview

Measures how fast a trained model runs once it is exported, and compares the formats side by side. Give it a dataset of images and it times the whole pipeline per image - preprocess, model, postprocess (decode and NMS) - and reports the three stages separately, so you can see what share of the latency NMS takes. Without a dataset it times the forward pass alone on random input.

Point the node at the model, not at an export. It finds the exports that were created from that model, times each one on the GPU it is running on, and writes a report with latency, throughput, and the speedup between formats. The badge shows the throughput of the fastest format.

Export model Benchmark runtime Report

Prerequisites

RequirementWhat you need
GPU workerA worker with an NVIDIA GPU. The node refuses to measure on CPU, because CPU numbers would not describe the deployment target.
ONNX exportAn existing ONNX export of the model, from an Export to ONNX node. It is both a benchmarked format and the source the TensorRT engine is built from.
TensorRT export (optional)Needed only to include TensorRT in the comparison. Without it the report covers ONNX Runtime alone.
Images dataset (optional)Needed for end-to-end timing. Pick images like the ones the model will see in use: the cost of NMS depends on how many boxes the model finds in them.

How it works

1

Finds the export assets that were created from the model, one per format.

2

Builds a fresh TensorRT engine from the ONNX export when a TensorRT export exists, so the engine matches the TensorRT version on this worker.

3

Downloads the sample of images and decodes it once, before any timing.

4

Times each format, at batch size 1 unless you set another. On images, each batch goes through preprocess, model and postprocess in turn, each stage timed on its own with the GPU synchronized; on random input only the forward pass is timed, over the measured iterations.

5

Writes the comparison report, records the fastest throughput on the badge, and stores the numbers on the model asset.

FAQ

The model has no ONNX or TensorRT export yet. Run an Export node on it first, then benchmark.

A serialized TensorRT engine only loads on the exact TensorRT version that built it, and every export node builds with its own version. The benchmark rebuilds the engine from the ONNX export instead, so a model with a TensorRT export but no ONNX export fails with a message asking for the ONNX one.

With an images dataset, yes except for reading and decoding the files, which happens once before timing. Preprocess is the resize or letterbox, scaling and layout of a decoded image into the model’s input tensor (float16 for FP16 ONNX files). Model is the host-to-device copy, the forward pass and the copy of the outputs back. Postprocess is the confidence filter, plus decode and NMS when the graph has no NMS inside. Preprocess and postprocess run on the CPU in this node, so they measure that path and not a GPU-side one. Without a dataset only the forward pass is timed, on random input.

NMS cost grows with the number of boxes that clear the threshold. At 0.001, the value accuracy evaluation uses, thousands of weak boxes reach NMS; at 0.25 far fewer do. The report shows the mean number of boxes over the threshold and left after NMS next to each format. A graph exported with NMS inside applied the threshold it was exported with, and a DETR-style model (DEIM, EdgeCrafter) has no NMS at all.

A graph with a single output of shape batch by 4+classes by anchors is read as a raw YOLO head (decode, then class-aware NMS). A single output of shape batch by boxes by 6 is read as NMS already done; when the export recorded an nms flag on the file, that flag decides. The LibreYOLO export also records how its graph is read, and the node follows it: boxes as corners rather than centre and size, the image letterboxed to the top-left corner rather than centred, every class over the threshold as a candidate, the rows output of a graph with NMS inside (which also returns the raw head), and for LibreYOLO9E2E no NMS at all, only the top-scoring anchors over the threshold. Outputs named labels, boxes and scores are read as a DETR-style head, and the image is fed together with its original size. Other output layouts are timed without a postprocess stage.

Not directly. Latency and throughput depend on the GPU, the driver, and the library versions, all of which the report records for exactly this reason. Compare formats within one report, and rerun on the target hardware before trusting a cross-machine comparison.

Only when an export has dynamic spatial dimensions and the shape cannot be read from the model. Otherwise the shape comes from each exported model, which keeps the comparison honest across formats.

From what the export node recorded when it built the file. When nothing was recorded, the runner reports the precision it detects from the model input and output types.

For YOLO models, on an images dataset, when the worker image has Ultralytics installed and the model has a PyTorch export (switch on the PyTorch format in the YOLO export node): that checkpoint is run through its own predict path in FP32 and its preprocess, inference and postprocess times are taken from the framework. For other frameworks, or without a dataset, there is no PyTorch row. With the instance’s safe-weights setting on, a PyTorch export is a pickle and is not opened, so there is no PyTorch row either; the ONNX and TensorRT rows still run. Speedups in the report are relative to the slowest benchmarked format.

An FP16 ONNX graph takes float16 input, so the image tensor is converted to half precision on the CPU. That conversion is part of what a deployment of that file pays, and the preprocess stage shows it.

GPU clocks, thermal state, and other load on the card all move the result. Raise Measured Iterations for a steadier mean, and keep the card otherwise idle while benchmarking.

Inputs

Model
modelRequired

Trained model to benchmark. Its ONNX and TensorRT exports are found automatically, so run an Export node on the model first. Key: MODEL.

Images
dataset

Dataset whose images the formats are timed on, end to end per image - preprocess, model and postprocess (decode and NMS where the graph has none inside) are reported separately, as p50, p95 and mean. NMS time depends on how many boxes clear the confidence threshold, which only real images reproduce. Leave empty to time the forward pass alone on random input, as earlier versions did. Key: IMAGES.

Number of images
integerDefaults to 100Required

How many images to take from the dataset, spread evenly over it. Each is downloaded and decoded once before timing starts, one timed pass runs over all of them. Ignored without an images dataset. Minimum: 1. Key: IMAGES_COUNT.

Batch size
integerDefaults to 1Required

Images per inference call. 1 measures single-image latency, the deployment case of a camera or an API, a larger batch measures throughput. Latency is reported per image either way. A model exported with a fixed batch is timed at that batch. Minimum: 1. Key: BATCH_SIZE.

Confidence threshold
numberDefaults to 0.001Required

Boxes scoring below this are dropped in postprocess, and for a raw YOLO head it decides how many boxes reach NMS. 0.001 is what accuracy evaluation uses (it makes NMS the most expensive), 0.25 is the Ultralytics predict default. A graph exported with NMS inside already applied the threshold it was exported with, so a lower value here has no effect on it. Ignored without an images dataset. Minimum: 0. Maximum: 1. Step: 0.001. Key: CONF_THRESHOLD.

NMS IoU
numberDefaults to 0.7Required

Overlap above which NMS suppresses a box, for a raw YOLO head. 0.7 is the Ultralytics default. DETR-style graphs (DEIM, EdgeCrafter) have no NMS and ignore it. Minimum: 0. Maximum: 1. Step: 0.01. Key: NMS_IOU.

Also run ONNX Runtime on CPU
booleanDefaults to falseRequired

Add a row for the ONNX export on the CPU provider, to see what a deployment without a GPU would get. The GPU formats are always measured. Key: ONNX_CPU.

Input size
integer

Square input size in pixels, needed only for models with dynamic input dimensions. Leave empty to take the size from each export, a dynamic export falls back to 640 on an images dataset and to 224 on random input. Minimum: 1. Key: INPUT_SIZE.

Warmup iterations
integerDefaults to 50Required

Number of warmup inferences (discarded) run before timing, to let the GPU reach steady state. Minimum: 0. Key: WARMUP_ITERS.

Measured iterations
integerDefaults to 500Required

Number of timed inferences used to compute mean / p95 latency and FPS. Minimum: 1. Key: MEASURE_ITERS.

Outputs

Report
report

Asset ID containing the runtime benchmark report. Shown as an artifact. Key: REPORT_ID.

FPS
string

Throughput of the fastest benchmarked format, shown as a badge on the node. Shown on the node as a badge. Key: FPS.

Models and configuration

Exports are found through the link an Export node writes back to the model it converted, so you never select an export by hand. One export per format is benchmarked: ONNX Runtime on the GPU (and on the CPU when Also run ONNX Runtime on CPU is ticked), TensorRT, and a PyTorch baseline for YOLO.

The input shape is read from each exported model, which keeps every format on the same input. Warmup iterations are discarded so the GPU reaches steady state before timing starts. On random input, Measured iterations are the timed passes behind the mean and p95 latency; on an images dataset, one pass over the Number of images is timed and Measured iterations is not used. Batch size defaults to 1 and a model exported with a fixed batch is timed at that batch.

When the run finishes, the latency (mean, p50, p95), throughput, batch size, precision, GPU model and driver of each format are recorded on the model version in the registry, next to the scores its training reported; on images the per-stage milliseconds and the mean box counts are added. That makes speed a property of the model you can compare on later, not just a number in one report. Re-benchmarking a format replaces its numbers: they describe the GPU and the settings of that run.

Report

The report is attached to the node as an artifact and opens in the preview widget.

Overview carries four cards: the model and the formats that were benchmarked, the auto-detected hardware, the benchmark settings, and a plain-language result naming the fastest format with its latency and throughput.

Pipeline stages (images dataset only) lists, for every format, the p50 and p95 of preprocess, model and postprocess in milliseconds per image, the end-to-end mean, the share of it spent in postprocess, and the mean number of boxes over the confidence threshold and left after NMS.

Runtime Comparison is the part to read first. A table lists every format with its precision, mean and p95 latency, throughput, and speedup relative to the slowest benchmarked format, followed by a throughput bar chart. A scope note below the chart states what was covered, and points out the missing format when only one export was available.

Methodology records the environment (torch, ONNX Runtime, TensorRT, CUDA, and driver versions, plus the measurement timestamp) and explains how timing was done. Keep it in mind when comparing two reports: different versions mean different numbers.

Runtime

The node runs in its own container on a GPU worker and drives ONNX Runtime through the CUDA execution provider. If that provider fails to load, the run stops rather than silently falling back to CPU; the CPU row is a separate, explicit option.

Building the TensorRT engine happens inside the run and dominates the total time for larger models, so a benchmark that includes TensorRT takes considerably longer than an ONNX-only one.

The image carries TensorRT, NVIDIA software under NVIDIA’s license.

JSON config

Machine-readable node interface for automation and advanced usage.

{
"name": "Benchmark runtime",
"description": "Measure the latency and throughput (FPS) of a model's exported formats (ONNX Runtime, TensorRT, and PyTorch for YOLO) on the current GPU and produce a comparison report. Give it an images dataset and every format is timed end to end per image, with preprocess, model and postprocess (decode and NMS) reported separately; without one it times the forward pass on random input. Provide the trained model and the node finds its exports automatically.",
"category": "Evaluate",
"namespace": "ovalbee",
"templateKey": "evaluate/benchmark_runtime",
"version": "v1",
"inputs": [
{
"key": "MODEL",
"label": "Model",
"type": "model",
"description": "Trained model to benchmark. Its ONNX and TensorRT exports are found automatically, so run an Export node on the model first.",
"required": true,
"default": null,
"visibleWhen": null,
"options": {
"scope": "my"
}
},
{
"key": "IMAGES",
"label": "Images",
"type": "dataset",
"description": "Dataset whose images the formats are timed on, end to end per image - preprocess, model and postprocess (decode and NMS where the graph has none inside) are reported separately, as p50, p95 and mean. NMS time depends on how many boxes clear the confidence threshold, which only real images reproduce. Leave empty to time the forward pass alone on random input, as earlier versions did.",
"required": false,
"default": null,
"visibleWhen": null,
"options": {
"creatable": false
}
},
{
"key": "IMAGES_COUNT",
"label": "Number of images",
"type": "number",
"description": "How many images to take from the dataset, spread evenly over it. Each is downloaded and decoded once before timing starts; one timed pass runs over all of them. Ignored without an images dataset.",
"required": true,
"default": 100,
"visibleWhen": null,
"options": {
"type": "integer",
"min": 1
}
},
{
"key": "BATCH_SIZE",
"label": "Batch size",
"type": "number",
"description": "Images per inference call. 1 measures single-image latency, the deployment case of a camera or an API; a larger batch measures throughput. Latency is reported per image either way. A model exported with a fixed batch is timed at that batch.",
"required": true,
"default": 1,
"visibleWhen": null,
"options": {
"type": "integer",
"min": 1
}
},
{
"key": "CONF_THRESHOLD",
"label": "Confidence threshold",
"type": "number",
"description": "Boxes scoring below this are dropped in postprocess, and for a raw YOLO head it decides how many boxes reach NMS. 0.001 is what accuracy evaluation uses (it makes NMS the most expensive); 0.25 is the Ultralytics predict default. A graph exported with NMS inside already applied the threshold it was exported with, so a lower value here has no effect on it. Ignored without an images dataset.",
"required": true,
"default": 0.001,
"visibleWhen": null,
"options": {
"type": "float",
"min": 0,
"max": 1,
"step": 0.001
}
},
{
"key": "NMS_IOU",
"label": "NMS IoU",
"type": "number",
"description": "Overlap above which NMS suppresses a box, for a raw YOLO head. 0.7 is the Ultralytics default. DETR-style graphs (DEIM, EdgeCrafter) have no NMS and ignore it.",
"required": true,
"default": 0.7,
"visibleWhen": null,
"options": {
"type": "float",
"min": 0,
"max": 1,
"step": 0.01
}
},
{
"key": "ONNX_CPU",
"label": "Also run ONNX Runtime on CPU",
"type": "boolean",
"description": "Add a row for the ONNX export on the CPU provider, to see what a deployment without a GPU would get. The GPU formats are always measured.",
"required": true,
"default": false,
"visibleWhen": null
},
{
"key": "INPUT_SIZE",
"label": "Input size",
"type": "number",
"description": "Square input size in pixels, needed only for models with dynamic input dimensions. Leave empty to take the size from each export; a dynamic export falls back to 640 on an images dataset and to 224 on random input.",
"required": false,
"default": null,
"visibleWhen": null,
"options": {
"type": "integer",
"min": 1
}
},
{
"key": "WARMUP_ITERS",
"label": "Warmup iterations",
"type": "number",
"description": "Number of warmup inferences (discarded) run before timing, to let the GPU reach steady state.",
"required": true,
"default": 50,
"visibleWhen": null,
"options": {
"type": "integer",
"min": 0
}
},
{
"key": "MEASURE_ITERS",
"label": "Measured iterations",
"type": "number",
"description": "Number of timed inferences used to compute mean / p95 latency and FPS.",
"required": true,
"default": 500,
"visibleWhen": null,
"options": {
"type": "integer",
"min": 1
}
}
],
"outputs": [
{
"key": "REPORT_ID",
"label": "Report",
"type": "report",
"description": "Asset ID containing the runtime benchmark report.",
"artifact": true,
"badge": false,
"badgeOpens": null,
"hidden": false
},
{
"key": "FPS",
"label": "FPS",
"type": "string",
"description": "Throughput of the fastest benchmarked format, shown as a badge on the node.",
"artifact": false,
"badge": true,
"badgeOpens": null,
"hidden": false
}
],
"runtime": {
"type": "docker",
"devices": [
"gpu"
],
"dockerImage": "ovalbee/node-runtime-benchmark:0.0.29"
},
"widgets": {
"widget": {
"id": "report-preview",
"settings": {
"reportAsset": {
"type": "variable",
"value": "self.outputs.REPORT_ID"
},
"name": {
"type": "input",
"value": "Open benchmark"
}
}
}
}
}

References