An LLM (large language model) inference optimization library developed by NVIDIA. Delivers top inference speed on GPUs and supports advanced techniques such as In-flight Batching, KV cache optimization, and FP8/INT8 quantization.
TensorRT-LLM is a library that specializes NVIDIA's TensorRT deep learning inference engine for large language models. In addition to the graph optimization, kernel auto-tuning, and precision calibration features of the existing TensorRT, it provides features optimized for the autoregressive generation pattern specific to LLMs. As of 2025, it is one of the solutions that provide the fastest LLM inference performance.
The core feature, In-flight Batching (continuous batching), dynamically batches requests of different lengths. Conventional static batching had to wait for the longest sequence to complete, but In-flight Batching immediately returns completed requests and inserts new ones. This improves throughput by up to 4-8x. Paged KV Cache manages GPU memory in page units, enabling more concurrent requests to be handled.
TensorRT-LLM supports various precisions such as FP16, BF16, INT8, INT4, and FP8. In particular, using the FP8 Tensor Core of the H100 GPU can deliver nearly 2x the throughput compared to FP16. It is compatible with various quantization techniques such as GPTQ, AWQ, and SmoothQuant, so inference speed can be maximized while minimizing quality loss.
Supported models include major open-source LLMs such as LLaMA, Mistral, GPT-J, Falcon, Gemma, and Qwen. By integrating with Triton Inference Server, model ensembles, A/B testing, and dynamic batching can be easily implemented in production environments. It also supports Multi-Instance GPU (MIG) and multi-node Tensor Parallelism, enabling distributed inference of large models.
π» Code Example
This is an example of LLaMA model inference using TensorRT-LLM.
β Throughput improvement due to the In-flight Batching (continuous batching) feature
"Running FP8 on the H100 gives over 4x the token processing speed compared to the A100"
β Explanation of the performance improvement using the H100's FP8 Tensor Core
β οΈ Common Mistakes & Cautions
Underestimating engine build time
Building a TensorRT-LLM engine takes from tens of minutes to several hours depending on model size. Be sure to include build time in your production deployment schedule.
Setting max_batch_size too high
Setting max_batch_size too large when building the engine causes GPU out-of-memory errors. Set it to fit your actual workload.
GPU architecture compatibility
A built engine is tied to a specific GPU architecture. An engine built for the A100 does not work on the H100. A separate build is required for each GPU type.
Missing quantization quality validation
INT8/INT4 quantization increases speed but may degrade quality. Be sure to validate quality with a benchmark dataset.