blog.dopana

Back

TensorRT-LLM (TRT-LLM) is NVIDIA’s open-source inference library for Large Language Models and Visual Gen models on NVIDIA GPUs. It delivers state-of-the-art optimizations — custom kernels for attention/GEMM/MoE, plus algorithmic runtime tricks like prefill-decode disaggregation and speculative decoding — behind an easy Python API. Apache 2.0, ~14.3k GitHub stars, fully open-sourced on GitHub since March 2024. Current line: release 1.3 (Python 3.10–3.12, CUDA 13.2, PyTorch 2.11).

What Problem Does It Solve?#

LLM inference is bound by memory bandwidth (weights + KV cache) and compute. Generic frameworks leave most of it on the table:

BottleneckNaive approachTensorRT-LLM
AttentionGeneric kernelsFlashAttention-style fused, XQA kernel (2.4x Llama-70B)
QuantizationFP16 onlyFP8, FP4, INT8, INT4 (AWQ)
BatchingStaticIn-flight / continuous batching, paged KV cache
DecodingGreedy onlySpeculative decoding, MTP
MoEDense fallbackWide Expert Parallelism

Architecture#

Built on PyTorch, not a C++ black box:

  • High-level Python LLM API — define models, build engines, run generation in a few lines
  • Custom kernels for attention, GEMMs, MoE
  • Python + C++ runtimes orchestrate execution
  • Modular — models written in native PyTorch, easy to extend
  • Scales from single GPU to multi-GPU / multi-node (TP, PP, CP, EP)

Integrates with the wider ecosystem: NVIDIA Dynamo (datacenter-scale distributed serving) and the Triton Inference Server.

Key Optimizations#

OptimizationEffect
Custom fused kernelsAttention, GEMMs, MoE routing
Paged KV cache + prefix reuseLess memory waste, shared system prompts
In-flight batchingHigher GPU utilization
FP8 / FP4 quantizationDeepSeek-R1-FP4, ~2x memory savings
Speculative decoding (EAGLE-style, N-gram, MTP)Llama 3.3 70B: 3x throughput
Prefill/Decode disaggregationIndependent scaling of both phases
Wide Expert Parallelism (EP)Scales MoE across many GPUs
Multiblock attention3x+ long-sequence throughput (H200)
MultiShot / NVSwitch3x faster AllReduce
CUDA Graph batchingLower kernel-launch overhead
LoRAMulti-adapter serving

Performance Numbers#

  • Llama 4 — >40,000 tokens/s on B200 GPUs
  • 1,000 tokens/s/user with Llama 4 Maverick on Blackwell

  • H200 — ~12,000 tok/s on Llama 2 13B
  • DeepSeek-R1: world-record inference on Blackwell (FP4)
  • XQA kernel: 2.4x Llama-70B throughput within the same latency budget
  • Falcon-180B INT4 AWQ on a single H200

Visual Generation#

Since April 2025 TRT-LLM also covers Visual Gen — diffusion models for image and video. NVIDIA has scaled video generation across an NVL72 rack (72 GPUs) with TRT-LLM.

Serving & Deployment#

trtllm-serve llama-3.1-8b-instruct-fp8 # OpenAI-compatible server
bash
trtllm-bench latency --model <model-dir> # benchmark engine
bash
  • Triton Inference Server backend for production serving
  • Works with NVIDIA Dynamo and NIM
  • Day-0 support for new open-weights models (GPT-OSS, EXAONE 4.0, DeepSeek)

Getting Started#

from tensorrt_llm import LLM, SamplingParams

llm = LLM(model="nvidia/Llama-3.1-8B-Instruct-FP8")

params = SamplingParams(max_tokens=128, temperature=0.8)
outputs = llm.generate(["Tell me about TensorRT-LLM."], params)

for out in outputs:
    print(out.outputs[0].text)
python
pip install tensorrt-llm
# or pull the NGC container with prebuilt wheels
bash

TRT-LLM vs vLLM#

DimensionTRT-LLMvLLM
Peak throughput2-3x higherBaseline
Cold start~28 min engine compile~60s
HardwareNVIDIA CUDA onlyMulti-platform (ROCm, XPU, TPU, CPU)
OpenAI APIVia Triton backendNative
QuantizationFP4/FP8/INT4FP8/FP4/INT4
PagedAttentionPartialNative

2026 consensus: vLLM for general serving and portability; TRT-LLM when you want absolute peak performance on NVIDIA hardware and can pay the compile time.

Caveats#

  • NVIDIA GPUs only
  • Engine compile is slow (minutes), and engines are GPU-architecture-specific
  • Telemetry is on by default — opt out via TRTLLM_NO_USAGE_STATS=1 or --no-telemetry
  • 3-month deprecation policy for APIs

Conclusion#

TRT-LLM is NVIDIA’s path to the fastest LLM and Visual Gen inference. The numbers speak: >40k tokens/s on B200. The cost: CUDA lock-in plus engine compile time. Pick it when peak performance on NVIDIA hardware matters more than portability.

References#