工作的正确工具:匹配模型和实例复杂性
The Right Tool for the Job: Matching Model and Instance Complexities
摘要:
随着NLP模型变得越来越大,执行训练模型需要大量的计算资源,从而产生金钱和环境成本。为了更好地尊重一个给定的推理预算,我们提出了一个修改上下文表示微调,在推理过程中,允许早期(和快速)“退出”从神经网络计算简单的情况下,和晚期(和准确)退出硬的情况。为了实现这一点,我们将分类器添加到BERT的不同层,并使用其校准的置信度分数来做出早期退出决策。我们在两个任务中的五个不同的数据集上测试我们提出的修改:三个文本分类数据集和两个自然语言推理基准。我们的方法在几乎所有情况下都呈现出有利的速度/精度权衡,产生的模型比现有技术快五倍,同时保持其精度。与基线BERT模型相比,我们的方法几乎不需要额外的训练资源(无论是时间还是参数)。最后,我们的方法消除了在不同效率水平下对多个模型进行昂贵的再训练的需要;我们允许用户通过在推理时设置单个变量,使用单个训练模型来控制推理速度/准确性权衡。我们公开发布代码。
英文摘要:
As NLP models become larger, executing a trained model requires significant computational resources incurring monetary and environmental costs. To better respect a given inference budget, we propose a modification to contextual representation fine-tuning which, during inference, allows for an early (and fast) "exit" from neural network calculations for simple instances, and late (and accurate) exit for hard instances. To achieve this, we add classifiers to different layers of BERT and use their calibrated confidence scores to make early exit decisions. We test our proposed modification on five different datasets in two tasks: three text classification datasets and two natural language inference benchmarks. Our method presents a favorable speed/accuracy tradeoff in almost all cases, producing models which are up to five times faster than the state of the art, while preserving their accuracy. Our method also requires almost no additional training resources (in either time or parameters) compared to the baseline BERT model. Finally, our method alleviates the need for costly retraining of multiple models at different levels of efficiency; we allow users to control the inference speed/accuracy tradeoff using a single trained model, by setting a single variable at inference time. We publicly release our code.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。