arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2312.10193cs.LG
收藏

自适应计算模块:用于高效推理的细粒度条件计算

Adaptive Computation Modules: Granular Conditional Computation For Efficient Inference

IDEAS NCBR;Jagiellonian University(雅盖隆大学);Sapienza University of Rome(罗马大学);University of Warsaw(华沙大学);University of Edinburgh(爱丁堡大学)

Bartosz Wójcik, Alessio Devoto, Karol Pustelnik, Pasquale Minervini, Simone Scardapane

AI总结:

针对Transformer计算效率低的问题,提出自适应计算模块(ACM),通过门控机制按token动态调整计算负载,并利用蒸馏技术改造预训练模型,在视觉和语音任务中显著降低推理成本且不损失准确率。

摘要:

虽然 transformer 模型取得了巨大成功,但它们在计算上效率低下。我们观察到,对于每一层,可能仅对批次内的一小部分 token 需要该层的全宽,并且处理 token 所需的“有效”宽度可能因层而异。受此观察启发,我们引入了自适应计算模块(Adaptive Computation Module, ACM),这是一种通用模块,能够动态调整其计算负载,以匹配基于每个 token 估算的输入难度。ACM 由一系列学习器组成,这些学习器逐步细化其前置学习器的输出。一个额外的门控机制决定为每个 token 执行的最佳学习器数量。我们还提出了一种蒸馏技术,用“ACM化”的变体替换任何预训练模型。我们在计算机视觉和语音识别的 transformer 模型上的评估表明,用 ACM 替换层可显著降低推理成本,且在广泛的用户自定义预算区间内不会降低下游准确率。

英文摘要:

While transformer models have been highly successful, they are computationally inefficient. We observe that for each layer, the full width of the layer may be needed only for a small subset of tokens inside a batch and that the "effective" width needed to process a token can vary from layer to layer. Motivated by this observation, we introduce the Adaptive Computation Module (ACM), a generic module that dynamically adapts its computational load to match the estimated difficulty of the input on a per-token basis. An ACM consists of a sequence of learners that progressively refine the output of their preceding counterparts. An additional gating mechanism determines the optimal number of learners to execute for each token. We also propose a distillation technique to replace any pre-trained model with an "ACMized" variant. Our evaluation of transformer models in computer vision and speech recognition demonstrates that substituting layers with ACMs significantly reduces inference costs without degrading the downstream accuracy for a wide interval of user-defined budgets.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑