[论文解读] M$^3$ViT: Mixture-of-Experts Vision Transformer for Efficient Multi-task Learning with Model-Accelerator Co-design
M3ViT 将混合专家(MoE)层整合到视觉变换器中,以实现高效的多任务学习,在训练和推理阶段实现任务特定的稀疏路由,并结合基于 FPGA 的硬件联合设计,以实现内存和能源高效的设备端部署。
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.
研究动机与目标
- 在紧凑模型中解决多任务学习的训练梯度冲突。
- 通过稀疏激活的任务特定专家,实现一次仅推理一个任务的高效。
- 开发面向硬件的 MoE-ViT 设计,以在边缘设备上最小化内存和能耗成本。
提出的方法
- 将 ViT 中的密集 MLP 替换为稀疏激活的混合专家(Mixture-of-Experts)层。
- 使用一个与任务相关的路由器为每个输入标记选择一部分专家。
- 引入面向任务的和多门控的 MoE 变体以进行多任务路由。
- 在 FPGA 上应用内存高效的计算重新排序,以实现逐个专家的处理。
- 通过硬件设计 demonstrating 零开销的任务切换。
实验结果
研究问题
- RQ1MoE 层是否能在用于多任务学习的密集视觉变换器中缓解跨任务的梯度冲突?
- RQ2任务特定的稀疏路由是否在不牺牲精度的前提下提升单任务推理效率?
- RQ3硬件协同设计(内存感知计算)如何在 FPGA 上扩展 MoE 至多专家和多任务?
- RQ4在标准密集预测基准上,M3ViT 相较于以编码器为重点的多任务学习模型,在准确性、FLOPs、内存和能量方面的相对提升是多少?
主要发现
- M3ViT 在评估任务上比以编码器为重点的多任务学习方法具有更高的准确性。
- 使用 M3ViT 的单任务推理将推理 FLOPs 降低了 88%。
- 在 FPGA 上,内存使用量下降了 2.40 倍,能效提升高达 9.23 倍,相较于 FPGA 基线,且相较于 GPU 基线高达 10.79 倍。
- 基于 MoE 的变体(单一、多人、任务条件)的设计表明任务相关的 MoE 设计在多任务学习中性能有所提升,特别是当任务数量增加时。
- 面向硬件的计算重新排序实现了零开销的任务/帧切换,并可扩展到任意数量的专家。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。