拔插即用语言模型:在推理时分解语言模型中的专家
Unplug and Play Language Models: Decomposing Experts in Language Models at Inference Time
AI总结:
本文提出专家分解框架 DoE,通过在推理时动态识别并激活语言模型中与任务相关的神经元子结构,在 65% 剪枝率下实现最高 1.73 倍推理加速且不损失准确率,为高效任务特定推理提供了实用且可扩展的方案。
摘要:
在大规模文本语料库和庞大参数的支持下,预训练语言模型以单一模型架构充当多任务专家。然而,近期研究表明,某些神经元在解决特定任务时发挥着不成比例的重要作用,这表明与任务相关的子结构可以被隔离出来,并为每个任务选择性地激活。因此,我们提出了专家分解(Decomposition of Experts,DoE),这是一个新颖的框架,能够动态识别并激活语言模型中的任务特定专家,从而在不牺牲准确率的情况下降低推理成本。我们首先将任务专家定义为一组对特定任务性能有显著影响的参数,并提出一个四步拔插即用流程:(1)接收用户请求,(2)识别相应的任务专家,(3)使用专家局部化模型执行推理,(4)恢复原始模型并等待下一个任务。DoE 利用归因方法和提示微调来隔离与任务相关的神经元,在保持任务性能的同时最大限度地减少计算开销。我们假设一个场景:语言模型接收来自五个广泛使用的自然语言理解基准的用户请求,每次处理一个任务。在该设置下,我们证明 DoE 在 65% 的剪枝率下实现了最高 1.73 倍的推理加速,且不影响准确率。与各种任务专家定位方法的比较表明,DoE 能够有效识别任务专家,而消融研究验证了其各组成部分的重要性。此外,我们还分析了批大小、token 数量和层类型对推理加速的影响,为采用 DoE 提供了实用见解。所提出的框架既实用又可扩展,适用于任何基于 Transformer 的架构,为高效的任务特定推理提供了稳健的解决方案。
英文摘要:
Enabled by large-scale text corpora with huge parameters, pre-trained language models operate as multi-task experts using a single model architecture. However, recent studies have revealed that certain neurons play disproportionately important roles in solving specific tasks, suggesting that task-relevant substructures can be isolated and selectively activated for each task. Therefore, we introduce Decomposition of Experts (DoE), a novel framework that dynamically identifies and activates task-specific experts within a language model to reduce inference cost without sacrificing accuracy. We first define a task expert as a set of parameters that significantly influence the performance of a specific task and propose a four-step unplug-and-play process: (1) receiving a user request, (2) identifying the corresponding task expert, (3) performing inference using the expert-localized model, and (4) restoring the original model and waiting for the next task. Using attribution methods and prompt tuning, DoE isolates task-relevant neurons, minimizing computational overhead while maintaining task performance. We assume a setting where a language model receives user requests from five widely used natural language understanding benchmarks, processing one task at a time. In this setup, we demonstrate that DoE achieves up to a x1.73 inference speed-up with a 65% pruning rate, without compromising accuracy. Comparisons with various task expert localization methods reveal that DoE effectively identifies task experts, while ablation studies validate the importance of its components. Additionally, we analyze the effects of batch size, token count, and layer types on inference speed-up, providing practical insights for adopting DoE. The proposed framework is both practical and scalable, applicable to any transformer-based architecture, offering a robust solution for efficient task-specific inference.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。