Co-Designing Transformer Architectures for Distributed Inference With Low Communication
- 25 December 2024
- journal article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Transactions on Parallel and Distributed Systems
- Vol. 36 (4) , 717-730
Abstract
Transformer models have shown significant success in a wide range of tasks. However, the massive resources required for its inference prevent deployment on a single device with relatively constrainted resources, thus leaving a high threshold of integrating their advancements. Observing scenarios such as smart home applications on edge devices and cloud deployment on commodity hardware, it is promising to distribute Transformer inference across multiple devices. Unfortunately, due to the tightly-coupled feature of Transformer model, existing model parallelism approaches necessitate frequent communication to resolve data dependencies, making them unacceptable for distributed inference, especially under relatively weak interconnection. In this paper, we propose DeTransformer, a communication-efficient distributed Transformer inference system. The key idea of DeTransformer involves the co-design of Transformer architecture to reduce the communication during distributed inference. In detail, DeTransformer is based on a novel block parallelism approach, which restructures the original Transformer layer with a single block to the decoupled layer with multiple sub-blocks. Thus, it can exploit model parallelism between sub-blocks. Next, DeTransformer contains an adaptive execution approach that strikes a trade-off among communication capability, computing power and memory budget over multiple devices. It incorporates a two-phase planning for execution, namely static planning and runtime planning. The static planning runs offline, containing a profiling procedure and a weight placement strategy before execution. The runtime planning dynamically determines the optimal parallel computing strategy from an expertly crafted search space based on real-time requests. Notably, this execution approach can adapt to heterogeneous devices by distributing workload based on devices’ computing capabilities. We conduct experiments for both auto-regressive and auto-encoder tasks of Transformer models. Experimental results show that DeTransformer can reduce distributed inference latency by up to 2.81× compared to the SOTA approach on 4 devices, while effectively maintaining task accuracy and a consistent model size.Keywords
Funding Information
- Major Program of Guangdong Basic and Applied Research (2019B030302002)
- National Natural Science Foundation of China (62461146204, 62332021, 62402534)
- Basic and Applied Basic Research Foundation of Guangdong Province (2023A1515110117)
- Pazhou Lab (PZL2023KF0001)
This publication has 26 references indexed in Scilit:
- System Optimizations for Enabling Training of Extreme Long Sequence Transformer Models2024
- Galaxy: A Resource-Efficient Collaborative Edge AI System for In-situ Transformer Inference2024
- Fine-Tuned Transformer Models for Question Answering2023
- Efficient Transformer Inference for Extremely Weak Edge Devices Using Masked Autoencoders2023
- DeepSpeed- Inference: Enabling Efficient Inference of Transformer Models at Unprecedented Scale2022
- TurboTransformers2021
- Model Parallelism Optimization for Distributed Inference via Decoupled CNN StructureIEEE Transactions on Parallel and Distributed Systems, 2020
- Deep compressive offloadingGetMobile: Mobile Computing and Communications, 2020
- DeepThings: Distributed Adaptive Deep Learning Inference on Resource-Constrained IoT Edge ClustersIEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 2018
- ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices2018