TensorRT: making trained models fast
How NVIDIA's inference optimiser turns a trained model into a lean engine for a specific GPU, and the four products that share the TensorRT name.
- Describe the NVIDIA software stack used in an AI environment.
- Explain the purpose and use case of various NVIDIA solutions.
- Compare and contrast training and inference architecture requirements and considerations.
TensorRT is NVIDIA's answer to a simple problem: the model that comes out of training is written for flexibility, not speed. TensorRT takes that trained model, studies it together with the exact GPU it will run on, and produces an engine: a version of the model rewritten to run as fast and as small as possible on that hardware. It is built on CUDA and used only for inference.
01The optimisations, in plain words
- Quantisation (reduced precision). Training usually uses 16- or 32-bit numbers. TensorRT can run the model in FP8, INT8, FP4 or INT4, with a calibration step that keeps accuracy acceptable. Fewer bits mean less memory, less bandwidth and more operations per second on Tensor Cores.
- Layer and tensor fusion. A network is a chain of small operations (convolution, add bias, activation). Each one reads and writes GPU memory. Fusing them into a single kernel removes those round trips, and memory traffic is often the real bottleneck.
- Kernel auto-tuning. For each layer there are many possible GPU implementations. TensorRT benchmarks them on the target GPU and picks the fastest. That is why an engine is tied to a GPU type and TensorRT version.
- Memory planning. It reuses memory between layers so the model needs less of it at run time.
02One name, four products
The TensorRT page now describes a family of inference SDKs. Know which is which:
| Product | Use it for |
|---|---|
| TensorRT | Classic (non-generative) models such as vision and speech, in a C++ or Python production stack |
| TensorRT-LLM | Large language models and generative AI in the data center or cloud; open source, Python-friendly |
| TensorRT Edge-LLM | Generative AI on embedded GPUs at the edge |
| TensorRT for RTX | AI features inside Windows applications on RTX PCs; small library and fast engine builds |
Next to them sits the NVIDIA Model Optimizer, a library for quantisation (both post-training and quantisation-aware training), pruning, sparsity, distillation and speculative decoding. It prepares models for TensorRT-LLM, TensorRT and also open engines like vLLM and SGLang.
03How models get into TensorRT
- ONNX: export from almost any framework to the open ONNX format, then the TensorRT ONNX parser imports it. The most common path.
- Torch-TensorRT: compile PyTorch models directly.
- Hugging Face integrations for popular LLMs via TensorRT-LLM.
# typical command-line build of an engine from ONNX (illustrative)
trtexec --onnx=model.onnx --saveEngine=model.plan --fp16
04Where the engine runs
TensorRT does not serve requests by itself in production. The engine is loaded by a serving layer: Triton Inference Server (TensorRT is one of its backends), NVIDIA Dynamo for distributed serving, or packaged inside a NIM microservice. NVIDIA's page quotes large speed-ups versus CPU-only inference and versus unoptimised GPU runs; treat the exact multipliers as vendor claims, but expect the exam to know that TensorRT significantly cuts latency and raises throughput.
✦Key terms: flip the cards
- TensorRT is an inference optimiser and runtime, not a training tool.
- Optimisations: precision calibration/quantisation, layer fusion, kernel auto-tuning.
- Engines are served through Triton, Dynamo or NIM.
- An engine built for one GPU type is not automatically optimal (or valid) on another.
- TensorRT-LLM is for LLMs; plain TensorRT for non-generative models.
?Quick quiz
1. What is TensorRT's primary role?
Why: TensorRT optimises and runs trained models for inference.
2. Which optimisation reduces memory traffic by merging operations?
Why: Fusion combines operations into a single kernel.
3. A team exports a PyTorch model to a framework-neutral file for TensorRT. Which format?
Why: ONNX is the common import path via the TensorRT parser.
4. Which product targets LLM inference specifically?
Why: TensorRT-LLM is the LLM-focused member of the family.
Score: 0 / 4
This lesson explains the reading in plain language and adds the exam context around it. Read the original too: it is short, and seeing the vendor wording helps on exam day.