TensorRT-LLM is an open-source NVIDIA library for optimizing large language model inference on NVIDIA GPUs. Among AI frameworks & tools, it sits at the serving end of the stack: it takes a trained model, typically from Hugging Face Transformers or a PyTorch checkpoint, and runs it with specialized attention kernels, quantization, batching and multi-GPU parallelism so that each GPU produces more tokens per second at a lower cost per request.
The library is published under the Apache 2.0 license and exposes a Python LLM API, a command-line server and a backend for Triton Inference Server. In the broader field of Artificial intelligence, it belongs to the group of inference engines that also includes vLLM, SGLang and Text Generation Inference, with the distinction that it is tuned specifically for NVIDIA hardware.
How TensorRT-LLM accelerates inference
TensorRT-LLM speeds up inference by replacing generic model operations with fused, hardware-specific GPU kernels and by scheduling many requests together. Early releases compiled each model into a TensorRT engine, a serialized and optimized execution plan built ahead of time for one GPU type. Since version 1.0, the PyTorch-based backend is the default, which keeps model code readable while still calling the optimized kernels underneath.
Text generation has two phases with very different behavior. The prefill phase processes the whole prompt in parallel and is limited by compute, while the decode phase generates one token at a time and is limited by memory bandwidth, because the model weights and the key-value cache must be read for every token. Most optimizations in the library target one of these two bottlenecks.
The table below lists the core runtime components and the bottleneck each one addresses.
| Component | What it does | Main benefit |
|---|---|---|
| In-flight batching | Adds and removes requests from a running batch at every step | Keeps the GPU busy, raises throughput |
| Paged KV cache | Stores attention keys and values in fixed-size memory blocks | Reduces fragmentation, fits more sequences |
| KV cache reuse | Shares cached blocks for identical prompt prefixes | Faster time to first token |
| Chunked prefill | Splits long prompts into smaller pieces | Smoother latency for concurrent users |
| Fused attention kernels | Combines attention steps into single GPU calls | Fewer memory round trips |
| Speculative decoding | Proposes several tokens and verifies them in one pass | Lower latency per output token |
Quantization and precision options
Quantization is the largest single lever for TensorRT-LLM performance, because the decode phase is bound by how many bytes must be moved per token. Storing weights in 8-bit or 4-bit formats cuts memory traffic and lets a model fit on fewer GPUs. The trade-off is a possible loss of accuracy, which must be measured on the target task rather than assumed.
Supported formats depend on the GPU generation. The following table summarizes the common choices.
| Format | Typical hardware | Memory saving vs FP16 | Accuracy risk |
|---|---|---|---|
| FP16 / BF16 | Most data center GPUs | None (baseline) | None |
| FP8 | Hopper and Ada Lovelace or newer | About 2x | Low with calibration |
| INT8 SmoothQuant | Ampere or newer | About 2x | Low to moderate |
| INT4 AWQ / GPTQ | Ampere or newer | About 3-4x for weights | Moderate, task dependent |
| NVFP4 | Blackwell | About 3-4x | Low to moderate with calibration |
Quantized checkpoints are usually produced with the NVIDIA Model Optimizer toolkit, which runs a short calibration pass on representative data. The KV cache can be quantized separately, which matters for long contexts where the cache, not the weights, dominates memory use.
Scaling across GPUs and nodes
TensorRT-LLM distributes models that are too large for one GPU through several forms of model parallelism, using NCCL for communication between devices. The right combination depends on model size, interconnect speed and whether the model uses a mixture-of-experts architecture.
- Tensor parallelism splits each layer’s matrices across GPUs and needs a fast interconnect such as NVLink.
- Pipeline parallelism places consecutive layers on different GPUs and tolerates slower links but adds pipeline bubbles.
- Expert parallelism spreads the experts of a mixture-of-experts model across devices.
- Disaggregated serving runs prefill and decode on separate GPU pools so that each phase can be sized independently.
Disaggregated serving is often orchestrated by NVIDIA Dynamo, which routes requests and transfers KV cache between pools, while TensorRT-LLM performs the actual computation.
How it compares with related inference tools
TensorRT-LLM is one of several engines for serving language models, and the choice usually depends on hardware, operational simplicity and model coverage rather than raw speed alone. The comparison below covers the neighbors most often evaluated alongside it.
| Tool | Primary role | Hardware focus | Relation to TensorRT-LLM |
|---|---|---|---|
| TensorRT | General deep learning inference optimizer | NVIDIA GPUs | Foundation that TensorRT-LLM extends for language models |
| vLLM | General LLM serving engine | NVIDIA, AMD and others | Direct alternative, broader hardware support |
| SGLang | LLM serving with structured generation | NVIDIA and AMD | Direct alternative, strong prefix caching |
| Triton Inference Server | Multi-framework model server | CPU and GPU | Hosts TensorRT-LLM through a dedicated backend |
| llama.cpp | Lightweight local inference | CPU, consumer GPUs | Targets laptops and edge, not data centers |
In practice, TensorRT-LLM often leads on peak throughput on recent NVIDIA GPUs, especially with FP8 or NVFP4, while alternatives may be faster to adopt for new model architectures. Published benchmarks vary widely with model, batch size and configuration, so teams should benchmark their own workload before committing.
Deploying TensorRT-LLM in practice
A typical deployment starts with the LLM API in Python, which loads a Hugging Face model by name or path and applies the chosen quantization and parallelism settings. For production, the trtllm-serve command exposes an OpenAI-compatible HTTP endpoint, and containers published through the NVIDIA NGC catalog provide a tested environment with matching CUDA and driver versions.
The following decision table maps common situations to a sensible starting configuration.
| Situation | Recommended setting | Reason |
|---|---|---|
| Chat service with many users | In-flight batching with FP8 | Maximizes throughput per GPU |
| Strict latency target | Speculative decoding, small batch | Reduces time per output token |
| Shared system prompt | Enable KV cache reuse | Skips repeated prefill work |
| Model larger than one GPU | Tensor parallelism over NVLink | Keeps communication fast |
| Long documents as input | Chunked prefill, quantized KV cache | Controls memory and latency spikes |
Limitations and common mistakes
The main limitation of TensorRT-LLM is vendor lock-in to NVIDIA GPUs: it does not run on AMD, Intel or Apple hardware. Support for a newly released model architecture can lag behind more general engines, and version mismatches between the library, CUDA and drivers are a frequent source of build and runtime errors.
| Symptom | Likely cause | Fix |
|---|---|---|
| Out-of-memory errors at load | KV cache fraction set too high | Lower the cache memory fraction |
| Accuracy drop after quantization | Poor calibration data | Calibrate on task-like samples |
| Low throughput despite large GPU | Batch size or token limit too small | Raise maximum batch and token limits |
| Engine fails on another GPU model | Engine built for different hardware | Rebuild on the target GPU type |
The idea in brief
A language model is like a huge recipe book. Every word it writes requires reading a large part of that book. TensorRT-LLM makes the reading much faster on NVIDIA graphics cards.
It does this in a few simple ways. It stores numbers in smaller, compact formats. It serves many users at the same time instead of one by one. It also splits very large models across several cards. The result is faster answers at a lower cost. The catch is that it only works on NVIDIA hardware.
A practical scenario
An insurance company runs an internal assistant that summarizes claim files for about 400 employees. The first version served an open-weight model with 70 billion parameters in BF16 precision on four GPUs, and responses slowed noticeably during morning peaks when more than 60 people sent requests at once.
The platform team moved the model to TensorRT-LLM with FP8 weights and an FP8 KV cache, enabled in-flight batching and turned on KV cache reuse for the long shared system prompt. After validating summary quality on 500 archived claims, they found no meaningful difference from the original output.
The new setup handled the same peak traffic on two GPUs instead of four, and the median time to first token dropped noticeably. The freed GPUs were reassigned to a document search project, which made lower hardware cost the main outcome of the migration.