In software, porting means adapting a program so it runs in a different context: a different CPU, operating system or library environment. In AI inference, deploying a model to a new target involves model conversion, operator compatibility handling, runtime integration and precision verification. TechnoLynx judges a port on cost per request and p95 latency measured before and after it. Cost or latency problems often need the serving path optimised rather than a new model, because the levers (runtime choice, kernel work, quantisation, serving configuration) sit below the model layer and are independently tunable. A port done blind can silently change accuracy, throughput or precision. That is why TechnoLynx treats porting as one named lever inside an inference cost audit, applied after profiling has named the bottleneck it is meant to fix.
Porting Meaning: From General Software to the Inference Stack
The classic definition calls software portable when it can run in a new context with no source changes, or when adapting it costs much less than rewriting it from scratch. How much effort a port takes depends on how far the new context is from the old one, the skill of the people doing it and how portable the codebase was to begin with. If you want the general software picture, our explainer on software porting and moving a workload to new hardware covers it; the rest of this page stays with inference.
A port is worth doing when getting the existing model to perform on the new target costs clearly less than replacing the model.
There is one distinction worth keeping sharp. Researchers working on LLM-agent adaptation of inference frameworks describe porting and optimisation as two phases of the same search: porting restores reachability, meaning every required operation has at least one executable route on the target, while optimisation then swaps expensive routes for cheaper ones. Put plainly, a port that runs has not yet reduced cost.
What Gets Ported: The Model Graph, the Runtime, the Kernels or the Hardware
Serving a model on a given machine is a co-adaptation problem across model, framework, kernel and hardware, according to the MetaInfer authors (2026).
| Layer being ported | What changes | How portable the result is |
|---|---|---|
| Model graph | Export to an intermediate representation such as ONNX, operator substitution, dynamic-shape fixes, graph repair | ONNX is device-agnostic at the format level, but that does not guarantee every operator runs on every device |
| Runtime | The engine that executes the graph: ONNX Runtime, TensorRT, OpenVINO, a vendor NPU runtime | Toolchains, operator support, quantisation schemes and APIs differ significantly between runtimes |
| Kernels | Compiler output: fused, autotuned, hardware-specific kernel invocations | A kernel configuration tuned for an A100 may perform poorly on an H100; cross-hardware transfer of tuned configurations is an open problem |
| Hardware target | A different GPU generation, a CPU, an NPU or an edge SoC | Device-specific formats such as TensorRT engines are bound to a hardware architecture and need recompiling for each target |
That last row catches people out. A TensorRT engine is a static file built offline for a fixed input shape and precision. ONNX Runtime’s TensorRT execution provider can build “hardware-compatible” engines that run across Ampere and newer GPUs, but its documentation warns they may have lower throughput or higher latency. For a fleet with mixed GPUs, plan for a build per target from the start.
Deployment also often involves far more than model export. On NPUs with fixed-shape compilation, the AIPC report (2026) found Whisper’s encoder could move to the NPU while the decoder fell back to CPU, because autoregressive decoding with dynamic sequence lengths clashed with the NPU’s compilation assumptions. The report’s preliminary exploration suggests restructuring the model (static reshaping, exposing the KV cache explicitly) could bring the decoder onto the NPU, which goes beyond swapping operators.
Which Porting Tools Move a Model Between ONNX Runtime and TensorRT?
A typical pipeline exports the PyTorch model to ONNX, then uses the target runtime’s conversion tool, such as trtexec for TensorRT, to build a deployable format. Each step needs a verifiable exit, checked against the original baseline.
- Establish a golden reference. Run the original PyTorch model on sample inputs and save the outputs, shapes and key intermediate results; every later conversion, repair or quantisation step is judged against this baseline.
- Export to ONNX.
torch.onnx.exportwithdynamo=Trueis the recommended and default export path in current PyTorch documentation. Setopset_versionto what the target runtime supports, and use theverifyoption to check the exported model against ONNX Runtime. - Convert to the target runtime.
trtexec, the command-line tool shipped with TensorRT, converts ONNX models to TensorRT engines and profiles them. Operators TensorRT does not support need plugin implementations. - Or run through an execution provider. ONNX Runtime can hand supported subgraphs to TensorRT and keep the rest elsewhere; its documentation recommends registering the CUDA execution provider alongside TensorRT so unsupported nodes have somewhere to go.
- Verify, then measure. Covered in the sections below.
Fallback deserves attention. ONNX Runtime partitions the graph and sends only supported subgraphs to TensorRT. That keeps the model running, but nodes TensorRT does not support run on another execution provider such as CUDA. Operator coverage differs between runtimes and so do the substitution strategies, and layout mismatches between PyTorch’s NCHW default and runtimes that prefer NHWC can cause conversion failures.
Engine caching exists to save TensorRT engine build time. A timing cache cutting engine build time from 108.62 s to 9.4 s for YOLOv4 and from 34.6 s to 7.7 s for EfficientNet-Lite4. Engine caching more broadly can reduce session creation “from minutes to seconds”. If your service scales out on demand, build and cache strategy belongs in the port plan, not as an afterthought.
A Runtime Port Can Win Big or Make Things Worse
The runtime alone can change performance dramatically. On an NVIDIA Jetson AGX Orin, the same ResNet-152 showed a 125× spread in latency across five inference frameworks, from 2.28 ms under TensorRT to 285.5 ms under ONNX Runtime, in a 2026 cross-stack survey. The authors read this as the gap between a framework doing aggressive graph fusion and hardware-specific kernel generation, and one running the ONNX graph with minimal optimisation on that particular hardware and software version. In the same comparison, top-1 accuracy was 76.6% under TensorRT and 72.0% under ONNX Runtime and JAX: a 4.6-point gap caused by differences in precision handling, graph transformation and accumulation order, not by the model. Latency comparisons between runtimes are incomplete unless accuracy is checked alongside them.
A 2026 study of BERT-base and GPT-2 on an RTX 3090 measured ONNX Runtime adding 1.2× over PyTorch on the GPU through hardware-agnostic graph optimisation, with TensorRT’s target-specific kernel autotuning adding a further 1.5×.
Ports have also reversed expected gains. A 2026 diffusion-model study on an NVIDIA T4 measured INT8 inference through ONNX Runtime showing a 147× INT8 slowdown, because TensorRT libraries were missing from the environment. Without them, the quantised graph contained 192 GPU-to-CPU copy nodes, each costing a PCIe round trip. The quantisation itself worked (the model shrank 3.8× on disk); the inference stack was the bottleneck. A separate 2026 machine-vision benchmark found TensorRT fastest on GPUs for the CNNs it tested, but for the transformer-based Grounding DINO, TensorRT was roughly 1.6 to 2.1 times slower than plain PyTorch on desktop GPUs. Its conclusion was that framework choice depends on both the hardware and the model family.
Measure on your own model and target before believing a published speedup. We go further into this pattern in when a port moves cost without moving the bottleneck.
How Do We Verify a Port Preserved Accuracy After Moving to New Hardware?
Compare the ported model’s outputs against the golden reference, using tolerances that suit the precision you ported to, and then confirm on a real task metric.
Post-port accuracy checklist
- Outputs from the converted model match expected shapes and data types, and the error against the PyTorch or ONNX baseline stays inside an agreed range.
- ONNX export parity is confirmed before compiling further; one 2026 study set an acceptance threshold of 10⁻⁴ maximum absolute error and measured below 6×10⁻⁶.
- Framework outputs are compared directly, for example
polygraphy run model.onnx --trt --onnxrtto run both and compare. - Tolerances are relaxed deliberately for reduced precision with
--atoland--rtol, because Polygraphy’s defaults suit FP32 and may not suit FP16 or INT8. - When outputs diverge, per-layer outputs are compared to find where the error enters, and layer outputs are checked for NaNs and Infs.
- Sensitive layers are pinned to higher precision where needed; TensorRT’s documentation notes, for example, that LayerNorm output should not be INT8.
- INT8 calibration uses representative data; TensorRT’s benchmarking guide warns that an engine calibrated on random data is a performance experiment, not a deployable result.
- Validation uses real inputs, not only random ones: the same transformer study found random inputs underestimated FP16 NaN instability by 6×.
- The target accelerator was actually used, checked independently of the logs; the multi-runtime porting study warns that a reported success does not prove the accelerator was activated.
The transformer study reports blanket FP16 at 0.9982 to 0.9987 cosine similarity against hybrid FP16 at 0.9998 or above, and the blanket version flipped 3 classification decisions on SST-2 while the hybrid version flipped none. In that test, small numeric drift was enough to cross decision boundaries. A task-level metric is the check that matters to users.
Measuring Whether the Port Actually Improved p95 Latency and Cost per Request
For before-and-after evidence on a port, the 2026 cross-stack survey proposes a minimum: latency as mean, p50, p95 and p99 over at least 1,000 iterations after warmup, platform power sustained over 60 seconds, energy per inference, compile time, and hardware and software metadata. By default trtexec warms up for at least 200 ms and runs at least 10 iterations or 3 seconds, whichever is longer, and those values can be raised with --warmUp, --iterations and --duration.
Be explicit about which latency you mean. The same survey distinguishes kernel time, model latency, request latency and service latency, and notes they can differ by an order of magnitude for the same model on the same hardware. trtexec excludes host-to-device and device-to-host transfers unless you add --includeDataTransfers. PCIe transfers can even become the performance bottleneck, so kernel-time gains need not reach request-level p95. Clock behaviour matters as well: NVIDIA notes that two runs of the same engine on the same GPU can disagree by tens of percent depending on clock locking and thermal throttling.
At a fixed hourly instance price, cost per request is that price divided by the requests served per hour at your latency target, so a port that doubles sustainable throughput on the same instance halves cost per request, and one that only improves offline peak throughput may change nothing. The survey separates offline throughput (fully saturated input) from online throughput under a realistic arrival process with latency limits, and treats them as fundamentally different quantities. It also found the TensorRT-LLM lead over another serving framework shrank from about 13% at 50 concurrent requests to about 12% at 100, with system-level dynamics dominating near saturation. Measure at the load you actually run. Our guide to setting a cost-per-request baseline covers the “before” half of this. For CPU targets, see reading throughput numbers when porting AI inference to CPU.
Faster Runtime or Different Hardware: Which Lever the Bottleneck Calls For
Profiling decides this, not habit. Context comes from profiling, not from best-practice lists. The method itself belongs to our page on profiling AI inference and reading the numbers; here is how its findings map onto a porting decision.
| What profiling shows | Lever that tends to fit | Why |
|---|---|---|
| Time dominated by memory-bound ops (softmax, LayerNorm, embeddings) | Runtime with stronger kernel fusion | In the transformer study these ops gained little from lower precision but substantially from TensorRT’s fusion, which cuts memory round trips |
| Time dominated by compute-bound GEMMs | Lower precision on hardware with native support | Compute-bound linear layers achieved the full 1.93× FP16 speedup on Tensor Cores |
| Small batches, rare or streaming requests | ONNX Runtime is a candidate | A 2022 framework benchmark found ONNX Runtime faster at small batch sizes |
| Heavy, high-throughput server load | TensorRT is a candidate | The same benchmark found TensorRT faster for throughput and large batches |
| Throughput plateaued on the current card | Different hardware | The transformer study read its BERT plateau at about 1,750 samples/s as needing larger GPUs or multi-GPU |
| Planned INT4/INT8 on a card without native datapaths | Hardware port, or drop the quantisation plan | Without native low-precision units the runtime upcasts to FP16 or FP32, and the throughput gain shrinks to memory-footprint savings |
The same study measured an A100 at 2.32× to 2.85× lower latency than an RTX 3090, in line with its higher memory bandwidth and Tensor Core count. The survey breaks down an NVIDIA-published A100-to-H100 comparison on Llama-2-13B: roughly 2× of the throughput gain came from the hardware generation, and the remaining 2 to 2.3× from FP8 support and in-flight batching in TensorRT-LLM. So even a “hardware” port is partly a runtime and precision port. When the profile shows a memory-bound workload, see our note on memory-bound versus compute-bound inference. TechnoLynx’s GPU performance engineering practice does kernel-level bottleneck work on the target hardware.
When Porting Is Cheaper than Replacing the Model
Porting is the cheaper fix when the profile places the bottleneck in the serving path (runtime, kernels, precision, hardware fit) rather than in what the model computes. Replacing the model is the most expensive lever, and it often leaves the workload economics unchanged. A model that performs well in training is a different artefact from one that performs on the deployment target, and closing that gap is engineering work, not a hand-off.
That does not make model replacement always unnecessary. If the model cannot meet its accuracy floor on any feasible target, or its memory footprint rules out every device you can afford, porting will not rescue it, and profiling is what tells you so. Port-decision work also needs a measurable trigger: a performance ceiling, a deployment-target constraint or a lock-in cost. The trade-off is worked through in when porting earns its engineering cost and when it does not.
Porting LLM Inference: Framework, Quantisation Format and Hardware Interact
LLM ports differ because the serving framework, the quantisation format and the hardware’s low-precision support have to agree with each other. The MetaInfer authors note that a model running in an upstream framework may fail in a manufacturer-maintained fork, and that a kernel supporting one tensor-parallel degree may not cover the shapes other parallel layouts produce. In their port of DeepSeek V4 Flash to a Hygon K100AI DCU (a non-CUDA stack), the optimised version cut time per output token from 112.70 ms to 42.57 ms at 128k context and single concurrency, measured against the first version that served correctly. The ported model was then checked on GPQA-Diamond and GSM8k. Correct serving came first, then the speed work.
Quantisation represents weights in 8-bit or 4-bit formats, lowering an LLM’s memory requirements. Google Cloud’s GKE guidance gives the example of GPTQ on Llama-2 13B and AWQ on Gemma 7B, each letting the model serve on one L4 GPU instead of two. The cross-stack survey makes a similar point for Llama-3.1-70B: INT4 cuts the weights from 140 GB to 35 GB, fitting a single GPU and removing tensor-parallel communication, and that saving can exceed the gain from quantisation itself. The format and the serving engine have to fit together: the QServe work cited in the survey reports existing INT4 methods losing 20 to 90% to dequantisation overhead on CUDA cores.
On accuracy, a large 2024 study across the Llama-3.1 family found FP8 effectively lossless, well-tuned INT8 at 1 to 3% degradation, and INT4 weight-only more competitive than expected. Which format to choose for which serving setup belongs to performance tuning for inference, and the economics of that choice are argued in LynxBenchAI’s piece on precision as an economic lever in inference. For a port, the practical point is narrower: confirm that the target hardware and framework actually run the format natively before counting the gain.
Who Can Port Our Inference Stack to a Cheaper Runtime or GPU?
TechnoLynx ports production inference paths to the runtime, kernels or hardware that the profile says will lower cost per request and p95, and verifies that accuracy held before reporting a gain. The work starts with an inference cost audit that profiles the current serving path and names the bottleneck, so the port is scoped against a measured trigger rather than a guess. On choosing a partner, ask for before-and-after p95, cost per request and a task-level accuracy check on your own workload. TechnoLynx’s Inference Cost Cut Pack, the audit and the optimisation sprint that follows, is described on the services page.
This is not the right engagement for every team. The engagement fits best where a port can be scoped against a performance ceiling, a deployment-target constraint or a lock-in cost.
FAQ
What Is an AI Port?
An AI port is a trained model adapted to run on a different runtime, compiled kernel set or hardware target, for example PyTorch to ONNX to a TensorRT engine. Its converted outputs are then checked against the PyTorch or ONNX baseline.
How Long Does a Port Take?
It depends on the model’s structure. In a 2026 study of agent-assisted porting with structured deployment knowledge injected, successful deployments of structurally regular vision models averaged about 19.5 minutes; for more complex models, general knowledge alone was not enough for reliable automated handling.