用强化位置编码减少一半层数,翻译模型更高效
Efficient transformer with reinforced position embedding for language models
- 将位置编码与可训练词嵌入拼接并归一化列,提升注意力效果
- 参数量减至1/3,训练损失1.21,耗时仅1352秒/轮
- 适合追求轻量化和快速训练的NLP应用
本文提出一种高效Transformer架构,通过强化位置嵌入实现性能优越且层数仅为一半。方法包括:将位置编码与可训练词嵌入拼接、对词嵌入矩阵列进行归一化,并将归一化结果作为注意力层的值。在葡萄牙语-英语翻译任务中,10轮训练(共12小时)下,该方法平均训练损失为1.21,验证损失为1.51,每轮平均训练时间1352.27秒,相比基线模型(相同嵌入维度)的1.96和2.18损失及4297.79秒/轮,显著降低。在14个TensorFlow多语言数据集上评估,本方法持续取得更低或相当的训练与验证损失,表明学习效率提升。
原文摘要 · Abstract (English)
In this paper, we propose an efficient transformer architecture that uses reinforced positional embedding to obtain superior performance with half the number of encoder decoder layers. We demonstrate that concatenating positional encoding with trainable token embeddings, normalizing columns in the token embedding matrix, and using the normalized token embedding matrix as the value of the attention layer improve the training and validation loss and the training time in an encoder-decoder Transformer model for a Portuguese-English translation task with 10 epochs or 12 hours of training across 10 trials. Our method, with roughly a threefold parameter reduction compared to the baseline model, yields a mean training loss of 1.21, a mean validation loss of 1.51, and an average training time of 1352.27 seconds per epoch, surpassing the baseline model with the same embedding dimension that employs addition of positional encoding and token embeddings, which achieves a mean training loss of 1.96, a validation loss of 2.18, and an average training time of 4297.79 seconds per epoch. Additionally, we evaluated our proposed architecture and the baseline across 14 diverse translation datasets from TensorFlow. The results indicate that our method consistently achieves lower or comparable training and validation losses, suggesting enhanced learning efficiency.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。