在为NLP任务微调预训练Transformers时,我应该尝试多种优化器吗?我应该调整它们的超参数吗?
Should I try multiple optimizers when fine-tuning pre-trained Transformers for NLP tasks? Should I tune their hyperparameters?
AI总结:
本文研究了NLP任务微调中优化器选择与超参数调整的影响,发现调整超参数时主流自适应优化器性能无显著差异,建议仅调整学习率,无法调整时选带动量的SGD。
摘要:
NLP研究已探索了不同的神经模型架构和规模、数据集、训练目标以及迁移学习技术。然而,训练中优化器的选择尚未得到广泛探索。通常,会采用随机梯度下降(SGD)的某种变体,在众多变体中根据不明确的标准进行选择,并且往往对优化器的超参数进行极少或不进行调整。通过在五个GLUE数据集、两个模型(DistilBERT和DistilRoBERTa)以及七种流行优化器(SGD、带动量的SGD、Adam、AdaMax、Nadam、AdamW和AdaBound)上进行实验,我们发现,当优化器的超参数经过调整时,尽管训练损失存在差异,但五种更复杂(自适应)的优化器在测试性能上没有实质性差异。此外,在大多数情况下,仅调整学习率与调整所有超参数的效果一样好。因此,我们建议选择任何表现最佳的自适应优化器(例如Adam)并仅调整其学习率。当无法调整任何超参数时,带动量的SGD是最佳选择。
英文摘要:
NLP research has explored different neural model architectures and sizes, datasets, training objectives, and transfer learning techniques. However, the choice of optimizer during training has not been explored as extensively. Typically, some variant of Stochastic Gradient Descent (SGD) is employed, selected among numerous variants, using unclear criteria, often with minimal or no tuning of the optimizer's hyperparameters. Experimenting with five GLUE datasets, two models (DistilBERT and DistilRoBERTa), and seven popular optimizers (SGD, SGD with Momentum, Adam, AdaMax, Nadam, AdamW, and AdaBound), we find that when the hyperparameters of the optimizers are tuned, there is no substantial difference in test performance across the five more elaborate (adaptive) optimizers, despite differences in training loss. Furthermore, tuning just the learning rate is in most cases as good as tuning all the hyperparameters. Hence, we recommend picking any of the best-behaved adaptive optimizers (e.g., Adam) and tuning only its learning rate. When no hyperparameter can be tuned, SGD with Momentum is the best choice.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。