[Paper Review] TRT-ViT: TensorRT-oriented Vision Transformer
TRT-ViT proposes a family of TensorRT-optimized Vision Transformers that achieve state-of-the-art latency-accuracy trade-offs by rethinking network design through direct hardware-aware latency measurement on TensorRT. By deriving four practical design guidelines—such as late-stage Transformers and early CNNs—it achieves up to 4.4× faster inference than SOTA models on segmentation and detection tasks while maintaining or improving accuracy.
We revisit the existing excellent Transformers from the perspective of practical application. Most of them are not even as efficient as the basic ResNets series and deviate from the realistic deployment scenario. It may be due to the current criterion to measure computation efficiency, such as FLOPs or parameters is one-sided, sub-optimal, and hardware-insensitive. Thus, this paper directly treats the TensorRT latency on the specific hardware as an efficiency metric, which provides more comprehensive feedback involving computational capacity, memory cost, and bandwidth. Based on a series of controlled experiments, this work derives four practical guidelines for TensorRT-oriented and deployment-friendly network design, e.g., early CNN and late Transformer at stage-level, early Transformer and late CNN at block-level. Accordingly, a family of TensortRT-oriented Transformers is presented, abbreviated as TRT-ViT. Extensive experiments demonstrate that TRT-ViT significantly outperforms existing ConvNets and vision Transformers with respect to the latency/accuracy trade-off across diverse visual tasks, e.g., image classification, object detection and semantic segmentation. For example, at 82.7% ImageNet-1k top-1 accuracy, TRT-ViT is 2.7$ imes$ faster than CSWin and 2.0$ imes$ faster than Twins. On the MS-COCO object detection task, TRT-ViT achieves comparable performance with Twins, while the inference speed is increased by 2.8$ imes$.
Motivation & Objective
- Address the growing gap between research-driven model efficiency metrics (e.g., FLOPs) and real-world deployment performance.
- Identify why state-of-the-art Transformers underperform in practice despite high accuracy, particularly due to hardware-inefficient computation patterns.
- Develop a practical, hardware-aware design framework for efficient vision models tailored to TensorRT inference on specific hardware.
- Bridge the performance gap between CNNs (efficient) and Transformers (accurate) by creating hybrid architectures that match or exceed both in latency-accuracy trade-off.
Proposed method
- Use actual inference latency on TensorRT with a T4 GPU (batch size=8) as the primary efficiency metric, replacing indirect metrics like FLOPs or parameters.
- Conduct controlled ablation studies across multiple vision tasks to derive four key design guidelines for efficient, deployment-friendly architecture.
- Design hybrid TRT-ViT blocks that serially combine CNN and Transformer components at the block level, decoupling heterogeneous operations to improve information flow and memory efficiency.
- Implement stage-level and block-level architectural patterns: late-stage Transformers, shallow-then-deep stages, and global-then-local block designs to balance performance and speed.
- Introduce the MixBlockC module with a learnable shrinking ratio to control computation and memory cost, enabling efficient trade-offs.
- Train and evaluate TRT-ViT across image classification (ImageNet-1k), object detection (MS-COCO), and semantic segmentation (ADE20K) under identical TensorRT deployment settings.
Experimental results
Research questions
- RQ1Why do state-of-the-art Transformers fail to deliver efficient inference in practice despite high accuracy, even when FLOPs are low?
- RQ2How can we design vision models that achieve both high accuracy and low inference latency on real hardware, particularly with TensorRT deployment?
- RQ3What architectural patterns—stage-level or block-level—best balance performance and efficiency when optimizing for actual hardware latency?
- RQ4Can hybrid CNN-Transformer architectures outperform pure Transformers or CNNs in the latency-accuracy trade-off under real deployment conditions?
Key findings
- At 82.7% ImageNet-1k top-1 accuracy, TRT-ViT is 2.7× faster than CSWin and 2.0× faster than Twins on a T4 GPU with batch size=8.
- On the MS-COCO object detection task, TRT-ViT-B matches Twins-SVT-S in AP (47.3 vs. 47.3) but runs 2.8× faster.
- On ADE20K semantic segmentation, TRT-ViT is 4.4× faster than Twins-SVT-S while achieving 45.46% mIoU, outperforming ResNet by 6.6% under similar latency.
- TRT-ViT-D achieves 48.1 AP on COCO detection with 2.7× faster inference than Twins-SVT-B, demonstrating strong efficiency gains on downstream tasks.
- The latency gap between classification and detection is significantly reduced: TRT-ViT maintains ResNet-like efficiency during transfer to detection, unlike Transformers like Twins-SVT-B, which see a 32× latency increase.
- The proposed MixBlockC with shrinking ratio R=0.5 reduces latency by 40% with only a minor drop in accuracy (80.8% → 81.2%), proving the effectiveness of controlled computation control.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.