Skip to main content
QUICK REVIEW

[Paper Review] TurboTransformers: An Efficient GPU Serving System For Transformer Models

Jiarui Fang, Yang Yu|arXiv (Cornell University)|Oct 9, 2020
Advanced Neural Network ApplicationsComputer Science20 references9 citations
TL;DR

TurboTransformers is a GPU-optimized serving system for transformer models that addresses high computational demands and variable-length input through a novel runtime and serving framework. It achieves state-of-the-art throughput—up to 4.06x higher than PyTorch—via a dynamic programming batch scheduler, a memory allocator tuned for variable sequences, and a parallel batch reduction kernel for Softmax and LayerNorm, while maintaining low memory footprint and supporting seamless PyTorch integration.

ABSTRACT

The transformer is the most critical algorithm innovation of the Nature Language Processing (NLP) field in recent years. Unlike the Recurrent Neural Network (RNN) models, Transformers can process on dimensions of sequence lengths in parallel, therefore leading to better accuracy on long sequences. However, efficient deployments of them for online services in data centers equipped with GPUs are not easy. First, more computation introduced by transformer structures makes it more challenging to meet the latency and throughput constraints of serving. Second, NLP tasks take in sentences of variable length. The variability of input dimensions brings a severe problem to efficient memory management and serving optimization. This paper designed a transformer serving system called TurboTransformers, which consists of a computing runtime and a serving framework to solve the above challenges. Three innovative features make it stand out from other similar works. An efficient parallel algorithm is proposed for GPU-based batch reduction operations, like Softmax and LayerNorm, major hot spots besides BLAS routines. A memory allocation algorithm, which better balances the memory footprint and allocation/free efficiency, is designed for variable-length input situations. A serving framework equipped with a new batch scheduler using dynamic programming achieves the optimal throughput on variable-length requests. The system can achieve the state-of-the-art transformer model serving performance on GPU platforms and can be seamlessly integrated into your PyTorch code with a few lines of code.

Motivation & Objective

  • To address the high computational cost and variable-length input challenges in deploying transformer models for online GPU inference.
  • To improve serving throughput and reduce latency in datacenter environments with diverse sequence lengths.
  • To design a runtime and serving framework that outperforms existing solutions like PyTorch, ONNX Runtime, and TensorRT in variable-length scenarios.
  • To enable efficient memory management without sacrificing allocation speed or increasing memory footprint.
  • To integrate seamlessly into PyTorch workflows with minimal code changes.

Proposed method

  • Proposes a parallel batch reduction algorithm for Softmax and LayerNorm operations, optimized for GPU memory hierarchy and thread-level parallelism.
  • Introduces a sequence-length-aware memory allocator that balances memory footprint and allocation efficiency across variable-length inputs.
  • Employs a dynamic programming-based batch scheduler that groups variable-length requests to minimize zero-padding and maximize GPU utilization.
  • Integrates with PyTorch via minimal code changes, allowing direct replacement of the PyTorch backend with TurboTransformers' optimized runtime.
  • Utilizes tensor core acceleration for mixed-precision inference, improving performance without accuracy loss.
  • Optimizes batching by avoiding fixed-length padding through intelligent request ordering and dynamic batch formation.

Experimental results

Research questions

  • RQ1How can Softmax and LayerNorm operations be efficiently parallelized on GPU to reduce latency in transformer inference?
  • RQ2What memory allocation strategy best balances memory footprint and allocation speed for variable-length transformer inputs?
  • RQ3Can a dynamic programming-based batch scheduler outperform naive batching in terms of throughput and latency for variable-length requests?
  • RQ4How does TurboTransformers compare to PyTorch, ONNX Runtime, and TensorRT in serving throughput and memory efficiency under variable-length workloads?
  • RQ5To what extent can tensor core optimization improve performance without compromising inference accuracy?

Key findings

  • TurboTransformers achieves a peak serving throughput of 402 requests per second on variable-length inputs (sequence length 2–100), a 4.06x improvement over PyTorch-Nobatch.
  • The dynamic programming batch scheduler reduces average latency to 7.49ms at 402 req/sec, outperforming naive batching in throughput despite slightly higher latency for long sequences.
  • With variable-length inputs (5–500 tokens), TurboTransformers achieves 144 requests per second using tensor core optimization, a 2.4x improvement over PyTorch-Nobatch.
  • The system maintains a smaller memory footprint than ONNX Runtime, even after serving long or large batches, avoiding memory bloat from unreleased intermediate tensors.
  • TurboTransformers' runtime matches or exceeds the performance of ONNX Runtime and TensorRT in fixed-length benchmarks while supporting variable-length inputs.
  • The memory allocator reduces memory waste by efficiently managing intermediate tensor allocations across diverse sequence lengths, improving overall system scalability.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.