[논문 리뷰] TurboTransformers: An Efficient GPU Serving System For Transformer Models
TurboTransformers는 변형 모델을 위한 GPU 최적화된 서빙 시스템으로, 높은 계산 요구량과 가변 길이 입력을 해결하기 위해 새로운 런타임 및 서빙 프레임워크를 제공한다. 동적 프로그래밍 기반 배치 스케줄러, 가변 시퀀스에 최적화된 메모리 할당기, Softmax 및 LayerNorm를 위한 병렬 배치 감소 커널을 통해 PyTorch 대비 최대 4.06배 높은 처리량을 달성하면서도 낮은 메모리 점유율을 유지하고, PyTorch 통합이 원활하다.
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.
연구 동기 및 목표
- 온라인 GPU 추론을 위한 변형 모델 배포 시 높은 계산 비용과 가변 길이 입력 문제를 해결하기 위해.
- 다양한 시퀀스 길이를 가진 데이터센터 환경에서 서빙 처리량을 향상시키고 지연 시간을 감소시키기 위해.
- 기존 솔루션인 PyTorch, ONNX Runtime, TensorRT보다 가변 길이 시나리오에서 뛰어난 성능을 보이는 런타임 및 서빙 프레임워크를 설계하기 위해.
- 할당 속도를 저하시키지 않으면서도 메모리 점유율을 증가시키지 않고 효율적인 메모리 관리를 가능하게 하기 위해.
- 최소한의 코드 변경으로 PyTorch 워크플로우에 원활하게 통합될 수 있도록 하기 위해.
제안 방법
- GPU 메모리 계층과 스레드 수준 병렬 처리를 고려해 최적화된 병렬 배치 감소 알고리즘을 제안하여 Softmax 및 LayerNorm 연산을 효율적으로 병렬화한다.
- 가변 길이 입력에 적합한 시퀀스 길이 인식 메모리 할당기를 도입하여 메모리 점유율과 할당 효율성을 균형 있게 유지한다.
- 가변 길이 요청을 최소한의 패딩으로 그룹화하고 GPU 활용도를 극대화하기 위해 동적 프로그래밍 기반의 배치 스케줄러를 구현한다.
- 최소한의 코드 변경을 통해 PyTorch와 통합하여, PyTorch 백엔드를 TurboTransformers의 최적화된 런타임으로 직접 교체할 수 있도록 한다.
- 혼합 정밀도 추론을 위한 텐서 코어 가속을 활용하여 정확도 손실 없이 성능을 향상시킨다.
- 지능적인 요청 순서 정렬과 동적 배치 형성으로 고정 길이 패딩을 피함으로써 배치 최적화를 실현한다.
실험 결과
연구 질문
- RQ1어떻게 GPU에서 Softmax 및 LayerNorm 연산을 효율적으로 병렬화하여 변형 모델 추론의 지연 시간을 줄일 수 있는가?
- RQ2가변 길이 변형 모델 입력에 대해 메모리 점유율과 할당 속도를 가장 잘 균형 잡는 메모리 할당 전략은 무엇인가?
- RQ3동적 프로그래밍 기반의 배치 스케줄러는 가변 길이 요청에 대해 단순 배치 처리 방식보다 처리량과 지연 시간 측면에서 뛰어난 성능을 보일 수 있는가?
- RQ4가변 길이 워크로드 하에서 TurboTransformers는 PyTorch, ONNX Runtime, TensorRT에 비해 서빙 처리량과 메모리 효율성 측면에서 어떻게 비교되는가?
- RQ5텐서 코어 최적화를 통해 성능 향상을 얼마나 달성할 수 있으며, 이는 추론 정확도에 영향을 주지 않는가?
주요 결과
- TurboTransformers는 가변 길이 입력(시퀀스 길이 2–100)에서 최고 402 요청/초의 서빙 처리량을 기록하여 PyTorch-Nobatch 대비 4.06배 높은 성능을 달성한다.
- 동적 프로그래밍 기반 배치 스케줄러는 402 요청/초에서 평균 지연 시간을 7.49ms로 줄였으며, 긴 시퀀스에 대해 약간 높은 지연 시간을 보일지라도 처리량 측면에서 단순 배치 처리 방식을 뛰어넘는다.
- 5–500 토큰의 가변 길이 입력에서 TurboTransformers는 텐서 코어 최적화를 통해 144 요청/초를 달성하여 PyTorch-Nobatch 대비 2.4배 높은 성능을 기록한다.
- 긴 시퀀스나 큰 배치를 처리한 후에도 ONNX Runtime보다 더 낮은 메모리 점유율을 유지하며, 중간 텐서를 해제하지 않은 채로 메모리 팽창을 방지한다.
- 고정 길이 벤치마크에서 TurboTransformers의 런타임은 ONNX Runtime 및 TensorRT의 성능을 따라하거나 초월하며, 가변 길이 입력을 지원한다는 점에서 우수한 성능을 발휘한다.
- 다양한 시퀀스 길이에 걸쳐 중간 텐서 할당을 효율적으로 관리함으로써 메모리 낭비를 줄이고 전체 시스템의 확장성을 향상시킨다.
더 나은 연구,지금 바로 시작하세요
논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.
카드 등록 없음 · 무료 플랜 제공
이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.