Double PyTorch Inference Speed for Diffusion Models Using Torch-TensorRT

AI-generated summary of reporting by NVIDIA Developer Blog. Read the original for the full story.

Why it matters

PyTorch diffusion pipelines can now be compiled to TensorRT with one line and still switch LoRA adapters at runtime, without re-export or recompilation.

Read this as

NVIDIA's Torch-TensorRT tool speeds up image-generating AI models running in PyTorch, a popular programming framework. The new 'mutable' module compiles a model for the GPU automatically and updates itself when the model's weights change, so adding custom style tweaks (called LoRAs) works without re-doing the optimization. On the FLUX.1-dev image model it doubles generation speed. FP8 compression also lets the model fit on consumer GPUs like the RTX 5090.

Teams running diffusion-based image generation on NVIDIA GPUs can cut latency meaningfully without leaving PyTorch. NVIDIA reports FLUX.1-dev generating a batch of two images in 4.28 seconds versus 6.56 seconds natively on an HGX B200, and 2.72 seconds with FP8 quantization, a 2.4x speedup. Because runtime weight refitting removes the usual re-export bottleneck, product teams can offer per-user LoRA customizations without a separate optimization pipeline. The main constraint: this benefits NVIDIA GPU deployments, particularly Blackwell hardware.

MutableTorchTensorRTModule (MTTM) wraps a PyTorch module, capturing input patterns on first call and compiling the forward pass to a TensorRT engine, then refitting or recompiling when weights or graphs change, enabling LoRA switches via standard load_lora_weights without recompilation. Serialization supports a hybrid AOT/JIT shipping model. On FLUX.1-dev (12B-parameter rectified flow transformer), B200 latency drops from 164 ms to 107 ms per step in FP16 (1.5x) and 68 ms with FP8 via TensorRT Model Optimizer (2.4x vs FP16 PyTorch). The RTX 5090 runs FP8 at 260 ms/step. FP4 support is planned but not yet available.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

NVIDIA Torch-TensorRT FLUX.1-dev Hugging Face Diffusers TensorRT Model Optimizer GeForce RTX 5090 HGX B200

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading