Duo-LLM:一个用于研究大型语言模型中自适应计算的框架
Duo-LLM: A Framework for Studying Adaptive Computation in Large Language Models
AI总结:
提出Duo-LLM框架,通过在LLM各前馈网络层集成辅助模块实现基于任务复杂度的动态token路由,并利用预言机揭示训练路由器的次优性,发现仅在单层激活大模块即可超越全层使用大模块的模型。
摘要:
大型语言模型(LLMs)通常使用固定的计算预算逐个token生成输出,导致资源利用效率低下。为了解决这一缺陷,近期在混合专家(MoE)模型、投机解码和提前退出策略方面的进展利用了这样一个见解:计算需求可能会根据输入的复杂性和性质而显著变化。然而,为动态执行识别最佳路由模式仍然是一个开放性挑战,限制了这些自适应方法的全部潜力。为了满足这一需求,我们更加系统地研究了LLMs中的自适应计算。我们提出了一个新颖的框架,在LLM的每个前馈网络层内集成了较小的辅助模块。这种设计支持基于任务复杂度的动态token路由:token可以由每一层的小模块或大模块处理,甚至可以完全绕过某些层。这使我们能够引入关于token难度的新颖概念,该概念由其从额外计算资源中获益的潜力所定义。重要的是,通过使用预言机来识别自适应计算的最佳模式,我们获得了关于LLMs内部工作机制和简化异构MoE设置中路由过程的宝贵见解。我们表明,经过训练的路由器与预言机的运行方式不同,并且通常产生次优解。值得注意的是,仅在某一层激活大模块就优于在所有层都使用大模块的模型,突显了MoE模型中路由的实际实现与自适应计算理论最优之间的差距。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。