让不同边缘设备协作运行大模型,提速三倍还省电。
CoFormer: Collaborating with Heterogeneous Edge Devices for Scalable Transformer Inference
- 将大模型拆分到多设备协同推理,利用中间结果融合输出。
- 在边缘端实现GPT2-XL(16亿参数)推理,内存减少76.3%,提速3.1倍。
- 适合资源受限的智能边缘应用,尤其适合部署大尺寸Transformer模型。
Transformer模型的强大性能推动了智能应用在资源受限边缘设备上的部署。然而,由于模型计算量大、资源需求高,实现实时边缘服务仍面临挑战。现有方法要么将计算卸载到其他设备,导致通信开销大;要么在单个设备上部署压缩模型,难以平衡精度与效率。为此,我们提出一种通用Transformer模型的协同推理系统CoFormer。其核心思想是利用Transformer的可分割性与可整合性:将预训练的大模型分解为多个小模型,在分布式设备上并行推理,并聚合中间结果生成最终输出。我们构建优化问题,在异构硬件约束下最小化延迟与精度损失。提出DeBo算法求解分解策略,并逐步校准分解后的模型以恢复性能。实验表明,CoFormer可支持多种Transformer模型在异构边缘设备上运行,对大型模型实现最高3.1倍推理加速。尤其在边缘设备上高效运行含16亿参数的GPT2-XL,内存降低76.3%。同时,能耗减少约40%,且保持良好推理质量。
原文摘要 · Abstract (English)
The impressive performance of transformer models has sparked the deployment of intelligent applications on resource-constrained edge devices. However, ensuring high-quality service for real-time edge systems is a significant challenge due to the considerable computational demands and resource requirements of these models. Existing strategies typically either offload transformer computations to other devices or directly deploy compressed models on individual edge devices. These strategies, however, result in either considerable communication overhead or suboptimal trade-offs between accuracy and efficiency. To tackle these challenges, we propose a collaborative inference system for general transformer models, termed CoFormer. The central idea behind CoFormer is to exploit the divisibility and integrability of transformer. An off-the-shelf large transformer can be decomposed into multiple smaller models for distributed inference, and their intermediate results are aggregated to generate the final output. We formulate an optimization problem to minimize both inference latency and accuracy degradation under heterogeneous hardware constraints. DeBo algorithm is proposed to first solve the optimization problem to derive the decomposition policy, and then progressively calibrate decomposed models to restore performance. We demonstrate the capability to support a wide range of transformer models on heterogeneous edge devices, achieving up to 3.1$\times$ inference speedup with large transformer models. Notably, CoFormer enables the efficient inference of GPT2-XL with 1.6 billion parameters on edge devices, reducing memory requirements by 76.3\%. CoFormer can also reduce energy consumption by approximately 40\% while maintaining satisfactory inference performance.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。