{"id":8824,"date":"2022-10-06T21:24:39","date_gmt":"2022-10-06T13:24:39","guid":{"rendered":"http:\/\/139.9.1.231\/?p=8824"},"modified":"2022-10-06T21:24:40","modified_gmt":"2022-10-06T13:24:40","slug":"attention_nlp","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2022\/10\/06\/attention_nlp\/","title":{"rendered":"\u81ea\u7136\u8bed\u8a00\u5904\u7406\u4e2d\u6ce8\u610f\u529b\u673a\u5236\u7efc\u8ff0"},"content":{"rendered":"\n\n\n<h3>\u6ce8\u610f\u529b\u6c47\u805a<\/h3>\n\n\n\n<p>         \u67e5\u8be2\uff08\u81ea\u4e3b\u63d0\u793a\uff09\u548c\u952e\uff08\u975e\u81ea\u4e3b\u63d0\u793a\uff09\u4e4b\u95f4\u7684\u4ea4\u4e92\u5f62\u6210\u4e86 \u6ce8\u610f\u529b\u6c47\u805a\uff08attentionpooling\uff09\u3002\u6ce8\u610f\u529b\u6c47\u805a\u6709\u9009\u62e9\u5730\u805a\u5408\u4e86\u503c\uff08\u611f\u5b98\u8f93\u5165\uff09\u4ee5\u751f\u6210\u6700\u7ec8\u7684\u8f93<br>\u51fa\u3002\u6ce8\u610f\u529b\u6c47\u805a\uff08attention pooling\uff09\u516c\u5f0f\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"314\" height=\"92\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-16.png\" alt=\"\" class=\"wp-image-8831\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-16.png 314w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-16-300x88.png 300w\" sizes=\"(max-width: 314px) 100vw, 314px\" \/><\/figure><\/div>\n\n\n\n<p>  \u5176\u4e2d x \u662f\u67e5\u8be2\uff0c(xi; yi) \u662f\u952e\u503c\u5bf9\u3002\u6ce8\u610f\u529b\u6c47\u805a\u662f yi \u7684\u52a0\u6743\u5e73\u5747\u3002\u5c06\u67e5\u8be2 x \u548c\u952e xi\u4e4b\u95f4\u7684\u5173\u7cfb\u5efa\u6a21\u4e3a \u6ce8\u610f\u529b\u6743\u91cd\uff08attetnion weight\uff09 (x; xi)\uff0c\u5982 (10.2.4) \u6240\u793a\uff0c\u8fd9\u4e2a\u6743\u91cd\u5c06\u88ab\u5206\u914d\u7ed9\u6bcf\u4e00\u4e2a\u5bf9\u5e94\u503c yi\u3002\u5bf9\u4e8e\u4efb\u4f55\u67e5\u8be2\uff0c\u6a21\u578b\u5728\u6240\u6709\u952e\u503c\u5bf9\u4e0a\u7684\u6ce8\u610f\u529b\u6743\u91cd\u90fd\u662f\u4e00\u4e2a\u6709\u6548\u7684\u6982\u7387\u5206\u5e03\uff1a\u5b83\u4eec\u662f\u975e\u8d1f\u6570\u7684\uff0c\u5e76\u4e14\u603b\u548c\u4e3a1\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"313\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-17-1024x313.png\" alt=\"\" class=\"wp-image-8840\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-17-1024x313.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-17-300x92.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-17-768x235.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-17.png 1193w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u6b63\u5982\u6211\u4eec\u6240\u770b\u5230\u7684\uff0c\u9009\u62e9\u4e0d\u540c\u7684\u6ce8\u610f\u529b\u8bc4\u5206\u51fd\u6570 a \u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u6ce8\u610f\u529b\u6c47\u805a\u64cd\u4f5c\u3002<\/p>\n\n\n\n<h4>1\u3001\u52a0\u6027\u6ce8\u610f\u529b<\/h4>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"261\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-18-1024x261.png\" alt=\"\" class=\"wp-image-8846\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-18-1024x261.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-18-300x77.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-18-768x196.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-18.png 1160w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h4>2\u3001\u7f29\u653e\u70b9\u79ef\u6ce8\u610f\u529b<\/h4>\n\n\n\n<p>     \u4f7f\u7528\u70b9\u79ef\u53ef\u4ee5\u5f97\u5230\u8ba1\u7b97\u6548\u7387\u66f4\u9ad8\u7684\u8bc4\u5206\u51fd\u6570\u3002\u4f46\u662f\u70b9\u79ef\u64cd\u4f5c\u8981\u6c42\u67e5\u8be2\u548c\u952e\u5177\u6709\u76f8\u540c\u7684\u2ed3\u5ea6d\u3002\u5047\u8bbe\u67e5\u8be2\u548c\u952e\u7684\u6240\u6709\u5143\u7d20\u90fd\u662f\u72ec\u7acb\u7684\u968f\u673a\u53d8\u91cf\uff0c\u5e76\u4e14\u90fd\u6ee1\u8db3\u5747\u503c\u4e3a 0 \u548c\u65b9\u5dee\u4e3a 1\u3002\u90a3\u4e48\u4e24\u4e2a\u5411\u91cf\u7684\u70b9\u79ef\u7684\u5747\u503c\u4e3a 0\uff0c\u65b9\u5dee\u4e3a d\u3002\u4e3a\u786e\u4fdd\u65e0\u8bba\u5411\u91cf\u2ed3\u5ea6\u5982\u4f55\uff0c\u70b9\u79ef\u7684\u65b9\u5dee\u5728\u4e0d\u8003\u8651\u5411\u91cf\u2ed3\u5ea6\u7684\u60c5\u51b5\u4e0b\u4ecd\u7136\u662f 1\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528 \u7f29\u653e\u70b9\u79ef\u6ce8\u610f\u529b\uff08scaled dot-product attention\uff09\u8bc4\u5206\u51fd\u6570\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"267\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-19-1024x267.png\" alt=\"\" class=\"wp-image-8850\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-19-1024x267.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-19-300x78.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-19-768x200.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-19.png 1178w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3><strong>1. \u5199\u5728\u524d\u9762<\/strong><\/h3>\n\n\n\n<p>\u8fd1\u4e9b\u5e74\u6765\uff0c\u6ce8\u610f\u529b\u673a\u5236\u4e00\u76f4\u9891\u7e41\u7684\u51fa\u73b0\u5728\u76ee\u4e4b\u6240\u53ca\u7684\u6587\u732e\u6216\u8005\u535a\u6587\u4e2d\uff0c\u53ef\u89c1\u5728nlp\u4e2d\u7b97\u5f97\u4e0a\u662f\u4e2a\u76f8\u5f53\u6d41\u884c\u7684\u6982\u5ff5\uff0c\u4e8b\u5b9e\u4e5f\u8bc1\u660e\u5176\u5728nlp\u9886\u57df\u6563\u53d1\u51fa\u4e0d\u5c0f\u5f97\u4f5c\u7528\u3002\u8fd9\u51e0\u5e74\u5f97\u9876\u4f1apaper\u5c31\u80fd\u770b\u51fa\u8fd9\u4e00\u70b9\u3002\u672c\u6587\u6df1\u5165\u6d45\u51fa\u5730\u4ecb\u7ecd\u4e86\u81ea\u7136\u8bed\u8a00\u5904\u7406\u4e2d\u7684\u6ce8\u610f\u529b\u673a\u5236\u6280\u672f\u3002\u636eLilian Weng\u535a\u4e3b\u603b\u7ed3\u4ee5\u53ca\u4e00\u4e9b\u8d44\u6599\u663e\u793a\uff0cAttention\u673a\u5236\u6700\u65e9\u5e94\u8be5\u662f\u5728\u89c6\u89c9\u56fe\u50cf\u9886\u57df\u63d0\u51fa\u6765\u7684\uff0c\u8fd9\u65b9\u9762\u7684\u5de5\u4f5c\u5e94\u8be5\u5f88\u591a\uff0c\u5386\u53f2\u4e5f\u6bd4\u8f83\u60a0\u4e45\u3002\u4eba\u7c7b\u7684\u89c6\u89c9\u6ce8\u610f\u529b\u867d\u7136\u5b58\u5728\u5f88\u591a\u4e0d\u540c\u7684\u6a21\u578b\uff0c\u4f46\u5b83\u4eec\u90fd\u57fa\u672c\u4e0a\u5f52\u7ed3\u4e3a\u7ed9\u4e88\u9700\u8981\u91cd\u70b9\u5173\u6ce8\u7684\u76ee\u6807\u533a\u57df(\u6ce8\u610f\u529b\u7126\u70b9)\u66f4\u91cd\u8981\u7684\u6ce8\u610f\u529b\uff0c\u540c\u65f6\u7ed9\u4e88\u5468\u56f4\u7684\u56fe\u50cf\u4f4e\u7684\u6ce8\u610f\u529b\uff0c\u7136\u540e\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\u8c03\u6574\u7126\u70b9\u3002\u800c\u76f4\u5230Bahdanau\u7b49\u4eba\u53d1\u8868\u4e86\u8bba\u6587\u300aNeural Machine Translation by Jointly Learning to Align and Translate\u300b\uff0c\u8be5\u8bba\u6587\u4f7f\u7528\u7c7b\u4f3cattention\u7684\u673a\u5236\u5728\u673a\u5668\u7ffb\u8bd1\u4efb\u52a1\u4e0a\u5c06\u7ffb\u8bd1\u548c\u5bf9\u9f50\u540c\u65f6\u8fdb\u884c\uff0c\u8fd9\u4e2a\u5de5\u4f5c\u76ee\u524d\u662f\u6700\u88ab\u8ba4\u53ef\u4e3a\u662f\u7b2c\u4e00\u4e2a\u63d0\u51faattention\u673a\u5236\u5e94\u7528\u5230NLP\u9886\u57df\u4e2d\uff0c\u503c\u5f97\u4e00\u63d0\u7684\u662f\uff0c\u8be5\u8bba\u65872015\u5e74\u88abICLR\u5f55\u7528\uff0c\u622a\u81f3\u73b0\u5728\uff0c\u8c37\u6b4c\u5f15\u7528\u91cf\u4e3a5596\uff0c\u53ef\u89c1\u540e\u7eednlp\u5728\u8fd9\u4e00\u5757\u7684\u7814\u7a76\u706b\u7206\u7a0b\u5ea6\u3002<\/p>\n\n\n\n<p>\u6ce8\u610f\u529b\u673a\u5236\u9996\u5148\u4ece\u4eba\u7c7b\u76f4\u89c9\u4e2d\u5f97\u5230\uff0c\u5728nlp\u9886\u57df\u7684\u673a\u5668\u7ffb\u8bd1\u4efb\u52a1\u4e0a\u9996\u5148\u53d6\u5f97\u4e0d\u9519\u7684\u5e94\u7528\u6210\u529f\u3002\u7b80\u800c\u8a00\u4e4b\uff0c\u6df1\u5ea6\u5b66\u4e60\u4e2d\u7684\u6ce8\u610f\u529b\u53ef\u4ee5\u5e7f\u4e49\u5730\u89e3\u91ca\u4e3a\u91cd\u8981\u6027\u6743\u91cd\u7684\u5411\u91cf\uff1a<strong>\u4e3a\u4e86\u9884\u6d4b\u4e00\u4e2a\u5143\u7d20\uff0c\u4f8b\u5982\u53e5\u5b50\u4e2d\u7684\u5355\u8bcd\uff0c\u4f7f\u7528\u6ce8\u610f\u529b\u5411\u91cf\u6765\u4f30\u8ba1\u5b83\u4e0e\u5176\u4ed6\u5143\u7d20\u7684\u76f8\u5173\u7a0b\u5ea6\u6709\u591a\u5f3a\uff0c\u5e76\u5c06\u5176\u503c\u7684\u603b\u548c\u4f5c\u4e3a\u76ee\u6807\u7684\u8fd1\u4f3c\u503c<\/strong>\u3002<\/p>\n\n\n\n<p>\u65e2\u7136\u6ce8\u610f\u529b\u673a\u5236\u6700\u65e9\u5728nlp\u9886\u57df\u5e94\u7528\u4e8e\u673a\u5668\u7ffb\u8bd1\u4efb\u52a1\uff0c\u90a3\u5728\u8fd9\u4e2a\u4e4b\u524d\u53c8\u662f\u600e\u4e48\u505a\u7684\u5462\uff1f\u4f20\u7edf\u7684\u57fa\u4e8e\u77ed\u8bed\u7684\u7ffb\u8bd1\u7cfb\u7edf\u901a\u8fc7\u5c06\u6e90\u53e5\u5206\u6210\u591a\u4e2a\u5757\u7136\u540e\u9010\u4e2a\u8bcd\u5730\u7ffb\u8bd1\u5b83\u4eec\u6765\u5b8c\u6210\u5b83\u4eec\u7684\u4efb\u52a1\u3002 \u8fd9\u5bfc\u81f4\u4e86\u7ffb\u8bd1\u8f93\u51fa\u7684\u4e0d\u6d41\u7545\u3002\u60f3\u60f3\u6211\u4eec\u4eba\u7c7b\u662f\u5982\u4f55\u7ffb\u8bd1\u7684\uff1f\u6211\u4eec\u9996\u5148\u4f1a\u9605\u8bfb\u6574\u4e2a\u5f85\u7ffb\u8bd1\u7684\u53e5\u5b50\uff0c\u7136\u540e\u7ed3\u5408\u4e0a\u4e0b\u6587\u7406\u89e3\u5176\u542b\u4e49\uff0c\u6700\u540e\u4ea7\u751f\u7ffb\u8bd1\u3002\u5728\u67d0\u79cd\u7a0b\u5ea6\u4e0a\uff0c\u795e\u7ecf\u673a\u5668\u7ffb\u8bd1\uff08NMT\uff09\u7684\u63d0\u51fa\u6b63\u662f\u60f3\u53bb\u6a21\u4eff\u8fd9\u4e00\u8fc7\u7a0b\u3002\u800c\u5728NMT\u7684\u7ffb\u8bd1\u6a21\u578b\u4e2d\u7ecf\u5178\u7684\u505a\u6cd5\u662f\u7531\u7f16\u7801\u5668 &#8211; \u89e3\u7801\u5668\u67b6\u6784\u5236\u5b9a(encoder-decoder)\uff0c\u7528\u4f5cencoder\u548cdecoder\u5e38\u7528\u7684\u662f\u5faa\u73af\u795e\u7ecf\u7f51\u7edc\u3002\u8fd9\u7c7b\u6a21\u578b\u5927\u6982\u8fc7\u7a0b\u662f\u9996\u5148\u5c06\u6e90\u53e5\u5b50\u7684\u8f93\u5165\u5e8f\u5217\u9001\u5165\u5230\u7f16\u7801\u5668\u4e2d\uff0c\u63d0\u53d6\u6700\u540e\u9690\u85cf\u7684\u8868\u793a\u5e76\u7528\u4e8e\u521d\u59cb\u5316\u89e3\u7801\u5668\u7684\u9690\u85cf\u72b6\u6001\uff0c\u7136\u540e\u4e00\u4e2a\u63a5\u4e00\u4e2a\u5730\u751f\u6210\u76ee\u6807\u5355\u8bcd\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u5e7f\u4e49\u4e0a\u53ef\u4ee5\u7406\u89e3\u4e3a\u4e0d\u65ad\u5730\u5c06\u524d\u4e00\u4e2a\u65f6\u523b t-1 \u7684\u8f93\u51fa\u4f5c\u4e3a\u540e\u4e00\u4e2a\u65f6\u523b t \u7684\u8f93\u5165\uff0c\u5faa\u73af\u89e3\u7801\uff0c\u76f4\u5230\u8f93\u51fa\u505c\u6b62\u7b26\u4e3a\u6b62\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0cNMT\u89e3\u51b3\u4e86\u4f20\u7edf\u7684\u57fa\u4e8e\u77ed\u8bed\u7684\u65b9\u6cd5\u4e2d\u7684\u5c40\u90e8\u7ffb\u8bd1\u95ee\u9898\uff1a\u5b83\u53ef\u4ee5\u6355\u83b7\u8bed\u8a00\u4e2d\u7684\u957f\u8ddd\u79bb\u4f9d\u8d56\u6027\uff0c\u5e76\u63d0\u4f9b\u66f4\u6d41\u7545\u7684\u7ffb\u8bd1\u3002\u4f46\u662f\u8fd9\u6837\u505a\u4e5f\u5b58\u5728\u5f88\u591a\u7f3a\u70b9\uff0c\u8b6c\u5982\uff0cRNN\u662f\u5065\u5fd8\u7684\uff0c\u8fd9\u610f\u5473\u7740\u524d\u9762\u7684\u4fe1\u606f\u5728\u7ecf\u8fc7\u591a\u4e2a\u65f6\u95f4\u6b65\u9aa4\u4f20\u64ad\u540e\u4f1a\u88ab\u9010\u6e10\u6d88\u5f31\u4e43\u81f3\u6d88\u5931\u3002\u5176\u6b21\uff0c\u5728\u89e3\u7801\u671f\u95f4\u6ca1\u6709\u8fdb\u884c\u5bf9\u9f50\u64cd\u4f5c\uff0c\u56e0\u6b64\u5728\u89e3\u7801\u6bcf\u4e2a\u5143\u7d20\u7684\u8fc7\u7a0b\u4e2d\uff0c\u7126\u70b9\u5206\u6563\u5728\u6574\u4e2a\u5e8f\u5217\u4e2d\u3002\u5bf9\u4e8e\u524d\u9762\u90a3\u4e2a\u95ee\u9898\uff0cLSTM\u3001GRU\u5728\u4e00\u5b9a\u7a0b\u5ea6\u80fd\u591f\u7f13\u89e3\u3002\u800c\u540e\u8005\u6b63\u662fBahdanau\u7b49\u4eba\u91cd\u89c6\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<h3><strong>\u00a02\u3001NLP\u4e2dAttention mechanism\u7684\u8d77\u6e90<\/strong><\/h3>\n\n\n\n<p>\u5728Seq2Seq\u7ed3\u6784\u4e2d\uff0cencoder\u628a\u6240\u6709\u7684\u8f93\u5165\u5e8f\u5217\u90fd\u7f16\u7801\u6210\u4e00\u4e2a\u7edf\u4e00\u7684\u8bed\u4e49\u5411\u91cfcontext\uff0c\u7136\u540e\u518d\u7531decoder\u89e3\u7801\u3002\u800ccontext\u81ea\u7136\u4e5f\u5c31\u6210\u4e86\u9650\u5236\u6a21\u578b\u6027\u80fd\u7684\u74f6\u9888\u3002\u8b6c\u5982\u673a\u5668\u7ffb\u8bd1\u95ee\u9898\uff0c\u5f53\u8981\u7ffb\u8bd1\u7684\u53e5\u5b50\u8f83\u957f\u65f6\uff0c\u4e00\u4e2acontext\u53ef\u80fd\u5b58\u4e0d\u4e0b\u90a3\u4e48\u591a\u4fe1\u606f\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u53ea\u7528\u7f16\u7801\u5668\u7684\u6700\u540e\u4e00\u4e2a\u9690\u85cf\u5c42\u72b6\u6001\uff0c\u611f\u89c9\u4e0a\u90fd\u4e0d\u662f\u5f88\u5408\u7406\u3002\u5b9e\u9645\u4e0a\u5f53\u6211\u4eec\u7ffb\u8bd1\u7684\u65f6\u5019\u8b6c\u5982\uff1aSource:\u673a\u5668\u5b66\u4e60&#8211;>Target:machine learning\u3002\u5f53decoder\u8981\u751f\u6210&#8221;machine&#8221;\u7684\u65f6\u5019\uff0c\u5e94\u8be5\u66f4\u5173\u6ce8&#8221;\u673a\u5668&#8221;\uff0c\u800c\u751f\u6210&#8221;learning&#8221;\u7684\u65f6\u5019\uff0c\u5e94\u8be5\u7ed9\u4e88&#8221;\u5b66\u4e60&#8221;\u66f4\u5927\u7684\u6743\u91cd\u3002\u6240\u4ee5\u5982\u679c\u8981\u6539\u8fdbSeq2Seq\u7ed3\u6784\uff0c\u4e00\u4e2a\u4e0d\u9519\u7684\u60f3\u6cd5\u81ea\u7136\u5c31\u662f\u5229\u7528encoder\u6240\u6709\u9690\u85cf\u5c42\u72b6\u6001\u89e3\u51b3context\u9650\u5236\u95ee\u9898\u3002<\/p>\n\n\n\n<p>Bahdanau\u7b49\u4eba\u628aattention\u673a\u5236\u7528\u5230\u4e86\u795e\u7ecf\u7f51\u7edc\u673a\u5668\u7ffb\u8bd1\uff08NMT\uff09\u4e0a\u3002\u4f20\u7edf\u7684encoder-decoder\u6a21\u578b\u901a\u8fc7encoder\u5c06Source\u5e8f\u5217\u7f16\u7801\u5230\u4e00\u4e2a\u56fa\u5b9a\u7ef4\u5ea6\u7684\u4e2d\u95f4\u8bed\u4e49\u5411\u91cfcontext\uff0c\u7136\u540e\u5728\u4f7f\u7528decoder\u8fdb\u884c\u89e3\u7801\u7ffb\u8bd1\u5230\u76ee\u6807\u8bed\u8a00\u5e8f\u5217\u3002\u524d\u9762\u8c08\u5230\u4e86\u8fd9\u79cd\u505a\u6cd5\u7684\u5c40\u9650\u6027\uff0c\u800c\u4e14\uff0cBahdanau\u7b49\u4eba\u5728\u6458\u8981\u4e5f\u8bf4\u5230\u8fd9\u4e2acontext\u53ef\u80fd\u662f\u63d0\u9ad8\u8fd9\u79cd\u57fa\u672c\u7f16\u7801\u5668 &#8211; \u89e3\u7801\u5668\u67b6\u6784\u6027\u80fd\u7684\u74f6\u9888\uff0c\u90a3Bahdanau\u7b49\u4eba\u53c8\u662f\u5982\u4f55\u5c1d\u8bd5\u7f13\u89e3\u8fd9\u4e2a\u95ee\u9898\u7684\u5462\uff1f\u8ba9\u6211\u4eec\u6765\u4e00\u63a2\u7a76\u7adf\uff0c\u4f5c\u8005\u4e3a\u4e86\u7f13\u89e3\u4e2d\u95f4\u5411\u91cfcontext\u5f88\u96be\u5c06Source\u5e8f\u5217\u6240\u6709\u5fc5\u8981\u4fe1\u606f\u538b\u7f29\u8fdb\u6765\u7684\u95ee\u9898\uff0c\u7279\u522b\u662f\u5bf9\u4e8e\u90a3\u4e9b\u5f88\u957f\u7684\u53e5\u5b50\u3002\u63d0\u51fa\u5728\u673a\u5668\u7ffb\u8bd1\u4efb\u52a1\u4e0a\u5728 encoder\u2013decoder \u505a\u51fa\u4e86\u5982\u4e0b\u6269\u5c55\uff1a\u5c06\u7ffb\u8bd1\u548c\u5bf9\u9f50\u8054\u5408\u5b66\u4e60\u3002\u8fd9\u4e2a\u64cd\u4f5c\u5728\u751f\u6210Target\u5e8f\u5217\u7684\u6bcf\u4e2a\u8bcd\u65f6\uff0c\u7528\u5230\u7684\u4e2d\u95f4\u8bed\u4e49\u5411\u91cfcontext\u662fSource\u5e8f\u5217\u901a\u8fc7encoder\u7684\u9690\u85cf\u5c42\u7684\u52a0\u6743\u548c\uff0c\u800c\u4f20\u7edf\u7684\u505a\u6cd5\u662f\u53ea\u7528encoder\u6700\u540e\u4e00\u4e2a\u8f93\u51fa\u00a0ht\u00a0\u4f5c\u4e3acontext\uff0c\u8fd9\u6837\u5c31\u80fd\u4fdd\u8bc1\u5728\u89e3\u7801\u4e0d\u540c\u8bcd\u7684\u65f6\u5019\uff0cSource\u5e8f\u5217\u5bf9\u73b0\u5728\u89e3\u7801\u8bcd\u7684\u8d21\u732e\u662f\u4e0d\u4e00\u6837\u7684\u3002\u60f3\u60f3\u524d\u9762\u90a3\u4e2a\u4f8b\u5b50\uff1a&#8221;Source:\u673a\u5668\u5b66\u4e60&#8211;>Target:machine learning&#8221;(\u5047\u5982\u4e2d\u6587\u6309\u7167\u5b57\u5207\u5206)\u3002decoder\u5728\u89e3\u7801&#8221;machine&#8221;\u65f6\uff0c&#8221;\u673a&#8221;\u548c&#8221;\u5668&#8221;\u63d0\u4f9b\u7684\u6743\u91cd\u8981\u66f4\u5927\u4e00\u4e9b\uff0c\u540c\u6837\uff0c\u5728\u89e3\u7801&#8221;learning&#8221;\u65f6\uff0c&#8221;\u5b66&#8221;\u548c&#8221;\u4e60&#8221;\u63d0\u4f9b\u7684\u6743\u91cd\u76f8\u5e94\u7684\u4f1a\u66f4\u5927\u4e00\u4e9b\uff0c\u8fd9\u5728\u76f4\u89c9\u4e5f\u548c\u4eba\u7c7b\u7ffb\u8bd1\u4e5f\u662f\u4e00\u81f4\u7684\u3002\u901a\u8fc7\u8fd9\u79cdattention\u7684\u8bbe\u8ba1\uff0c\u4f5c\u8005\u5c06Source\u5e8f\u5217\u7684\u6bcf\u4e2a\u8bcd(\u901a\u8fc7encoder\u7684\u9690\u85cf\u5c42\u8f93\u51fa)\u548cTarget\u5e8f\u5217(\u5f53\u524d\u8981\u7ffb\u8bd1\u7684\u8bcd)\u7684\u6bcf\u4e2a\u8bcd\u5de7\u5999\u7684\u5efa\u7acb\u4e86\u8054\u7cfb\u3002\u60f3\u4e00\u60f3\uff0c\u7ffb\u8bd1\u6bcf\u4e2a\u8bcd\u7684\u65f6\u5019\uff0c\u90fd\u6709\u4e00\u4e2a\u8bed\u4e49\u5411\u91cf\uff0c\u800c\u8fd9\u4e2a\u8bed\u4e49\u5411\u91cf\u662fSource\u5e8f\u5217\u6bcf\u4e2a\u8bcd\u901a\u8fc7encoder\u4e4b\u540e\u7684\u9690\u85cf\u5c42\u7684\u52a0\u6743\u548c\u3002 \u7531\u6b64\u53ef\u4ee5\u5f97\u5230\u4e00\u4e2aSource\u5e8f\u5217\u548cTarget\u5e8f\u5217\u7684\u5bf9\u9f50\u77e9\u9635\uff0c\u901a\u8fc7\u53ef\u89c6\u5316\u8fd9\u4e2a\u77e9\u9635\uff0c\u53ef\u4ee5\u770b\u51fa\u5728\u7ffb\u8bd1\u4e00\u4e2a\u8bcd\u7684\u65f6\u5019\uff0cSource\u5e8f\u5217\u7684\u6bcf\u4e2a\u8bcd\u5bf9\u5f53\u524d\u8981\u7ffb\u8bd1\u8bcd\u7684\u91cd\u8981\u6027\u5206\u5e03\uff0c\u8fd9\u5728\u76f4\u89c9\u4e0a\u4e5f\u80fd\u7ed9\u4eba\u4e00\u79cd\u53ef\u89e3\u91ca\u6027\u7684\u611f\u89c9\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"474\" height=\"579\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-20.png\" alt=\"\" class=\"wp-image-8863\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-20.png 474w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-20-246x300.png 246w\" sizes=\"(max-width: 474px) 100vw, 474px\" \/><\/figure><\/div>\n\n\n\n<h3><strong>3. NLP\u4e2d\u7684\u6ce8\u610f\u529b\u673a\u5236<\/strong><\/h3>\n\n\n\n<p>       \u968f\u7740\u6ce8\u610f\u529b\u673a\u5236\u7684\u5e7f\u6cdb\u5e94\u7528\uff0c\u5728\u67d0\u79cd\u7a0b\u5ea6\u4e0a\u7f13\u89e3\u4e86\u6e90\u5e8f\u5217\u548c\u76ee\u6807\u5e8f\u5217\u7531\u4e8e\u8ddd\u79bb\u9650\u5236\u800c\u96be\u4ee5\u5efa\u6a21\u4f9d\u8d56\u5173\u7cfb\u7684\u95ee\u9898\u3002\u73b0\u5728\u5df2\u7ecf\u6d8c\u73b0\u51fa\u4e86\u4e00\u5927\u6279\u57fa\u4e8e\u57fa\u672c\u5f62\u5f0f\u7684\u6ce8\u610f\u529b\u7684\u4e0d\u540c\u53d8\u4f53\u6765\u5904\u7406\u66f4\u590d\u6742\u7684\u4efb\u52a1\u3002\u8ba9\u6211\u4eec\u4e00\u8d77\u6765\u770b\u770b\u5176\u5728\u4e0d\u540cNLP\u95ee\u9898\u4e2d\u7684\u6ce8\u610f\u529b\u673a\u5236\u3002<\/p>\n\n\n\n<p>\u5176\u5b9e\u6211\u4eec\u53ef\u80fd\u5df2\u7ecf\u610f\u8bc6\u5230\u4e86\uff0c\u5bf9\u9f50\u6a21\u578b\u7684\u8bbe\u8ba1\u4e0d\u662f\u552f\u4e00\u7684\uff0c\u786e\u5b9e\uff0c\u5728\u67d0\u79cd\u610f\u4e49\u4e0a\u8bf4\uff0c\u6839\u636e\u4e0d\u540c\u7684\u4efb\u52a1\u8bbe\u8ba1\u9002\u5e94\u4e8e\u7279\u5b9a\u4efb\u52a1\u7684\u5bf9\u9f50\u6a21\u578b\u53ef\u4ee5\u770b\u4f5c\u8bbe\u8ba1\u51fa\u4e86\u65b0\u7684attention\u53d8\u4f53\uff0c\u8ba9\u6211\u4eec\u518d\u770b\u770b\u8fd9\u4e2a\u6a21\u578b(\u51fd\u6570)\uff1a\u00a0score(st,hi)\u00a0\u3002\u518d\u6765\u770b\u51e0\u4e2a\u4ee3\u8868\u6027\u7684work\u3002<\/p>\n\n\n\n<p>Citation\u7b49\u4eba\u63d0\u51faContent-base attention\uff0c\u5176\u5bf9\u9f50\u51fd\u6570\u6a21\u578b\u8bbe\u8ba1\u4e3a\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-21.png\" alt=\"\" class=\"wp-image-8867\" width=\"284\" height=\"30\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-21.png 464w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-21-300x32.png 300w\" sizes=\"(max-width: 284px) 100vw, 284px\" \/><\/figure><\/div>\n\n\n\n<p>Bahdanau\u7b49\u4eba\u7684Additive(*)\uff0c\u5176\u8bbe\u8ba1\u4e3a\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-22.png\" alt=\"\" class=\"wp-image-8869\" width=\"343\" height=\"23\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-22.png 552w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-22-300x20.png 300w\" sizes=\"(max-width: 343px) 100vw, 343px\" \/><\/figure><\/div>\n\n\n\n<p>Luong[4]\u7b49\u4eba\u6587\u732e\u5305\u542b\u4e86\u51e0\u79cd\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"233\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-23-1024x233.png\" alt=\"\" class=\"wp-image-8870\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-23-1024x233.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-23-300x68.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-23-768x174.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-23.png 1140w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4ee5\u53caLuong\u7b49\u4eba\u8fd8\u5c1d\u8bd5\u8fc7location-based function\u3002\u8fd9\u79cd\u65b9\u6cd5\u7684\u5bf9\u9f50\u5206\u6570\u4ec5\u4ece\u76ee\u6807\u9690\u85cf\u72b6\u6001\u5b66\u4e60\u5f97\u5230\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-24.png\" alt=\"\" class=\"wp-image-8872\" width=\"217\" height=\"26\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-24.png 350w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-24-300x36.png 300w\" sizes=\"(max-width: 217px) 100vw, 217px\" \/><\/figure><\/div>\n\n\n\n<ul><li>Vaswani[6]\u7b49\u4eba\u7684Scaled Dot-Product(^)\u7f29\u653e\u70b9\u79ef\u6ce8\u610f\uff1a<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-25.png\" alt=\"\" class=\"wp-image-8873\" width=\"170\" height=\"38\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-25.png 326w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-25-300x67.png 300w\" sizes=\"(max-width: 170px) 100vw, 170px\" \/><\/figure><\/div>\n\n\n\n<p>\u7ec6\u5fc3\u7684\u7ae5\u978b\u53ef\u80fd\u65e9\u5c31\u53d1\u73b0\u4e86\u8fd9\u4e1c\u4e1c\u548c\u70b9\u79ef\u6ce8\u610f\u529b\u5f88\u50cf\uff0c\u53ea\u662f\u52a0\u4e86\u4e2ascale factor\u3002\u5f53\u8f93\u5165\u8f83\u5927\u65f6\uff0csoftmax\u51fd\u6570\u53ef\u80fd\u5177\u6709\u6781\u5c0f\u7684\u68af\u5ea6\uff0c\u96be\u4ee5\u6709\u6548\u5b66\u4e60\uff0c\u6240\u4ee5\u4f5c\u8005\u52a0\u5165\u6bd4\u4f8b\u56e0\u5b50\u00a01\/n\u00a0\u3002<\/p>\n\n\n\n<p>Cheng[7]\u7b49\u4eba\u7684Self-Attention(&amp;)\u53ef\u4ee5\u5173\u8054\u76f8\u540c\u8f93\u5165\u5e8f\u5217\u7684\u4e0d\u540c\u4f4d\u7f6e\u3002 \u4ece\u7406\u8bba\u4e0a\u8bb2\uff0cSelf-Attention\u53ef\u4ee5\u91c7\u7528\u4e0a\u9762\u7684\u4efb\u4f55<strong> score functions<\/strong>\u3002\u5728\u4e00\u4e9b\u6587\u7ae0\u4e2d\u4e5f\u79f0\u4e3a\u201cintra-attention\u201d\u00a0<\/p>\n\n\n\n<p>Hu[7]\u5bf9\u6b64\u5206\u4e86\u4e2a\u7c7b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/pic3.zhimg.com\/80\/v2-06c6d7c1d09a60a6b8e5932d5a43e052_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<p>      \u524d\u9762\u8c08\u5230\u7684\u4e00\u4e9bBasic Attention\u7ed9\u4eba\u7684\u611f\u89c9\u80fd\u591f\u4ece\u5e8f\u5217\u4e2d\u6839\u636e\u6743\u91cd\u5206\u5e03\u63d0\u53d6\u91cd\u8981\u5143\u7d20\u3002\u800cMulti-dimensional Attention\u80fd\u591f\u6355\u83b7\u4e0d\u540c\u8868\u793a\u7a7a\u95f4\u4e2d\u7684term\u4e4b\u95f4\u7684\u591a\u4e2a\u4ea4\u4e92\uff0c\u8fd9\u4e00\u70b9\u7b80\u5355\u7684\u5b9e\u73b0\u53ef\u4ee5\u901a\u8fc7\u76f4\u63a5\u5c06\u591a\u4e2a\u5355\u7ef4\u8868\u793a\u5806\u53e0\u5728\u4e00\u8d77\u6784\u5efa\u3002Wang[8]\u7b49\u4eba\u63d0\u51fa\u4e86coupled multi-layer attentions\uff0c\u8be5\u6a21\u578b\u5c5e\u4e8e\u591a\u5c42\u6ce8\u610f\u529b\u7f51\u7edc\u6a21\u578b\u3002\u4f5c\u8005\u79f0\uff0c\u901a\u8fc7\u8fd9\u79cd\u591a\u5c42\u65b9\u5f0f\uff0c\u8be5\u6a21\u578b\u53ef\u4ee5\u8fdb\u4e00\u6b65\u5229\u7528\u672f\u8bed\u4e4b\u95f4\u7684\u95f4\u63a5\u5173\u7cfb\uff0c\u4ee5\u83b7\u5f97\u66f4\u7cbe\u786e\u7684\u4fe1\u606f\u3002<\/p>\n\n\n\n<h4>3.<strong>1 Hierarchical\uff08\u5c42\u6b21\uff09 Attention<\/strong><\/h4>\n\n\n\n<p>\u518d\u6765\u770b\u770bHierarchical Attention\uff0cYang[9]\u7b49\u4eba\u63d0\u51fa\u4e86Hierarchical Attention Networks\uff0c\u770b\u4e0b\u9762\u7684\u56fe\u53ef\u80fd\u4f1a\u66f4\u76f4\u89c2\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img src=\"https:\/\/pic4.zhimg.com\/80\/v2-209fe30a2fb427f7e47e5b864d370b83_1440w.webp\" alt=\"\"\/><\/figure><\/div>\n\n\n\n<p>Hierarchical Attention Networks<\/p>\n\n\n\n<p>\u8fd9\u79cd\u7ed3\u6784\u80fd\u591f\u53cd\u6620\u6587\u6863\u7684\u5c42\u6b21\u7ed3\u6784\u3002\u6a21\u578b\u5728\u5355\u8bcd\u548c\u53e5\u5b50\u7ea7\u522b\u5206\u522b\u8bbe\u8ba1\u4e86\u4e24\u4e2a\u4e0d\u540c\u7ea7\u522b\u7684\u6ce8\u610f\u529b\u673a\u5236\uff0c\u8fd9\u6837\u505a\u80fd\u591f\u5728\u6784\u5efa\u6587\u6863\u8868\u793a\u65f6\u533a\u522b\u5730\u5bf9\u5f85\u8fd9\u4e9b\u5185\u5bb9\u3002Hierarchical attention\u53ef\u4ee5\u76f8\u5e94\u5730\u6784\u5efa\u5206\u5c42\u6ce8\u610f\u529b\uff0c\u81ea\u4e0b\u800c\u4e0a\uff08\u5373\uff0c\u8bcd\u7ea7\u5230\u53e5\u5b50\u7ea7\uff09\u6216\u81ea\u4e0a\u800c\u4e0b\uff08\u8bcd\u7ea7\u5230\u5b57\u7b26\u7ea7\uff09\uff0c\u4ee5\u63d0\u53d6\u5168\u5c40\u548c\u672c\u5730\u7684\u91cd\u8981\u4fe1\u606f\u3002\u81ea\u4e0b\u800c\u4e0a\u7684\u65b9\u6cd5\u4e0a\u9762\u521a\u8c08\u5b8c\u3002\u90a3\u4e48\u81ea\u4e0a\u800c\u4e0b\u53c8\u662f\u5982\u4f55\u505a\u7684\u5462\uff1f\u8ba9\u6211\u4eec\u770b\u770bJi[10]\u7b49\u4eba\u7684\u6a21\u578b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img src=\"https:\/\/pic3.zhimg.com\/80\/v2-60fa6627bcdd2d95c8a0a51750c0ca6e_1440w.webp\" alt=\"\"\/><\/figure><\/div>\n\n\n\n<p>Nested Attention Hybrid Model<\/p>\n\n\n\n<p>\u548c\u673a\u5668\u7ffb\u8bd1\u7c7b\u4f3c\uff0c\u4f5c\u8005\u4f9d\u65e7\u91c7\u7528encoder-decoder\u67b6\u6784\uff0c\u7136\u540e\u7528word-level attention\u5bf9\u5168\u5c40\u8bed\u6cd5\u548c\u6d41\u7545\u6027\u7ea0\u9519\uff0c\u8bbe\u8ba1character-level attention\u5bf9\u672c\u5730\u62fc\u5199\u9519\u8bef\u7ea0\u6b63\u3002<\/p>\n\n\n\n<h4>3.<strong>2 Self-Attention<\/strong><\/h4>\n\n\n\n<p>\u90a3Self-Attention\u53c8\u662f\u6307\u4ec0\u4e48\u5462\uff1f<\/p>\n\n\n\n<p>Self-Attention(\u81ea\u6ce8\u610f\u529b)\uff0c\u4e5f\u79f0\u4e3a&#8221;intra-attention&#8221;(\u5185\u90e8\u6ce8\u610f\u529b)\uff0c\u662f\u5173\u8054\u5355\u4e2a\u5e8f\u5217\u7684\u4e0d\u540c\u4f4d\u7f6e\u7684\u6ce8\u610f\u529b\u673a\u5236\uff0c\u4ee5\u4fbf\u8ba1\u7b97\u5e8f\u5217\u7684\u4ea4\u4e92\u8868\u793a\u3002 \u5b83\u5df2\u88ab\u8bc1\u660e\u5728\u5f88\u591a\u9886\u57df\u5341\u5206\u6709\u6548\u6bd4\u5982\u673a\u5668\u9605\u8bfb\uff0c\u6587\u672c\u6458\u8981\u6216\u56fe\u50cf\u63cf\u8ff0\u751f\u6210\u3002<\/p>\n\n\n\n<ul><li>\u6bd4\u5982Cheng[11]\u7b49\u4eba\u5728\u673a\u5668\u9605\u8bfb\u91cc\u9762\u5229\u7528\u4e86\u81ea\u6ce8\u610f\u529b\u3002\u5f53\u524d\u5355\u8bcd\u4e3a\u7ea2\u8272\uff0c\u84dd\u8272\u9634\u5f71\u7684\u5927\u5c0f\u8868\u793a\u6fc0\u6d3b\u7a0b\u5ea6\uff0c\u81ea\u6ce8\u610f\u529b\u673a\u5236\u4f7f\u5f97\u80fd\u591f\u5b66\u4e60\u5f53\u524d\u5355\u8bcd\u548c\u53e5\u5b50\u524d\u4e00\u90e8\u5206\u8bcd\u4e4b\u95f4\u7684\u76f8\u5173\u6027\u3002<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/pic4.zhimg.com\/80\/v2-475dde652791fa701293154022380b4b_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5f53\u524d\u5355\u8bcd\u4e3a\u7ea2\u8272\uff0c\u84dd\u8272\u9634\u5f71\u7684\u5927\u5c0f\u8868\u793a\u6fc0\u6d3b\u7a0b\u5ea6<\/p>\n\n\n\n<ul><li>\u6bd4\u5982Xu[12]\u7b49\u4eba\u5229\u7528\u81ea\u6ce8\u610f\u529b\u5728\u56fe\u50cf\u63cf\u8ff0\u751f\u6210\u4efb\u52a1\u3002\u6ce8\u610f\u529b\u6743\u91cd\u7684\u53ef\u89c6\u5316\u6e05\u695a\u5730\u8868\u660e\u4e86\u6a21\u578b\u5173\u6ce8\u7684\u56fe\u50cf\u7684\u54ea\u4e9b\u533a\u57df\u4ee5\u4fbf\u8f93\u51fa\u67d0\u4e2a\u5355\u8bcd\u3002<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/pic3.zhimg.com\/80\/v2-0b71c13b145da7f94fffbe844a4b57de_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u6211\u4eec\u5047\u8bbe\u5e8f\u5217\u5143\u7d20\u4e3a&nbsp;V=vi&nbsp;\uff0c\u5176\u5339\u914d\u5411\u91cf\u4e3a&nbsp;u&nbsp;\u3002\u8ba9\u6211\u4eec\u518d\u6765\u56de\u987e\u4e0b\u524d\u9762\u8bf4\u7684\u57fa\u672c\u6ce8\u610f\u529b\u7684\u5bf9\u9f50\u51fd\u6570\uff0cattention score\u901a\u8fc7&nbsp;a(u,vi)&nbsp;\u8ba1\u7b97\u5f97\u5230\uff0c\u7531\u4e8e\u662f\u901a\u8fc7\u5c06\u5916\u90e8&nbsp;u&nbsp;\u4e0e\u6bcf\u4e2a\u5143\u7d20&nbsp;vi&nbsp;\u5339\u914d\u6765\u8ba1\u7b97\u6ce8\u610f\u529b\uff0c\u6240\u4ee5\u8fd9\u79cd\u5f62\u5f0f\u53ef\u4ee5\u770b\u4f5c\u662f\u5916\u90e8\u6ce8\u610f\u529b\u3002\u5f53\u6211\u4eec\u628a\u5916\u90e8u\u66ff\u6362\u6210\u5e8f\u5217\u672c\u8eab(\u6216\u90e8\u5206\u672c\u8eab)\uff0c\u8fd9\u79cd\u5f62\u5f0f\u5c31\u53ef\u4ee5\u770b\u4f5c\u4e3a\u5185\u90e8\u6ce8\u610f\u529b(internal attention)\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u6839\u636e\u6587\u7ae0[7]\u4e2d\u7684\u4f8b\u5b50\u6765\u770b\u770b\u8fd9\u4e2a\u8fc7\u7a0b\uff0c\u4f8b\u5982\u53e5\u5b50:&#8221;Volleyball match is in progress between ladies&#8221;\u3002\u53e5\u5b50\u4e2d\u5176\u5b83\u5355\u8bcd\u90fd\u4f9d\u8d56\u7740&#8221;match&#8221;\uff0c\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5e0c\u671b\u4f7f\u7528\u81ea\u6211\u6ce8\u610f\u529b\u6765\u81ea\u52a8\u6355\u83b7\u8fd9\u79cd\u5185\u5728\u4f9d\u8d56\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u81ea\u6ce8\u610f\u529b\u53ef\u4ee5\u89e3\u91ca\u4e3a\uff0c\u6bcf\u4e2a\u5355\u8bcd\u00a0vi\u00a0\u53bb\u548cV\u5e8f\u5217\u4e2d\u7684\u5185\u90e8\u6a21\u5f0f\u00a0v\u2032\u00a0\uff0c\u5339\u914d\u51fd\u6570\u00a0a(v\u2032,vi)\u00a0\u3002\u00a0v\u2032\u00a0\u5f88\u81ea\u7136\u7684\u9009\u62e9\u4e3aV\u4e2d\u5176\u5b83\u5355\u8bcd\u00a0vj\u00a0\uff0c\u8fd9\u6837\u904d\u53ef\u4ee5\u8ba1\u7b97\u6210\u5bf9\u6ce8\u610f\u529b\u5f97\u5206\u3002\u4e3a\u4e86\u5b8c\u5168\u6355\u6349\u5e8f\u5217\u4e2d\u5355\u8bcd\u4e4b\u95f4\u7684\u590d\u6742\u76f8\u4e92\u4f5c\u7528\uff0c\u6211\u4eec\u53ef\u4ee5\u8fdb\u4e00\u6b65\u6269\u5c55\u5b83\u4ee5\u8ba1\u7b97\u5e8f\u5217\u4e2d\u6bcf\u5bf9\u5355\u8bcd\u4e4b\u95f4\u7684\u6ce8\u610f\u529b\u3002\u8fd9\u79cd\u65b9\u5f0f\u8ba9\u6bcf\u4e2a\u5355\u8bcd\u548c\u5e8f\u5217\u4e2d\u5176\u5b83\u5355\u8bcd\u4ea4\u4e92\u4e86\u5173\u7cfb\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/pic2.zhimg.com\/80\/v2-84bb3e6791b0a5b77806826722ef3c55_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u53e6\u4e00\u65b9\u9762\uff0c\u81ea\u6ce8\u610f\u529b\u8fd8\u53ef\u4ee5\u81ea\u9002\u5e94\u65b9\u5f0f\u5b66\u4e60\u590d\u6742\u7684\u4e0a\u4e0b\u6587\u5355\u8bcd\u8868\u793a\u3002\u8b6c\u5982\u7ecf\u5178\u6587\u7ae0\uff1a&#8221;A structured self-attentive sentence embedding&#8221;\u3002\u8fd9\u7bc7\u6587\u7ae0\u63d0\u51fa\u4e86\u4e00\u79cd\u901a\u8fc7\u5f15\u5165\u81ea\u6ce8\u610f\u529b\u673a\u5236\u6765\u63d0\u53d6\u53ef\u89e3\u91ca\u53e5\u5b50\u5d4c\u5165\u7684\u65b0\u6a21\u578b\u3002 \u4f7f\u7528\u4e8c\u7ef4\u77e9\u9635\u800c\u4e0d\u662f\u5411\u91cf\u6765\u4ee3\u8868\u5d4c\u5165\uff0c\u77e9\u9635\u7684\u6bcf\u4e00\u884c\u90fd\u5728\u53e5\u5b50\u7684\u4e0d\u540c\u90e8\u5206\uff0c\u60f3\u6df1\u5165\u4e86\u89e3\u7684\u53ef\u4ee5\u53bb\u770b\u770b\u8fd9\u7bc7\u6587\u7ae0\uff0c\u53e6\u5916\uff0c\u6587\u7ae0\u7684\u516c\u5f0f\u611f\u89c9\u771f\u7684\u5f88\u6f02\u4eae\u3002<\/p>\n\n\n\n<p>\u503c\u5f97\u4e00\u63d0\u8fd8\u67092017\u5e74\u8c37\u6b4c\u63d0\u51fa\u7684Transformer[6]\uff0c\u8fd9\u662f\u4e00\u79cd\u65b0\u9896\u7684\u57fa\u4e8e\u6ce8\u610f\u529b\u7684\u673a\u5668\u7ffb\u8bd1\u67b6\u6784\uff0c\u4e5f\u662f\u4e00\u4e2a\u6df7\u5408\u795e\u7ecf\u7f51\u7edc\uff0c\u5177\u6709\u524d\u9988\u5c42\u548c\u81ea\u6ce8\u610f\u5c42\u3002\u8bba\u6587\u7684\u9898\u76ee\u633a\u9738\u6c14\uff1aAttention is All you Need\uff0c\u6beb\u65e0\u7591\u95ee\uff0c\u5b83\u662f2017\u5e74\u6700\u5177\u5f71\u54cd\u529b\u548c\u6700\u6709\u8da3\u7684\u8bba\u6587\u4e4b\u4e00\u3002\u90a3\u8fd9\u7bc7\u6587\u7ae0\u7684Transformer\u7684\u5e90\u5c71\u771f\u9762\u76ee\u5230\u5e95\u662f\u8fd9\u6837\u7684\u5462\uff1f<\/p>\n\n\n\n<p>\u8fd9\u7bc7\u6587\u7ae0\u4e3a\u63d0\u51fa\u8bb8\u591a\u6539\u8fdb\uff0c\u5728\u5b8c\u5168\u629b\u5f03\u4e86RNN\u7684\u60c5\u51b5\u4e0b\u8fdb\u884cseq2seq\u5efa\u6a21\u3002\u63a5\u4e0b\u6765\u4e00\u8d77\u6765\u8be6\u7ec6\u770b\u770b\u5427\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>Key, Value and Query\uff1a<\/strong><\/p>\n\n\n\n<p>\u4f17\u6240\u5468\u77e5\uff0c\u5728NLP\u4efb\u52a1\u4e2d\uff0c\u901a\u5e38\u7684\u5904\u7406\u65b9\u6cd5\u662f\u5148\u5206\u8bcd\uff0c\u7136\u540e\u6bcf\u4e2a\u8bcd\u8f6c\u5316\u4e3a\u5bf9\u5e94\u7684\u8bcd\u5411\u91cf\u3002\u63a5\u7740\u4e00\u822c\u6700\u5e38\u89c1\u7684\u6709\u4e8c\u7c7b\u64cd\u4f5c\uff0c<strong>\u7b2c\u4e00\u7c7b\u662f\u63a5RNN<\/strong>\uff08\u53d8\u4f53LSTM\u3001GRU\u3001SRU\u7b49\uff09\uff0c\u4f46\u662f\u8fd9\u4e00\u7c7b\u65b9\u6cd5\u6ca1\u6709\u6446\u8131\u65f6\u5e8f\u8fd9\u4e2a\u5c40\u9650\uff0c\u4e5f\u5c31\u662f\u8bf4\u65e0\u6cd5\u5e76\u884c\uff0c\u4e5f\u5bfc\u81f4\u4e86\u5728\u5927\u6570\u636e\u96c6\u4e0a\u7684\u901f\u5ea6\u6548\u7387\u95ee\u9898\u3002<strong>\u7b2c\u4e8c\u7c7b\u662f\u63a5CNN\uff0c<\/strong>CNN\u65b9\u4fbf\u5e76\u884c\uff0c\u800c\u4e14\u5bb9\u6613\u6355\u6349\u5230\u4e00\u4e9b\u5168\u5c40\u7684\u7ed3\u6784\u4fe1\u606f\u3002\u5f88\u957f\u4e00\u6bb5\u65f6\u95f4\u90fd\u662f\u4ee5\u4e0a\u4e8c\u79cd\u7684\u6289\u62e9\u4ee5\u53ca\u6539\u9020\uff0c\u77e5\u9053\u8c37\u6b4c\u63d0\u4f9b\u4e86\u7b2c\u4e09\u7c7b\u601d\u8def\uff1a<strong>\u7eaf\u9760\u6ce8\u610f\u529b<\/strong>\uff0c\u4e5f\u5c31\u662f\u73b0\u5728\u8981\u8bb2\u7684\u8fd9\u4e2a\u4e1c\u4e1c\u3002<\/p>\n\n\n\n<p>\u5c06\u8f93\u5165\u5e8f\u5217\u7f16\u7801\u8868\u793a\u89c6\u4e3a\u4e00\u7ec4\u952e\u503c\u5bf9\uff08K\uff0cV\uff09\u4ee5\u53ca\u67e5\u8be2 Q\uff0c\u56e0\u4e3a\u6587\u7ae0\u53d6K=V=Q\uff0c\u6240\u4ee5\u4e5f\u81ea\u7136\u79f0\u4e3aSelf Attention\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"630\" height=\"77\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-26.png\" alt=\"\" class=\"wp-image-8887\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-26.png 630w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-26-300x37.png 300w\" sizes=\"(max-width: 630px) 100vw, 630px\" \/><\/figure>\n\n\n\n<p>K, V\u50cf\u662fkey-value\u7684\u5173\u7cfb\u4ece\u800c\u662f\u4e00\u4e00\u5bf9\u5e94\u7684\uff0c\u90a3\u4e48\u4e0a\u5f0f\u7684\u610f\u601d\u5c31\u662f\u901a\u8fc7Q\u4e2d\u6bcf\u4e2a\u5143\u7d20query\uff0c\u4e0eK\u4e2d\u5404\u4e2a\u5143\u7d20\u6c42\u5185\u79ef\u7136\u540esoftmax\u7684\u65b9\u5f0f\uff0c\u6765\u5f97\u5230Q\u4e2d\u5143\u7d20\u4e0eV\u4e2d\u5143\u7d20\u7684\u76f8\u4f3c\u5ea6\uff0c\u7136\u540e\u52a0\u6743\u6c42\u548c\uff0c\u5f97\u5230\u4e00\u4e2a\u65b0\u7684\u5411\u91cf\u3002\u5176\u4e2d\u56e0\u5b50&nbsp;n&nbsp;\u4e3a\u4e86\u4f7f\u5f97\u5185\u79ef\u4e0d\u81f3\u4e8e\u592a\u5927\u3002\u4ee5\u4e0a\u516c\u5f0f\u5728\u6587\u4e2d\u4e5f\u79f0\u4e3a<strong>\u70b9\u79ef\u6ce8\u610f\u529b(scaled dot-product attention)<\/strong>\uff1a\u8f93\u51fa\u662f\u503c\u7684\u52a0\u6743\u548c\uff0c\u5176\u4e2d\u5206\u914d\u7ed9\u6bcf\u4e2a\u503c\u7684\u6743\u91cd\u7531\u67e5\u8be2\u7684\u70b9\u79ef\u4e0e\u6240\u6709\u952e\u786e\u5b9a<\/p>\n\n\n\n<p>\u800cTransformer\u4e3b\u8981\u7531\u591a\u5934\u81ea\u6ce8\u610f\u529b(Multi-Head Self-Attention)\u5355\u5143\u7ec4\u6210\u3002 \u5728NMT\u7684\u4e0a\u4e0b\u6587\u4e2d\uff0c\u952e\u548c\u503c\u90fd\u662f\u7f16\u7801\u5668\u9690\u85cf\u72b6\u6001\u3002 \u5728\u89e3\u7801\u5668\u4e2d\uff0c\u5148\u524d\u7684\u8f93\u51fa\u88ab\u538b\u7f29\u6210\u67e5\u8be2Q\uff0c\u5e76\u4e14\u901a\u8fc7\u6620\u5c04\u8be5\u67e5\u8be2\u4ee5\u53ca\u8be5\u7ec4\u952e\u548c\u503c\u6765\u4ea7\u751f\u4e0b\u4e00\u4e2a\u8f93\u51fa\u3002<\/p>\n\n\n\n<h4>3.<strong>3 Memory-based Attention<\/strong><\/h4>\n\n\n\n<p>    Memory-based Attention\u53c8\u662f\u4ec0\u4e48\u5462\uff1f\u6211\u4eec\u5148\u6362\u79cd\u65b9\u5f0f\u6765\u770b\u524d\u9762\u7684\u6ce8\u610f\u529b\uff0c\u5047\u8bbe\u6709\u4e00\u7cfb\u5217\u7684\u952e\u503c\u5bf9\u00a0(ki,vi)\u00a0\u5b58\u5728\u5185\u5b58\u4e2d\u548c\u67e5\u8be2\u5411\u91cfq\uff0c\u8fd9\u6837\u4fbf\u80fd\u91cd\u5199\u4e3a\u4ee5\u4e0b\u8fc7\u7a0b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-27.png\" alt=\"\" class=\"wp-image-8891\" width=\"305\" height=\"110\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-27.png 460w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-27-300x108.png 300w\" sizes=\"(max-width: 305px) 100vw, 305px\" \/><\/figure><\/div>\n\n\n\n<p>\u8fd9\u79cd\u89e3\u91ca\u662f\u628a\u6ce8\u610f\u529b\u4f5c\u4e3a\u4f7f\u7528\u67e5\u8be2q\u7684\u5bfb\u5740\u8fc7\u7a0b\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u57fa\u4e8e\u6ce8\u610f\u529b\u5206\u6570\u4ecememory\u4e2d\u8bfb\u53d6\u5185\u5bb9\u3002\u806a\u660e\u7684\u7ae5\u978b\u80af\u5b9a\u5df2\u7ecf\u53d1\u73b0\u4e86\uff0c\u5982\u679c\u6211\u4eec\u5047\u8bbeki=vi&nbsp;\uff0c\u8fd9\u4e0d\u5c31\u662f\u524d\u9762\u8c08\u5230\u7684\u57fa\u7840\u6ce8\u610f\u529b\u4e48\uff1f\u7136\u800c\uff0c\u7531\u4e8e\u7ed3\u5408\u4e86\u989d\u5916\u7684\u51fd\u6570\uff0c\u53ef\u4ee5\u5b9e\u73b0\u53ef\u91cd\u7528\u6027\u548c\u589e\u52a0\u7075\u6d3b\u6027\uff0c\u6240\u4ee5Memory-based attention mechanism\u53ef\u4ee5\u8bbe\u8ba1\u5f97\u66f4\u52a0\u5f3a\u5927\u3002<\/p>\n\n\n\n<p>\u90a3\u4e3a\u4ec0\u4e48\u53c8\u8981\u8fd9\u6837\u505a\u5462\uff1f\u5728nlp\u7684\u4e00\u4e9b\u4efb\u52a1\u4e0a\u6bd4\u5982\u95ee\u7b54\u5339\u914d\u4efb\u52a1\uff0c\u7b54\u6848\u5f80\u5f80\u4e0e\u95ee\u9898\u95f4\u63a5\u76f8\u5173\uff0c\u56e0\u6b64\u57fa\u672c\u7684\u6ce8\u610f\u529b\u6280\u672f\u5c31\u663e\u5f97\u5f88\u65e0\u529b\u4e86\u3002\u90a3\u5904\u7406\u8fd9\u4e00\u4efb\u52a1\u8be5\u5982\u4f55\u505a\u624d\u597d\u5462\uff1f\u8fd9\u4e2a\u65f6\u5019\u5c31\u4f53\u73b0\u4e86Memory-based attention mechanism\u7684\u5f3a\u5927\u4e86\uff0c\u8b6c\u5982Sukhbaatar[18]\u7b49\u4eba\u901a\u8fc7\u8fed\u4ee3\u5185\u5b58\u66f4\u65b0\uff08\u4e5f\u79f0\u4e3a\u591a\u8df3\uff09\u6765\u6a21\u62df\u65f6\u95f4\u63a8\u7406\u8fc7\u7a0b\uff0c\u4ee5\u9010\u6b65\u5f15\u5bfc\u6ce8\u610f\u5230\u7b54\u6848\u7684\u6b63\u786e\u4f4d\u7f6e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/pic2.zhimg.com\/80\/v2-5023e249482dee20b631bd9b2a40abf5_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5728\u6bcf\u6b21\u8fed\u4ee3\u4e2d\uff0c\u4f7f\u7528\u65b0\u5185\u5bb9\u66f4\u65b0\u67e5\u8be2\uff0c\u5e76\u4e14\u4f7f\u7528\u66f4\u65b0\u7684\u67e5\u8be2\u6765\u68c0\u7d22\u76f8\u5173\u5185\u5bb9\u3002\u4e00\u79cd\u7b80\u5355\u7684\u66f4\u65b0\u65b9\u6cd5\u4e3a\u76f8\u52a0&nbsp;qt+1=qt+ct&nbsp;\u3002\u90a3\u4e48\u8fd8\u6709\u5176\u5b83\u66f4\u65b0\u65b9\u6cd5\u4e48\uff1f\u5f53\u7136\u6709\uff0c\u76f4\u89c9\u654f\u611f\u7684\u7ae5\u978b\u80af\u5b9a\u60f3\u5230\u4e86\uff0c\u5149\u662f\u8fd9\u4e00\u70b9\uff0c\u5c31\u53ef\u4ee5\u6839\u636e\u7279\u5b9a\u4efb\u52a1\u53bb\u8bbe\u8ba1\uff0c\u6bd4\u5982Kuma[13]\u7b49\u4eba\u7684\u5de5\u4f5c\u3002\u8fd9\u79cd\u65b9\u5f0f\u7684\u7075\u6d3b\u5ea6\u4e5f\u4f53\u73b0\u5728key\u548cvalue\u53ef\u4ee5\u81ea\u7531\u7684\u88ab\u8bbe\u8ba1\uff0c\u6bd4\u5982\u6211\u4eec\u53ef\u4ee5\u81ea\u7531\u5730\u5c06\u5148\u9a8c\u77e5\u8bc6\u7ed3\u5408\u5230key\u548cvalue\u5d4c\u5165\u4e2d\uff0c\u4ee5\u5141\u8bb8\u5b83\u4eec\u5206\u522b\u66f4\u597d\u5730\u6355\u83b7\u76f8\u5173\u4fe1\u606f\u3002\u770b\u5230\u8fd9\u91cc\u662f\u4e0d\u662f\u89c9\u5f97\u6587\u7ae0\u704c\u6c34\u5176\u5b9e\u4e5f\u4e0d\u662f\u4ec0\u4e48\u96be\u4e8b\u4e86\u3002<\/p>\n\n\n\n<h4>3.<strong>4 Soft\/Hard Attention<\/strong><\/h4>\n\n\n\n<p>\u8fd9\u4e2a\u6982\u5ff5\u7531\u300aShow, Attend and Tell: Neural Image Caption Generation with Visual Attention\u300b\u63d0\u51fa\uff0c\u8fd9\u662f\u5bf9attention\u53e6\u4e00\u79cd\u5206\u7c7b\u3002SoftAttention\u672c\u8d28\u4e0a\u548cBahdanau\u7b49\u4eba[3]\u5f88\u76f8\u4f3c\uff0c\u5176\u6743\u91cd\u53d6\u503c\u57280\u52301\u4e4b\u95f4\uff0c\u800cHard Attention\u53d6\u503c\u4e3a0\u6216\u80051\u3002<\/p>\n\n\n\n<h4>3.<strong>5 Global\/Local Attention<\/strong><\/h4>\n\n\n\n<p>Luong\u7b49\u4eba[4]\u63d0\u51fa\u4e86Global Attention\u548cLocal Attention\u3002Global Attention\u672c\u8d28\u4e0a\u548cBahdanau\u7b49\u4eba[3]\u5f88\u76f8\u4f3c\u3002Global\u65b9\u6cd5\u987e\u540d\u601d\u4e49\u5c31\u662f\u4f1a\u5173\u6ce8\u6e90\u53e5\u5b50\u5e8f\u5217\u7684\u6240\u6709\u8bcd\uff0c\u5177\u4f53\u5730\u8bf4\uff0c\u5728\u8ba1\u7b97\u8bed\u4e49\u5411\u91cf\u65f6\uff0c\u4f1a\u8003\u8651\u7f16\u7801\u5668\u6240\u6709\u7684\u9690\u85cf\u72b6\u6001\u3002\u800c\u5728Local Attention\u4e2d\uff0c\u8ba1\u7b97\u8bed\u4e49\u5411\u91cf\u65f6\u53ea\u5173\u6ce8\u6bcf\u4e2a\u76ee\u6807\u8bcd\u7684\u4e00\u90e8\u5206\u7f16\u7801\u5668\u9690\u85cf\u72b6\u6001\u3002\u7531\u4e8eGlobal\u65b9\u6cd5\u5fc5\u987b\u8ba1\u7b97\u6e90\u53e5\u5b50\u5e8f\u5217\u6240\u6709\u9690\u85cf\u72b6\u6001\uff0c\u5f53\u53e5\u5b50\u957f\u5ea6\u8fc7\u957f\u4f1a\u4f7f\u5f97\u8ba1\u7b97\u4ee3\u4ef7\u6602\u8d35\u5e76\u4f7f\u5f97\u7ffb\u8bd1\u53d8\u5f97\u4e0d\u592a\u5b9e\u9645\uff0c\u6bd4\u5982\u5728\u7ffb\u8bd1\u6bb5\u843d\u548c\u6587\u6863\u7684\u65f6\u5019\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/pic4.zhimg.com\/80\/v2-89ef00ac63aec92c64786a0e0baa282f_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<h3><strong> \u53c2\u8003\u6587\u732e<\/strong><\/h3>\n\n\n\n<p>[1]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/lilianweng.github.io\/lil-log\/2018\/06\/24\/attention-attention.html\" target=\"_blank\" rel=\"noreferrer noopener\">Attention? Attention!<\/a>.<\/p>\n\n\n\n<p>[2]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/tensorflow\/nmt\" target=\"_blank\" rel=\"noreferrer noopener\">Neural Machine Translation (seq2seq) Tutorial<\/a>.<\/p>\n\n\n\n<p>[3]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1409.0473.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Neural Machine Translation by Jointly Learning to Align and Translate,<\/a>&nbsp;Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. ICLR, 2015.<\/p>\n\n\n\n<p>[4]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1508.04025.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Effective approaches to attention-based neural machine translation,<\/a>&nbsp;Minh-Thang Luong, Hieu Pham, and Christopher D Manning. EMNLP, 2015.<\/p>\n\n\n\n<p>[5]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1410.5401.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Neural Turing Machines,<\/a>&nbsp;Alex Graves, Greg Wayne and Ivo Danihelka. 2014.<\/p>\n\n\n\n<p>[6]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/papers.nips.cc\/paper\/7181-attention-is-all-you-need.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Attention Is All You Need,<\/a>&nbsp;Ashish Vaswani, et al. NIPS, 2017.<\/p>\n\n\n\n<p>[7]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1811.05544.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">An Introductory Survey on Attention Mechanisms in NLP Problems<\/a>&nbsp;Dichao Hu, 2018.<\/p>\n\n\n\n<p>[8]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.aaai.org\/ocs\/index.php\/AAAI\/AAAI17\/paper\/download\/14441\/14256\" target=\"_blank\" rel=\"noreferrer noopener\">Coupled Multi-Layer Attentions for Co-Extraction of Aspect and Opinion Terms<\/a>&nbsp;Wenya Wang,Sinno Jialin Pan, Daniel Dahlmeier and Xiaokui Xiao. AAAI, 2017.<\/p>\n\n\n\n<p>[9]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.aclweb.org\/anthology\/N16-1174\" target=\"_blank\" rel=\"noreferrer noopener\">Hierarchical attention networks for document classification<\/a>&nbsp;Zichao Yang et al. ACL, 2016.<\/p>\n\n\n\n<p>[10]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1707.02026.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">A Nested Attention Neural Hybrid Model for Grammatical Error Correction<\/a>&nbsp;Jianshu Ji et al. 2017.<\/p>\n\n\n\n<p>[11]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1601.06733.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Long Short-Term Memory-Networks for Machine Reading&nbsp;<\/a>Jianpeng Cheng, Li Dong and Mirella Lapata. EMNLP, 2016.<\/p>\n\n\n\n<p>[12]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/proceedings.mlr.press\/v37\/xuc15.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Show, Attend and Tell: Neural Image Caption Generation with Visual Attention<\/a>&nbsp;Kelvin Xu et al. JMLR, 2015.<\/p>\n\n\n\n<p>[13]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/proceedings.mlr.press\/v48\/kumar16.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Ask me anything: Dynamic memory networks for natural language processing.<\/a>&nbsp;Zhouhan Lin al. JMLR, 2016.<\/p>\n\n\n\n<p>[14]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1703.03130.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">A structured self-attentive sentence embedding<\/a>&nbsp;Zhouhan Lin al. ICLR, 2017.<\/p>\n\n\n\n<p>[15]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1609.09189.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Learning Sentence Representation with Guidance of Human Attention<\/a>&nbsp;Shaonan Wang , Jiajun Zhang, Chengqing Zong. IJCAI, 2017.<\/p>\n\n\n\n<p>[16]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1409.3215.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Sequence to Sequence Learning with Neural Networks<\/a>&nbsp;Ilya Sutskever et al. 2014.<\/p>\n\n\n\n<p>[17]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1406.1078.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Learning Phrase Representations using RNN Encoder\u2013Decoder for Statistical Machine Translation<\/a>&nbsp;Kyunghyun Cho, Yoshua Bengio et al. EMNLP, 2014.<\/p>\n\n\n\n<p>[18]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/arxiv.org\/pdf\/1503.08895.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">End-To-End Memory Networks<\/a>&nbsp;Sainbayar Sukhbaatar et al. NIPS, 2015.<\/p>\n\n\n\n<p>[19]&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/kexue.fm\/archives\/4765\" target=\"_blank\" rel=\"noreferrer noopener\">\u300aAttention is All You Need\u300b\u6d45\u8bfb\uff08\u7b80\u4ecb+\u4ee3\u7801\uff09<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6ce8\u610f\u529b\u6c47\u805a \u67e5\u8be2\uff08\u81ea\u4e3b\u63d0\u793a\uff09\u548c\u952e\uff08\u975e\u81ea\u4e3b\u63d0\u793a\uff09\u4e4b\u95f4\u7684\u4ea4\u4e92\u5f62\u6210\u4e86 \u6ce8\u610f\u529b\u6c47\u805a\uff08attentionpooling\uff09 &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2022\/10\/06\/attention_nlp\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u81ea\u7136\u8bed\u8a00\u5904\u7406\u4e2d\u6ce8\u610f\u529b\u673a\u5236\u7efc\u8ff0<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21,4],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/8824"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=8824"}],"version-history":[{"count":61,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/8824\/revisions"}],"predecessor-version":[{"id":8897,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/8824\/revisions\/8897"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=8824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=8824"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=8824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}