[论文解读] EdgeMoE: Empowering Sparse Large Language Models on Mobile Devices
EdgeMoE 是一种在设备端推理引擎,用于混合专家(MoE)LLM,通过内存到存储分区、专家级量化和就地专家管理,在边缘设备上实现高效稀疏 LLM 的推理。
Large language models (LLMs) such as GPTs and Mixtral-8x7B have revolutionized machine intelligence due to their exceptional abilities in generic ML tasks. Transiting LLMs from datacenters to edge devices brings benefits like better privacy and availability, but is challenged by their massive parameter size and thus unbearable runtime costs. To this end, we present EdgeMoE, an on-device inference engine for mixture-of-expert (MoE) LLMs -- a popular form of sparse LLM that scales its parameter size with almost constant computing complexity. EdgeMoE achieves both memory- and compute-efficiency by partitioning the model into the storage hierarchy: non-expert weights are held in device memory; while expert weights are held on external storage and fetched to memory only when activated. This design is motivated by a key observation that expert weights are bulky but infrequently used due to sparse activation. To further reduce the expert I/O swapping overhead, EdgeMoE incorporates two novel techniques: (1) expert-wise bitwidth adaptation that reduces the expert sizes with tolerable accuracy loss; (2) expert preloading that predicts the activated experts ahead of time and preloads it with the compute-I/O pipeline. On popular MoE LLMs and edge devices, EdgeMoE showcase significant memory savings and speedup over competitive baselines. The code is available at https://github.com/UbiquitousLearning/mllm.
研究动机与目标
- 因内存与 I/O 成本,在边缘设备上部署大型 MoE LLM 的挑战。
- 提出 EdgeMoE,通过将热(非专家)权重和冷(专家)权重在内存与外部存储之间分离来实现就地推理。
- 开发两种技术——专家级比特宽度自适应和就地专家管理——以降低专家 I/O 开销。
- 在多种 MoE 模型和边缘设备上演示该方法,展示内存节省和加速。
- 提供离线-在线量化和专家预加载工作流,以支持边缘设备上的互动任务。
提出的方法
- 按存储层次对模型权重进行分区;将非专家权重保留在设备内存中,只从外部存储加载激活的专家。
- 应用专家级通道线性量化,在用户指定的精度损失下创建混合精度的专家集。
- 离线分析以对专家重要性进行排序并分配比特宽度;构建运行时模型以指导专家比特宽度选择。
- 就地专家管理,结合专家再批处理和基于预测的预加载管线以隐藏 I/O 成本。
- 离线分析构建激活概率字典,以便对可能被激活的专家进行机会性预加载。
- 定制缓存置换策略,考虑专家激活频率和与当前计算的层级邻近性。
实验结果
研究问题
- RQ1在大量专家带来的内存和 I/O 瓶颈下,如何在边缘设备上高效运行 MoE LLM?
- RQ2我们能否利用专家级量化和预测性预加载来降低就地 MoE 推理的内存占用和延迟?
- RQ3在自回归解码过程中,组织和缓存专家权重以最大化缓存命中率的有效策略是什么?
- RQ4在代表性边缘平台上,与基线相比,EdgeMoE 能实现哪些性能提升(内存和速度)?
- RQ5EdgeMoE 在编码-解码及解码器唯一的 MoE 架构以及在各种边缘硬件上的适用性有多广?
主要发现
- 与将整个 MoE 模型全量载入内存相比,EdgeMoE 将内存占用降低约 1.05× 到 1.18×。
- EdgeMoE 相较于以内存优化为目标的基线,在加载专家的情况下实现了 1.11× 到 2.78× 的推理加速。
- 该方法使大于 10B 尺度的 MoE LLM 在像 Jetson TX2 这样的消费者级边缘设备上实现快速推理。
- 对专家进行混合精度量化(INT2/INT4/INT8)在显著减少存储需求的同时带来较小的精度损失。
- 逐专家比特宽度自适应加上就地专家管理共同提高了加载与计算的重叠,降低总体延迟。
- 具备离线激活分析和在线预加载的管线可以在每层预加载 1–3 个专家,以在实践中隐藏 I/O 延迟。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。