الاهتمام هو كل ما نحتاجه ←
الخلاصةAbstract
تعتمد نماذج تحويل السلاسل التقليدية على الشبكات العصبية التكرارية المعقدة أو شبكات طي تتضمن مُرمِّز وفاك ترميز.The dominant sequence transduction models are based on complex recurrent or convolutional neural networks that include an encoder and a decoder. تربط النماذج الأعلى أداءً هذين المكوّنين عبر آلية الانتباه.The best performing models also connect the encoder and decoder through an attention mechanism. يقترح الباحثون في هذه الورقة بنية شبكية جديدة وبسيطة، تُسمّى المحوّل، تعتمد كليًا على آليات الانتباه دون أي حاجة إلى التكرار أو الطي (الالتفاف).We propose a new simple network architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely. أظهرت التجربة على مهمّتَي ترجمة آلية تفوّق هذا النموذج من حيث جودة المخرجات، وقابليته للمعالجة المتوازية، وتطلّبه زمن تدريب أقل.Experiments on two machine translation tasks show these models to be superior in quality while being more parallelizable and requiring significantly less time to train. وقد حقّق المحول نتيجة بلغت 28.4 على مقياس التقييم ثنائي اللغة في مهمّة الترجمة من الإنجليزية إلى الألمانية ضمن مجموعة بيانات ورشة عمل الترجمة الآلية لعام 2014، متجاوزًا أفضل النتائج السابقة، بما في ذلك نتائج النماذج المجمّعة، بفارق نقطتين على مقياس التقييم المذكور. وحقّق المحوّل في مهمّة الترجمة من الإنجليزية إلى الفرنسية على مجموعة البيانات ذاتها نتيجة متقدمة لنموذج منفرد بلغت 41.8، وذلك بعد تدريب استمر 3.5 أيام فقط على ثماني وحدات معالجة رسومية.Our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task, improving over the existing best results, including ensembles, by over 2 BLEU. تُعدّ كلفة الحوسبة تلك جزءًا يسيرًا مقارنةً بتكاليف تدريب أفضل النماذج الحالية. ووضح الباحثون أن نموذج المحول يمكن تعميمه بشكل جيد على مهام أخرى، إذ جرى تطبيقه بنجاح في تحليل التكوين اللغوي للغة الإنجليزية باستخدام بيانات تدريب واسعة وأخرى ومحدودة.On the WMT 2014 English-to-French translation task, our model establishes a new single-model state-of-the-art BLEU score of 41.0 after training for 3.5 days on eight GPUs, a small fraction of the training costs of the best models from the literature.المصطلحات التأسيسيةFoundational Terms
نماذج تحويل ● مقياس التقييم ثنائي اللغة ● ورشة عمل الترجمة الآلية لعام 2014 ● النماذج المجمّعة ● الشبكات العصبية التكرارية ● شبكات الذاكرة طويلة-قصيرة المدى ● الشبكات التكرارية ذات البوابات ● الترميز وفكه ● الإنتباه
المقدمةIntroduction
أصبحت الشبكات العصبية التكرارية، ولا سيما شبكات الذاكرة طويلة-قصيرة المدى1 والشبكات التكرارية ذات البوابات2، من أحدث الأساليب في نمذجة السلاسل ومسائل التحويل، مثل نمذجة اللغة والترجمة الآلية 3 4 5.Recurrent neural networks, long short-term memory [12] and gated recurrent [7] neural networks in particular, have been firmly established as state of the art approaches in sequence modeling and transduction problems such as language modeling and machine translation [29, 2, 5]. ومنذ ذلك الحين، تتواصل الجهود لتوسيع آفاق نماذج اللغة المتكررة وهياكل الترميز وفكه6 7 8.Numerous efforts have since continued to push the boundaries of recurrent language models and encoder-decoder architectures [31, 21, 13].تقسّم النماذج التكرارية عمليات الحوسبة تبعاً لمواقع الرموز في سلاسل الدخل والخرج.Recurrent models typically factor computation along the symbol positions of the input and output sequences. وبمواءمة تلك المواقع مع خطوات الحوسبة المتعاقبة، تُنتج هذه النماذج تسلسلاً من الحالات المخفية
كدالة تعتمد على كلٍ من الحالة المخفية السابقة ، ومدخلات الموقع .Aligning the positions to steps in computation time, they generate a sequence of hidden states ht, as a function of the previous hidden state ht 1 and the input for position t.
تُعيق تلك الطبيعة المتسلسلة المتأصّلة إمكانية إجراء حوسبة متوازية لعينات التدريب، وهو أمر بالغ الأهمية عند التعامل مع السلاسل الطويلة، حيث تفرض قيود الذاكرة حدودًا على حجم الدفعات الممكن معالجتها.This inherently sequential nature precludes parallelization within training examples, which becomes critical at longer sequence lengths, as memory constraints limit batching across examples.
وقد حسّنت الدراسات الحديثة من كفاءة الحوسبة بشكل ملحوظ عبر حيل التقسيم 9 والحوسبة المشروطة 10، مع تسجيل مكاسب في الأداء في الحالة الأخيرة.Recent work has achieved significant improvements in computational efficiency through factorization tricks [18] and conditional computation [26], while also improving model performance in case of the latter.
ويبقى مع ذلك القيد الجوهري للحوسبة المتسلسلة قائماً.The fundamental constraint of sequential computation, however, remains.
أصبحت آليات الإنتباه جزء لا يتجزء من نماذج سلاسل البيانات ونماذج التحويل عبر طيف واسع من المهام، إذ تسمح بنمذجة الاعتماديات بين الرموز بغضّ النظر عن بُعدها في سلاسل الدخل أو الخرج 4 11.Attention mechanisms have become an integral part of compelling sequence modeling and transduction models in various tasks, allowing modeling of dependencies without regard to their distance in the input or output sequences [2, 16]. ومع ذلك تُستخدم آليّة الإنتباه في جميع الحالات تقريباً 12 بوصفها مكملاً للشبكات العصبية التكرارية وليس بديلاً عنها.In all but a few cases [22], however, such attention mechanisms are used in conjunction with a recurrent network.
يقترح الباحثون في هذه الورقة نموذج المحول بوصفه بنية تتخلّى بالكامل عن الشبكات التكرارية، وتعتمد كلياً على آليات الانتباه لاستخلاص العلاقات الشمولية بين سلاسل الدخل وسلاسل الخرج.In this work we propose the Transformer, a model architecture eschewing recurrence and instead relying entirely on an attention mechanism to draw global dependencies between input and output. يُتيح نموذج المحول درجة عالية جداً من الحوسبة المتوازية، ما يمكنه من تحقيق مستوى جديد من الجودة في الترجمة بعد تدريب لا يتجاوز اثنتي عشرة ساعة على ثماني وحدات معالجة رسومية.The Transformer allows for significantly more parallelization and can reach a new state of the art in translation quality after being trained for as little as twelve hours on eight P100 GPUs.
الخلفيةBackground
شكل هدف تقليل العمليات الحسابية التسلسلية أساسًا للنماذج وحدة المعالجة الرسومية العصبية الموسعة 13، وشبكة بايت 14، وطي سلسلة لسلسلة 15، تستخدم تلك النماذج شبكات الطي العصبية كحجر بناء أساسي، حيث تحسب التمثيلات المخفية بالتوازي لجميع مواضع الدخل والخرج.The goal of reducing sequential computation also forms the foundation of the Extended Neural Graphical Processing Unit [20], ByteNet [15] and ConvS2S [8], all of which use convolutional neural networks as basic building block, computing hidden representations in parallel for all input and output positions. يزداد عدد العمليات اللازمة لربط الإشارات في تلك النماذج من موضعَي دخل أو خرج عشوائيين مع ازدياد المسافة بينهما، خطيًا في نموذج طي سلسلة لسلسلة ولوغاريتميًا في شبكة بايت.In these models, the number of operations required to relate signals from two arbitrary input or output positions grows in the distance between positions, linearly for ConvS2S and logarithmically for ByteNet. ما يجعل تعلم العلاقات بين المواضع البعيدة أكثر صعوبة 16.This makes it more difficult to learn dependencies between distant positions [11]. يُختزل عدد العمليات الحسابية في المحول إلى عدد ثابت، وإن كان ذلك على حساب انخفاض الدقة الفعالة نتيجةً لحساب متوسط المواضع موزوناً بالانتباه، وهو تأثير عالجه الباحثون باستخدام آلية الانتباه متعدد الرؤوس كما هو موضح في القسم 3.2.In the Transformer this is reduced to a constant number of operations, albeit at the cost of reduced effective resolution due to averaging attention-weighted positions, an effect we counteract with Multi-Head Attention as described in section 3.2.الانتباه الذاتي، يُسمى أحيانًا بالانتباه الداخلي، هو آلية انتباه تربط بين المواضع المختلفة لسلسلة واحدة بهدف حساب تمثيل لهذه السلسلة.Self-attention, sometimes called intra-attention is an attention mechanism relating different positions of a single sequence in order to compute a representation of the sequence. وقد استُخدم الانتباه الذاتي بنجاح في مجموعة متنوعة من المهام، بما في ذلك فهم القراءة، والتلخيص التجريدي، والاستلزام النصي، وتعلم تمثيلات الجمل المستقلة عن المهمة 17 12 18 19.Self-attention has been used successfully in a variety of tasks including reading comprehension, abstractive summarization, textual entailment and learning task-independent sentence representations [4, 22, 23, 19].
المصدرSource
المراجعReferences
Footnotes
-
Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997. ↩
-
Junyoung Chung, Çaglar Gülçehre, Kyunghyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. CoRR, abs/1412.3555, 2014. ↩
-
Ilya Sutskever, Oriol Vinyals, and Quoc VV Le. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems, pages 3104–3112, 2014. ↩
-
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. CoRR, abs/1409.0473, 2014. ↩ ↩2
-
Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. CoRR, abs/1406.1078, 2014. ↩
-
Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016. ↩
-
Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attentionbased neural machine translation. arXiv preprint arXiv:1508.04025, 2015. ↩
-
Rafal Jozefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of language modeling. arXiv preprint arXiv:1602.02410, 2016. ↩
-
Oleksii Kuchaiev and Boris Ginsburg. Factorization tricks for LSTM networks. arXiv preprint arXiv:1703.10722, 2017. ↩
-
Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. arXiv preprint arXiv:1701.06538, 2017. ↩
-
Yoon Kim, Carl Denton, Luong Hoang, and Alexander M. Rush. Structured attention networks. In International Conference on Learning Representations, 2017. ↩
-
Ankur Parikh, Oscar Täckström, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention model. In Empirical Methods in Natural Language Processing, 2016. ↩ ↩2
-
Samy Bengio Łukasz Kaiser. Can active memory replace attention? In Advances in Neural Information Processing Systems, (NIPS), 2016. ↩
-
Nal Kalchbrenner, Lasse Espeholt, Karen Simonyan, Aaron van den Oord, Alex Graves, and Koray Kavukcuoglu. Neural machine translation in linear time. arXiv preprint arXiv:1610.10099v2, 2017. ↩
-
Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N. Dauphin. Convolutional sequence to sequence learning. arXiv preprint arXiv:1705.03122v2, 2017. ↩
-
Sepp Hochreiter, Yoshua Bengio, Paolo Frasconi, and Jürgen Schmidhuber. Gradient flow in recurrent nets: the difficulty of learning long-term dependencies, 2001. ↩
-
Jianpeng Cheng, Li Dong, and Mirella Lapata. Long short-term memory-networks for machine reading. arXiv preprint arXiv:1601.06733, 2016. ↩
-
Romain Paulus, Caiming Xiong, and Richard Socher. A deep reinforced model for abstractive summarization. arXiv preprint arXiv:1705.04304, 2017. ↩
-
Zhouhan Lin, Minwei Feng, Cicero Nogueira dos Santos, Mo Yu, Bing Xiang, Bowen Zhou, and Yoshua Bengio. A structured self-attentive sentence embedding. arXiv preprint arXiv:1703.03130, 2017. ↩