arXiv:2410.10846cs.LGcs.CL2024-10被引 5

让大模型按需计算,提升效率并揭示其内部运作机制

Duo-LLM: A Framework for Studying Adaptive Computation in Large Language Models

  • 在每层前馈网络中加入小模块,动态决定每个词元用大还是小模块处理
  • 仅在一层启用大模块的效果优于全层使用,说明现有路由策略有差距
  • 通过理想路由对比,揭示实际模型与最优解之间的性能鸿沟

大型语言模型通常以固定算力逐标记生成输出,造成资源浪费。近期混合专家(MoE)、推测解码和提前退出策略虽基于输入复杂度动态调整计算,但如何找到最优调度路径仍是难题。为此,我们提出一种新框架,在每个前馈网络层中集成小型辅助模块,实现基于任务难度的动态路由:词元可选择由小或大模块处理,甚至跳过某些层。这引入了“词元难度”概念,即其从额外计算中获益的潜力。通过使用理想路由(oracle)识别最优执行模式,我们深入理解了模型内部机制及简化异构MoE中的路由过程。结果显示,训练后的路由器表现远低于理想情况,且仅在单层激活大模块的效果优于全层使用,凸显实际路由与理论最优间的显著差距。

原文摘要 · Abstract (English)

Large Language Models (LLMs) typically generate outputs token by token using a fixed compute budget, leading to inefficient resource utilization. To address this shortcoming, recent advancements in mixture of expert (MoE) models, speculative decoding, and early exit strategies leverage the insight that computational demands can vary significantly based on the complexity and nature of the input. However, identifying optimal routing patterns for dynamic execution remains an open challenge, limiting the full potential of these adaptive methods. To address this need, we study adaptive computation in LLMs more systematically. We propose a novel framework that integrates smaller auxiliary modules within each Feed-Forward Network layer of the LLM. This design enables dynamic routing of tokens based on task complexity: tokens can be processed by either the small or big modules at each layer, or even bypass certain layers entirely. This allows us to introduce a novel notion of a token's difficulty, defined by its potential to benefit from additional computational resources. Importantly, by employing oracles to identify optimal patterns of adaptive computations, we gain valuable insights into the internal workings of LLMs and the routing processes in a simplified heterogeneous MoE setup. We show that trained routers operate differently from oracles and often yield suboptimal solutions. Notably, activating a large module in just one layer outperforms models that use large modules across all layers, underscoring the gap between practical implementations of routing in MoE models and theoretical optima for adaptive computation.

大模型优化自适应计算MoE路由机制

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。