arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2210.14793cs.CV
收藏

M $^3$ ViT:混合专家模型视觉Transformer,用于模型加速器协同设计的高效多任务学习

M$^3$ViT: Mixture-of-Experts Vision Transformer for Efficient Multi-task Learning with Model-Accelerator Co-design

University of Texas at Austin(德克萨斯大学奥斯汀分校);Georgia Institute of Technology(佐治亚理工学院);Texas A&M University(德克萨斯农工大学);Protagolabs Inc(Protagolabs公司);Microsoft Research(微软研究院)

Hanxue Liang, Zhiwen Fan, Rishov Sarkar, Ziyu Jiang, Tianlong Chen, Kai Zou, Yu Cheng, Cong Hao, Zhangyang Wang

摘要:

多任务学习(MTL)将多个学习到的任务封装在一个模型中,通常让这些任务更好地联合学习。然而,当将MTL部署到那些通常资源受限或延迟敏感的现实世界系统时,出现了两个突出的挑战:(i)在训练期间,由于任务之间的梯度冲突,同时优化所有任务通常是困难的;(ii)在推理时,当前的MTL机制必须激活几乎整个模型,甚至只是执行单个任务。然而,大多数真实系统在每个时刻只需要一个或两个任务,并根据需要在任务之间切换:因此,这种所有任务激活的推理也是非常低效和不可扩展的。在本文中,我们提出了一个模型加速器协同设计框架,使有效的设备上MTL。我们的框架被称为M $^3$ ViT,将混合专家模型(MoE)层定制为MTL的视觉Transformer(ViT)骨干,并在训练期间稀疏地激活特定于任务的专家。然后,在对任何感兴趣的任务进行推理时,相同的设计允许仅激活任务对应的稀疏专家路径,而不是完整的模型。我们的新模型设计进一步增强了硬件级的创新,特别是,一种新的计算重排序方案量身定制的内存受限的MTL,实现零开销任务之间的切换,并可以扩展到任何数量的专家。当执行单任务推理时,M $^{3}$ ViT比以编码器为中心的MTL方法实现了更高的准确性,同时显著降低了88%的推理FLOPs。当在一个Xilinx ZCU 104 FPGA的硬件平台上实现时,我们的协同设计框架将内存需求降低了2.4倍,同时实现了比可比FPGA基准高9.23倍的能效。代码可从以下网址获得:https://github.com/VITA-Group/M3ViT。

英文摘要:

Multi-task learning (MTL) encapsulates multiple learned tasks in a single model and often lets those tasks learn better jointly. However, when deploying MTL onto those real-world systems that are often resource-constrained or latency-sensitive, two prominent challenges arise: (i) during training, simultaneously optimizing all tasks is often difficult due to gradient conflicts across tasks; (ii) at inference, current MTL regimes have to activate nearly the entire model even to just execute a single task. Yet most real systems demand only one or two tasks at each moment, and switch between tasks as needed: therefore such all tasks activated inference is also highly inefficient and non-scalable. In this paper, we present a model-accelerator co-design framework to enable efficient on-device MTL. Our framework, dubbed M$^3$ViT, customizes mixture-of-experts (MoE) layers into a vision transformer (ViT) backbone for MTL, and sparsely activates task-specific experts during training. Then at inference with any task of interest, the same design allows for activating only the task-corresponding sparse expert pathway, instead of the full model. Our new model design is further enhanced by hardware-level innovations, in particular, a novel computation reordering scheme tailored for memory-constrained MTL that achieves zero-overhead switching between tasks and can scale to any number of experts. When executing single-task inference, M$^{3}$ViT achieves higher accuracies than encoder-focused MTL methods, while significantly reducing 88% inference FLOPs. When implemented on a hardware platform of one Xilinx ZCU104 FPGA, our co-design framework reduces the memory requirement by 2.4 times, while achieving energy efficiency up to 9.23 times higher than a comparable FPGA baseline. Code is available at: https://github.com/VITA-Group/M3ViT.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑