{"id":8277,"date":"2023-05-26T12:23:08","date_gmt":"2023-05-26T03:23:08","guid":{"rendered":"https:\/\/agirobots.com\/?p=8277"},"modified":"2023-10-24T10:24:22","modified_gmt":"2023-10-24T01:24:22","slug":"sparse-attention","status":"publish","type":"post","link":"https:\/\/developers.agirobots.com\/jp\/sparse-attention\/","title":{"rendered":"Sparse Attention\u306b\u3064\u3044\u3066\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\uff01"},"content":{"rendered":"\n<p>Transformer[1]\u306e\u6838\u5fc3\u3068\u306a\u308b\u4ed5\u7d44\u307f\u3067\u3042\u308bAttention\u306f\u3001\u5165\u529b\u30b7\u30fc\u30b1\u30f3\u30b9\u5185\u306e\u5404\u30c8\u30fc\u30af\u30f3\u9593\u306e\u95a2\u9023\u6027\u306b\u57fa\u3065\u3044\u3066\u6ce8\u610f\u306e\u8a08\u7b97\u3092\u884c\u3044\u307e\u3059\u3002\u305d\u308c\u306b\u3088\u308a\u3001Transformer\u306f\u5f93\u6765\u306e\u7cfb\u5217\u51e6\u7406\u306b\u304a\u3044\u3066\u4e3b\u6d41\u3067\u3042\u3063\u305fRNN\u306e\u6027\u80fd\u3092\u51cc\u99d5\u3059\u308b\u6027\u80fd\u3092\u5b9f\u73fe\u3057\u3001\u66f4\u306b\u306f\u753b\u50cf\u51e6\u7406\u306a\u3069\u306e\u9818\u57df\u3067\u3082\u5927\u304d\u306a\u6210\u679c\u3092\u4e0a\u3052\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f[2]\u3002\u3053\u306e\u3088\u3046\u306b\u5f93\u6765\u306e\u30e2\u30c7\u30eb\u3067\u306f\u6210\u3057\u5f97\u306a\u304b\u3063\u305f\u3088\u3046\u306a\u6210\u679c\u3092\u9054\u6210\u3067\u304d\u308b\u4e07\u80fd\u306a\u4ed5\u7d44\u307f\u3067\u3042\u308bAttention\u3067\u3059\u304c\u3001\u305d\u306e\u8a08\u7b97\u30b3\u30b9\u30c8\u306f\u5165\u529b\u30b7\u30fc\u30b1\u30f3\u30b9\u9577\\(n\\)\u306b\u5bfe\u3057\u3066\u6307\u6570\u95a2\u6570\u7684\u306b\u5897\u52a0\u3059\u308b\u3068\u3044\u3046\u5927\u304d\u306a\u8ab2\u984c\u3092\u6301\u3061\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u6271\u3048\u308b\u30b7\u30fc\u30b1\u30f3\u30b9\u306e\u9577\u3055\u306f\u8a08\u7b97\u6a5f\u306e\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u6027\u80fd\u306b\u5927\u304d\u304f\u5f71\u97ff\u3055\u308c\u3001\u3042\u308b\u7a0b\u5ea6\u306e\u30b7\u30fc\u30b1\u30f3\u30b9\u9577\u3092\u6271\u3046\u306b\u306f\u3001\u9ad8\u3044\u51e6\u7406\u80fd\u529b\u3068\u5927\u5bb9\u91cf\u306e\u30e1\u30e2\u30ea\u3092\u6301\u3064\u8a08\u7b97\u6a5f\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u5982\u4f55\u306b\u3059\u308c\u3070Attention\u306e\u8a08\u7b97\u30b3\u30b9\u30c8\u3092\u4e0b\u3052\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u304b\u3001\u8a08\u7b97\u91cf\u3092\u6e1b\u5c11\u3055\u305b\u3089\u308c\u308b\u304b\u304c\u7814\u7a76\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u69d8\u3005\u306a\u30a2\u30d7\u30ed\u30fc\u30c1\u3067\u7814\u7a76\u304c\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u672c\u8a18\u4e8b\u3067\u7d39\u4ecb\u3059\u308b\u306e\u306f\u3001Attention\u306e\u8a08\u7b97\u3092\u30b9\u30d1\u30fc\u30b9\u306b\u3059\u308b\u3068\u3044\u3046\u624b\u6cd5\u3067\u3042\u308b\u3001Sparse Attention[3]\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002Sparse Attention\u306f\u672c\u8a18\u4e8b\u306e\u57f7\u7b46\u6642\u70b9\uff082023\u5e74\uff09\u3067\u3082\u5229\u7528\u3055\u308c\u3066\u3044\u308b\u91cd\u8981\u306a\u624b\u6cd5\u3067\u3059\u3002\u672c\u8a18\u4e8b\u3092\u901a\u3058\u3066\u3001Sparse Attention\u306e\u30a8\u30c3\u30bb\u30f3\u30b9\u306b\u3064\u3044\u3066\u3054\u7406\u89e3\u3044\u305f\u3060\u3051\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u672c\u8a18\u4e8b\u306e\u69cb\u6210\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002\u524d\u534a\u90e8\u5206\u3067\u306f\u3001Sparse Attention\u3092\u7406\u89e3\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u57fa\u790e\u77e5\u8b58\u3092\u8aac\u660e\u3057\u307e\u3059\u3002\u5177\u4f53\u7684\u306b\u306f\u30012017\u5e74\u306b\u767a\u8868\u3055\u308c\u305fTransformer\u3084\u3001Attention\u3001Attention Matrix\u306b\u3064\u3044\u3066\u3001\u56f3\u3084\u6570\u5f0f\u3092\u7528\u3044\u3066\u8a73\u3057\u304f\u8aac\u660e\u3057\u307e\u3059\u3002\u5f8c\u534a\u306f\u3001\u672c\u8a18\u4e8b\u306e\u672c\u984c\u3067\u3042\u308bSparse Attention\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u524d\u63d0\u77e5\u8b58<\/h2>\n\n\n\n<p>\u307e\u305a\u3001\u524d\u63d0\u77e5\u8b58\u3068\u3057\u3066Transformer\u3001Attention\u3001Attention Matrix\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002Transformer\u306b\u3064\u3044\u3066\u306f\u3001Attention\u3092\u306f\u3058\u3081\u3066\u4e00\u822c\u5316\u3057\u305d\u308c\u3092\u4e2d\u5fc3\u306b\u6dfb\u3048\u305f\u30e2\u30c7\u30eb\u3068\u306a\u3063\u3066\u304a\u308a\u3001Attention\u3092\u77e5\u308b\u3046\u3048\u3067\u6b20\u304b\u3059\u3053\u3068\u306e\u3067\u304d\u306a\u3044\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3067\u3059\u3002\u305d\u3057\u3066\u3001Transformer\u3067\u4f7f\u7528\u3055\u308c\u305fAttention\u306f\u305d\u306e\u5f8c\u306e\u6539\u826f\u578bAttention\u306e\u57fa\u790e\u3068\u306a\u308a\u3001\u7279\u306bSparse Attention\u306fAttention Matrix\u3068\u5bc6\u63a5\u306b\u95a2\u9023\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u308c\u3089\u306b\u3064\u3044\u3066\u9806\u756a\u306b\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Transformer<\/h3>\n\n\n\n<p>Transformer\u306f\u30012017\u5e74\u306b\u767a\u8868\u3055\u308c\u305f\u300cAttention is All You Need\u300d[1]\u3068\u3044\u3046\u8ad6\u6587\u306b\u3066\u63d0\u6848\u3055\u308c\u305f\u6a5f\u68b0\u7ffb\u8a33\u30e2\u30c7\u30eb\u3067\u3059\u3002Transformer\u306f\u4e0b\u56f3\u306b\u793a\u3059\u3088\u3046\u306b\u3001Seq2Seq\u3092\u30d9\u30fc\u30b9\u3068\u3057\u305f\u30e2\u30c7\u30eb\u69cb\u9020\u3092\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1016\" height=\"1024\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-13-1016x1024.png\" alt=\"\" class=\"wp-image-7560\" srcset=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-13-1016x1024.png 1016w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-13-298x300.png 298w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-13-150x150.png 150w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-13-768x774.png 768w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-13-1524x1536.png 1524w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-13-100x100.png 100w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-13.png 2032w\" sizes=\"(max-width: 1016px) 100vw, 1016px\" \/><\/figure>\n\n\n\n<p>\u73fe\u5728\u306f\u3001\u81ea\u7136\u8a00\u8a9e\u51e6\u7406\u306e\u67a0\u3092\u8d85\u3048\u305f\u591a\u7a2e\u591a\u69d8\u306a\u9818\u57df\u306b\u304a\u3044\u3066\u5927\u304d\u306a\u6210\u679c\u3092\u3042\u3052\u3066\u3044\u307e\u3059\u3002Transformer\u306e\u4e3b\u306a\u69cb\u6210\u8981\u7d20\u306f\u4ee5\u4e0b\u306e\uff13\u3064\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"is-style-st-maruck wp-block-list\">\n<li>Positional Encoding<\/li>\n\n\n\n<li>Multi-Head Attention<\/li>\n\n\n\n<li>Position-wise Feed Forward<\/li>\n<\/ul>\n\n\n\n<p>Positional Encoding\u306f\u3001Transformer\u306b\u5165\u529b\u3055\u308c\u305f\u5404\u30c8\u30fc\u30af\u30f3\u306e\u7cfb\u5217\u60c5\u5831\u306b\u4f4d\u7f6e\u60c5\u5831\u3092\u8868\u3059\u30d9\u30af\u30c8\u30eb\u3092\u52a0\u3048\u307e\u3059\u3002Transformer\u306f\u7cfb\u5217\u30e2\u30c7\u30eb\u3068\u306f\u3044\u3048\u3001RNN\u306e\u3088\u3046\u306b\u904e\u53bb\u306e\u60c5\u5831\u3092\u8a18\u61b6\u3059\u308b\u3088\u3046\u306a\u8a18\u61b6\u6a5f\u69cb\u306f\u6301\u305f\u306a\u3044\u305f\u3081\u3001Positional Encoding\u304c\u7121\u3044\u5834\u5408\u3001\u7cfb\u5217\u60c5\u5831\u5185\u306e\u6642\u9593\u7684\u306a\u6d41\u308c\u3092\u3068\u3089\u3048\u308b\u3053\u3068\u304c\u96e3\u3057\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>Multi-Head Attention\u306f\u3001\u5358\u4e00\u306eAttention\uff08Scaled Dot-Product Attention\uff09\u306e\u5165\u529b\u306b\u7dda\u5f62\u5c64\u3092\u8ffd\u52a0\u3057\u305f\u69cb\u9020\uff08Single-Head Attention\uff09\u3092\u8907\u6570\u4e26\u5217\u5316\u3059\u308b\u3053\u3068\u3067\u3001\u591a\u69d8\u306a\u6ce8\u610f\u60c5\u5831\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u8a2d\u8a08\u3055\u308c\u3066\u3044\u307e\u3059\u3002Scaled Dot-Product Attention\u3068\u306f\u3001\u7c21\u5358\u306b\u8aac\u660e\u3059\u308b\u3068\u5165\u529b\u3055\u308c\u305f\u7cfb\u5217\u60c5\u5831\u9593\u306e\u5404\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u9593\u3067\u5185\u7a4d\u3092\u8a08\u7b97\u3057\u3001\u305d\u308c\u306b\u57fa\u3065\u3044\u3066\u5185\u7a4d\u306e\u5927\u304d\u3044\u30ef\u30fc\u30c9\u306b\u591a\u304f\u306e\u6ce8\u610f\u3092\u5411\u3051\u3066\u7dda\u5f62\u7d50\u5408\u3059\u308b\u3053\u3068\u3067\u6b21\u306e\u30d9\u30af\u30c8\u30eb\u3092\u751f\u6210\u3059\u308b\u4ed5\u7d44\u307f\u3067\u3059\u3002\u8a73\u3057\u3044\u5185\u5bb9\u306f\u6b21\u306b\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>Position-wise Feed Forward\u306f\u3001Multi-Head Attention\u306e\u51fa\u529b\u3092\u5404\u30c8\u30fc\u30af\u30f3\u3054\u3068\u306b\u5909\u63db\u3059\u308b\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3067\u3059\u3002\u30c8\u30fc\u30af\u30f3\u6bce\u306b\u3068\u3044\u3046\u70b9\u304c\u91cd\u8981\u3067\u3001\u305d\u308c\u304cPosition-wise\u306e\u610f\u5473\u306b\u306a\u308a\u307e\u3059\u3002\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306f\u5358\u7d14\u306a3\u5c64\u578b\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u3053\u307e\u3067Transformer\u306e\u4e3b\u306a\u69cb\u6210\u8981\u7d20\u306b\u3064\u3044\u3066\u7c21\u5358\u306b\u8aac\u660e\u3057\u3066\u304d\u307e\u3057\u305f\u3002Transformer\u304c\u958b\u767a\u3055\u308c\u305f\u80cc\u666f\u4e8b\u60c5\u306a\u3069\u3001\u672c\u8a18\u4e8b\u3067\u306f\u8aac\u660e\u3057\u3066\u3044\u306a\u3044\u5185\u5bb9\u306b\u8208\u5473\u306e\u3042\u308b\u65b9\u306f\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3057\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-agirobots-blog wp-block-embed-agirobots-blog\"><div class=\"wp-block-embed__wrapper\">\n<div><a href=\"https:\/\/developers.agirobots.com\/jp\/essence-transformer\/\" class=\"st-cardlink st-embed-cardlink\"><div class=\"kanren st-cardbox\"><dl class=\"clearfix\"><dt class=\"st-card-img\"><img decoding=\"async\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/CD5DF6F6-E0AD-4577-8654-A8FE3F602C48-150x150.jpeg\" alt=\"\" width=\"100\" height=\"100\" \/><\/dt><dd><p class=\"st-cardbox-t\">Transformer\u306b\u3064\u3044\u3066\u672c\u8cea\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\uff01<\/p><div class=\"st-card-excerpt smanone\"><p>\u7686\u3055\u3093\u3053\u3093\u306b\u3061\u306f\uff01 \u53bb\u5e74\uff082022\u5e7411\u6708\uff09\u306b\u767a\u8868\u3055\u308c\u305fChatGPT\u306e\u8a71\u984c\u304c\u5c3d\u304d\u306a\u3044\u4eca\u65e5\u3053\u306e\u9803\u3001ChatGPT\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u91cd\u8981\u306a\u6280\u8853\u306e\uff11\u3064\u3067\u3042\u308bTransformer\u306b\u3064\u3044\u3066\u3001\u8208\u5473\u3092\u6301\u3063\u305f\u65b9\u306f\u6ca2\u5c71 ... <\/p><\/div><\/dd><\/dl><\/div><\/a><\/div>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Attention\uff08Scaled Dot-Product Attention\uff09<\/h3>\n\n\n\n<p>Transformer\u3067\u4f7f\u308f\u308c\u3066\u3044\u308bAttention\u306e\u6700\u5c0f\u5358\u4f4d\u306eScaled Dot-Product Attention\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u305d\u306e\u524d\u306b\u3001Scaled Dot-Product Attention\u304c\u3001\u3069\u3053\u306b\u3069\u3046\u4f7f\u308f\u308c\u3066\u3044\u308b\u304b\u3092\u4e0b\u56f3\u306b\u793a\u3057\u307e\u3057\u305f\u306e\u3067\u3001Scaled Dot-Product Attention\u306e\u8aac\u660e\u306b\u5165\u308b\u524d\u306b\u7c21\u5358\u306b\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"563\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-2-1024x563.png\" alt=\"\" class=\"wp-image-7525\" srcset=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-2-1024x563.png 1024w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-2-300x165.png 300w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-2-768x422.png 768w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-2-1536x844.png 1536w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/image-2-2048x1125.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u53f3\u5074\u306b\u3001\u5148\u307b\u3069\u793a\u3057\u305fTransformer\u30e2\u30c7\u30eb\u304c\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002Transformer\u306e\u4e3b\u306a\u69cb\u6210\u8981\u7d20\u306e\uff11\u3064\u3068\u3057\u3066\u7d39\u4ecb\u3057\u305f\u3001Multi-Head Attention\u306b\u6ce8\u76ee\u3057\u305f\u56f3\u304c\u4e2d\u5fc3\u304b\u3089\u5c11\u3057\u5de6\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002Multi-Head Attention\u306f\u3001Scaled Dot-Product Attention\uff08\u56f3\u4e2d\u5de6\uff09\u306e\u5165\u529b\u306b\u7dda\u5f62\u5c64\u3092\u4ed8\u4e0e\u3057\u305fSingle-Head Attention\u3092\u8907\u6570\u4e26\u5217\u306b\u4e26\u3079\u3001\u305d\u308c\u3089\u306e\u51fa\u529b\u3092concat\u3068Linear\u5c64\u3067\u30d5\u30e5\u30fc\u30b8\u30e7\u30f3\u3059\u308b\u69cb\u9020\u3092\u3057\u3066\u3044\u307e\u3059\u3002Scaled Dot-Product Attention\u3092\u5358\u306b\u4e26\u5217\u5316\u3059\u308b\u3060\u3051\u3067\u306f\u4e0d\u5341\u5206\u306a\u7406\u7531\u306f\u3001Scaled Dot-Product Attention\u304c\u5165\u529b\u30b7\u30fc\u30b1\u30f3\u30b9\u306e\u5404\u30c8\u30fc\u30af\u30f3\u9593\u3067\u5185\u7a4d\u3092\u8a08\u7b97\u3059\u308b\u3060\u3051\u3067\u3001\u305d\u308c\u81ea\u4f53\u306b\u5b66\u7fd2\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5b58\u5728\u3057\u306a\u3044\u304b\u3089\u3067\u3059\u3002\u3053\u308c\u304c\u4f55\u3092\u610f\u5473\u3059\u308b\u304b\u3068\u3044\u3046\u3068\u3001Scaled Dot-Product Attention\u3060\u3051\u3092\u8907\u6570\u4e26\u5217\u5316\u3057\u305f\u3068\u3053\u308d\u3067\u3001\u305d\u308c\u305e\u308c\u304b\u3089\u306e\u51fa\u529b\u306f\u5168\u3066\u540c\u3058\u3067\u3042\u308a\u3001\u8868\u73fe\u53ef\u80fd\u306a\u6ce8\u610f\u8868\u73fe\u3092\u5897\u3084\u3059\u3053\u3068\u306b\u5bc4\u4e0e\u3057\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u8868\u73fe\u53ef\u80fd\u306a\u6ce8\u610f\u8868\u73fe\u306b\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u6301\u305f\u305b\u308b\u306b\u306f\u3001\u4e26\u5217\u306b\u4e26\u3079\u3089\u308c\u305f\u5404\u3005\u306eScaled Dot-Product Attention\u306b\u5165\u529b\u3055\u308c\u308b\u30d9\u30af\u30c8\u30eb\u3092\u9055\u3046\u3082\u306e\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u3053\u3067\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u3001Linear\u5c64\u3067\u3059\u3002Linear\u5c64\u306f\u6d3b\u6027\u5316\u95a2\u6570\u3092\u6301\u305f\u306a\u3044\u3001\u3082\u3057\u304f\u306f\u6d3b\u6027\u5316\u95a2\u6570\u304c\u6052\u7b49\u95a2\u6570\u306e\u5c64\u3068\u8003\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u3053\u308c\u3092Scaled Dot-Product Attention\u306e\u5165\u529b\u306e\u76f4\u524d\u306b\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3001\u591a\u7a2e\u591a\u69d8\u306a\u6ce8\u610f\u8868\u73fe\u3092\u8868\u73fe\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u308c\u304c\u3001Multi-Head Attention\u3067\u3059\u3002Multi-Head Attention\u306b\u3064\u3044\u3066\u66f4\u306b\u8a73\u3057\u3044\u5185\u5bb9\u3092\u77e5\u308a\u305f\u3044\u65b9\u306f\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3092\u304a\u8aad\u307f\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-agirobots-blog wp-block-embed-agirobots-blog\"><div class=\"wp-block-embed__wrapper\">\n<div><a href=\"https:\/\/developers.agirobots.com\/jp\/multi-head-attention\/\" class=\"st-cardlink st-embed-cardlink\"><div class=\"kanren st-cardbox\"><dl class=\"clearfix\"><dt class=\"st-card-img\"><img decoding=\"async\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/02\/0E0D472B-78CA-45C4-AB6F-39BBD367B8AC-150x150.jpeg\" alt=\"\" width=\"100\" height=\"100\" \/><\/dt><dd><p class=\"st-cardbox-t\">\u3010Transformer\u306e\u57fa\u790e\u3011Multi-Head Attention\u306e\u4ed5\u7d44\u307f<\/p><div class=\"st-card-excerpt smanone\"><p>\u672c\u8a18\u4e8b\u3067\u306f\u3001Transformer\u306e\u57fa\u790e\u3068\u3057\u3066\u3001Multi-Head Attention\u306e\u4ed5\u7d44\u307f\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002 \u672c\u8a18\u4e8b\u306e\u69cb\u6210\u306f\u3001\u306f\u3058\u3081\u306bTransformer\u304a\u3088\u3073Transformer  ... <\/p><\/div><\/dd><\/dl><\/div><\/a><\/div>\n<\/div><\/figure>\n\n\n\n<p>\u3067\u306f\u3001Scaled Dot-Product Attention\u306e\u8a08\u7b97\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002Scaled Dot-Product Attention\u306e\u5165\u529b\u306f\u3001\uff08\\(Q\\)\uff09\u3001\u30ad\u30fc\uff08\\(K\\)\uff09\u3001\u5024\uff08\\(V\\)\uff09\u306e3\u3064\u3067\u3001\u3053\u308c\u3089\u306e\u6210\u5206\u3092\u7528\u3044\u3066\u6ce8\u610f\u3092\u8a08\u7b97\u3057\u307e\u3059\u3002\u5177\u4f53\u7684\u306b\u306f\u3001\u30af\u30a8\u30ea\u3068\u5404\u30ad\u30fc\u306e\u9593\u306e\u5185\u7a4d\u3092\u8a08\u7b97\u3057\u3001\u305d\u306e\u7d50\u679c\u3092\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\uff08\u901a\u5e38\u306f\u6b21\u5143\u306e\u5e73\u65b9\u6839\u3067\u9664\u7b97\uff09\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u5404\u30ad\u30fc\u3068\u30af\u30a8\u30ea\u306e\u9593\u306e\u9069\u5408\u5ea6\u304c\u8a08\u7b97\u3055\u308c\u307e\u3059\u3002\u6b21\u306b\u3001\u3053\u308c\u3089\u306e\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\u3055\u308c\u305f\u9069\u5408\u5ea6\u3092\u30bd\u30d5\u30c8\u30de\u30c3\u30af\u30b9\u95a2\u6570\u306b\u901a\u3059\u3053\u3068\u3067\u3001\u78ba\u7387\u7684\u306a\u91cd\u307f\uff08\u3059\u306a\u308f\u3061\u3001\u6ce8\u76ee\u5ea6\uff09\u3092\u5f97\u307e\u3059\u3002\u6700\u5f8c\u306b\u3001\u3053\u308c\u3089\u306e\u91cd\u307f\u3092\u5024\u306b\u9069\u7528\uff08\u901a\u5e38\u306f\u91cd\u307f\u306e\u548c\u3067\uff09\u3059\u308b\u3053\u3068\u3067\u3001\u6700\u7d42\u7684\u306a\u51fa\u529b\u3092\u5f97\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u30e1\u30ab\u30cb\u30ba\u30e0\u306f\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304c\u30af\u30a8\u30ea\u306b\u6700\u3082\u95a2\u9023\u6027\u306e\u9ad8\u3044\u60c5\u5831\uff08\u5024\uff09\u306b\u300c\u6ce8\u76ee\u300d\u3059\u308b\u80fd\u529b\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\u306f\u3001\u30c9\u30c3\u30c8\u7a4d\u304c\u975e\u5e38\u306b\u5927\u304d\u304f\u306a\u308b\u3053\u3068\u306b\u3088\u308b\u30bd\u30d5\u30c8\u30de\u30c3\u30af\u30b9\u95a2\u6570\u306e\u52fe\u914d\u6d88\u5931\u554f\u984c\u3092\u7de9\u548c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u306b\u3001Scaled Dot-Product Attention\u306e\u8a08\u7b97\u306e\u6982\u8981\u3092\u793a\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<ul class=\"is-style-st-timeline-count wp-block-list\">\n<li>\u30af\u30a8\u30ea\uff08\\(Q\\)\uff09\u3068\u30ad\u30fc\uff08\\(K\\)\uff09\u306e\u30c9\u30c3\u30c8\u7a4d\u3092\u8a08\u7b97\u3057\u307e\u3059\uff1a\\(QK^T\\)<\/li>\n\n\n\n<li>\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\u3092\u884c\u3044\u307e\u3059\uff1a\\(QK^T \/ sqrt(d_k)\\) \uff08\u3053\u3053\u3067\u3001\\(d_k\\)\u306f\u30ad\u30fc\u306e\u6b21\u5143\u6570\uff09<\/li>\n\n\n\n<li>\u30bd\u30d5\u30c8\u30de\u30c3\u30af\u30b9\u95a2\u6570\u3092\u9069\u7528\u3057\u3066\u78ba\u7387\u7684\u306a\u91cd\u307f\u3092\u5f97\u307e\u3059\uff1a\\(softmax(QK^T \/ sqrt(d_k))\\)<\/li>\n\n\n\n<li>\u3053\u308c\u3089\u306e\u91cd\u307f\u3092\u5024\uff08\\(V\\)\uff09\u306b\u9069\u7528\u3057\u307e\u3059\uff1a\\(softmax(QK^T \/ sqrt(d_k))V\\)<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u306e\u8a08\u7b97\u306f\u3001\u5404\u30af\u30a8\u30ea\u306b\u5bfe\u3057\u3066\u884c\u308f\u308c\u3001\u7d50\u679c\u3068\u3057\u3066\u6ce8\u76ee\u5ea6\u306b\u3088\u3063\u3066\u91cd\u307f\u4ed8\u3051\u3055\u308c\u305f\u5024\u306e\u96c6\u5408\u304c\u5f97\u3089\u308c\u307e\u3059\u3002\u3053\u308c\u304c\u3001Scaled Dot-Product Attention\u306e\u51fa\u529b\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-7-695x1024.png\" alt=\"\" class=\"wp-image-8302\" style=\"width:348px;height:512px\" width=\"348\" height=\"512\" srcset=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-7-695x1024.png 695w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-7-204x300.png 204w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-7-768x1131.png 768w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-7-1043x1536.png 1043w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-7.png 1158w\" sizes=\"(max-width: 348px) 100vw, 348px\" \/><\/figure><\/div>\n\n\n<p>\u30d9\u30af\u30c8\u30eb\u3084\u884c\u5217\u306e\u5f62\u3092\u8003\u3048\u3066\u307f\u308b\u3068\u30a4\u30e1\u30fc\u30b8\u3057\u3084\u3059\u3044\u3067\u3057\u3087\u3046\u3002\u5165\u529b\u3055\u308c\u308b\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u3092\u884c\u30d9\u30af\u30c8\u30eb\u3068\u3057\u3001\u305d\u308c\u3089\u304c\u7e26\u65b9\u5411\u306b\u4e26\u3079\u3089\u308c\u305f\u884c\u5217\u306b\u3088\u308a\u30b7\u30fc\u30b1\u30f3\u30b9\u30c7\u30fc\u30bf\u304c\u8868\u73fe\u3055\u308c\u3066\u3044\u308b\u3068\u3057\u307e\u3059\u3002\u3053\u308c\u3092\u3001Key\u3068Value\u306b\u4e0e\u3048\u308b\u3068\u3057\u307e\u3059\u3002Query\u306b\u3082\u540c\u3058\u884c\u5217\u3092\u4e0e\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u304c\u3001\u3053\u3053\u3067\u306f\u8aac\u660e\u306e\u90fd\u5408\u4e0a\u3001\u4efb\u610f\u306e\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u30921\u3064\u3060\u3051\u4e0e\u3048\u308b\u3053\u3068\u3092\u8003\u3048\u307e\u3059\u3002\u3059\u308b\u3068\u3001Scaled Dot-Product Attention\u306e\u8a08\u7b97\u306b\u3088\u308b\u30d9\u30af\u30c8\u30eb\u3084\u884c\u5217\u306e\u5909\u5316\u306f\u4ee5\u4e0b\u306e\u56f3\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u7c21\u5358\u306b\u8aac\u660e\u3059\u308b\u3068\u3001Query\u3068\u3057\u3066\u4e0e\u3048\u3089\u308c\u305f\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u3068\u3001Key\u306b\u4e0e\u3048\u3089\u308c\u305f\u30b7\u30fc\u30b1\u30f3\u30b9\u306e\u5404\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u3068\u5185\u7a4d\u3092\u8a08\u7b97\u3057\u3001\u3069\u306e\u30c8\u30fc\u30af\u30f3\u3068\u306e\u95a2\u9023\u5ea6\u304c\u8fd1\u3044\u304b\u8a08\u7b97\u3057\u3001\u305d\u308c\u306b\u57fa\u3065\u3044\u3066Value\u306e\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u3092\u7dda\u5f62\u7d50\u5408\u3059\u308b\u3053\u3068\u3067\u3001Query\u306b\u5bfe\u3059\u308b\u51fa\u529b\u30d9\u30af\u30c8\u30eb\u3092\u8a08\u7b97\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"845\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/07\/image-40-1024x845.png\" alt=\"\" class=\"wp-image-8722\" srcset=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/07\/image-40-1024x845.png 1024w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/07\/image-40-300x248.png 300w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/07\/image-40-768x634.png 768w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/07\/image-40-1536x1268.png 1536w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/07\/image-40-2048x1690.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Scaled Dot-Product Attention\u306e\u51e6\u7406\u3092\u7406\u89e3\u3057\u3066\u3044\u305f\u3060\u3051\u305f\u3068\u3053\u308d\u3067\u3001\u3053\u306e\u4ed5\u7d44\u307f\u306e\u3069\u3053\u304c\u539f\u56e0\u3067\u3001\u5165\u529b\u30b7\u30fc\u30b1\u30f3\u30b9\u9577\u306b\u5bfe\u3057\u30662\u4e57\u306e\u30aa\u30fc\u30c0\u3067\u8a08\u7b97\u30b3\u30b9\u30c8\u304c\u5897\u52a0\u3057\u3066\u3057\u307e\u3046\u306e\u3060\u3068\u601d\u3044\u307e\u3059\u304b\uff1f<\/p>\n\n\n\n<p>\u305d\u306e\u539f\u56e0\u306f\u3001Scaled Dot-Product Attention\u306b\u304a\u3051\u308bQuery\u3068Key\u306e\u5185\u7a4d\u3092\u8a08\u7b97\u3059\u308bMutMul\u64cd\u4f5c\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-st-blocks-memo clip-memobox\" style=\"color:#000;background-color:#fafafa\"><div class=\"clip-fonticon\" style=\"color:#919191;border-color:#9191914d\"><i class=\"st-fa st-svg-file-text-o st-css-no\" data-icon-label=\"\" aria-hidden=\"\"><\/i><\/div><div class=\"clip-memotext\" style=\"color:#000\">\n<p>Linear\u5c64\u306e\u8a08\u7b97\u30b3\u30b9\u30c8\u306f\u3042\u307e\u308a\u554f\u984c\u306b\u306a\u3089\u306a\u3044\u306e\u304b\u3001\u3068\u3044\u3046\u7591\u554f\u304c\u751f\u3058\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u3001Scaled Dot-Product Attention\u306eQuery\u3068Key\u306e\u5185\u7a4d\u3092\u884c\u3046MutMul\u306e\u3088\u3046\u306b\u306f\u554f\u984c\u306b\u306a\u308a\u307e\u305b\u3093\u3002Linear\u5c64\u306f\u5165\u529b\u3055\u308c\u305f\u5404\u3005\u306e\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u306b\u5bfe\u3057\u3066\u9069\u7528\u3055\u308c\u307e\u3059\u3002\u30b7\u30fc\u30b1\u30f3\u30b9\u9577\u304c \\(n\\)\u304b\u3089\\(2n\\)\u306b\u306a\u308b\u3053\u3068\u3067\u5897\u3048\u308b\u8a08\u7b97\u30b3\u30b9\u30c8\u306f2\u500d\u3067\u3059\u3002\u3064\u307e\u308a\u3001\u8a08\u7b97\u91cf\u306f\\(O(n)\\)\u3067\u3059\u3002<\/p>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Attention Matrix<\/h3>\n\n\n\n<p>Scaled Dot-Product Attention\u306eQuery\u3068Key\u306e\u5185\u7a4d\u3092\u884c\u3046MutMul\u3067\u751f\u6210\u3055\u308c\u305f\u884c\u5217\u306f\u3001\u30b9\u30b1\u30fc\u30eb\u51e6\u7406\u3001\u30de\u30b9\u30af\u51e6\u7406\u3001softmax\u95a2\u6570\u306e\u9069\u7528\u304c\u884c\u308f\u308c\u307e\u3059\u3002\u3053\u306e\u884c\u5217\u3092\u3001Attention Matrix\u3068\u3044\u3044\u307e\u3059\u3002\u5165\u529b\u30b7\u30fc\u30b1\u30f3\u30b9\u9577\u306b\u5fdc\u3058\u3066Attention\u306e\u8a08\u7b97\u30b3\u30b9\u30c8\u304c2\u4e57\u306e\u30aa\u30fc\u30c0\u30fc\u3067\u5897\u52a0\u3059\u308b\u306e\u306f\u3001Attention Matrix\u306e\u6210\u5206\u6570\u304c\u5165\u529b\u30b7\u30fc\u30b1\u30f3\u30b9\u9577\u306b\u5bfe\u3057\u30662\u4e57\u3067\u5897\u52a0\u3059\u308b\u304b\u3089\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3067\u306f\u3001Attention Matrix\u306b\u3064\u3044\u3066\u5177\u4f53\u7684\u306b\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002\u4ee5\u964d\u3067\u306f\u5165\u529b\u30b7\u30fc\u30b1\u30f3\u30b9\u306f\u3001\u81ea\u7136\u8a00\u8a9e\u306b\u3088\u308b\u6587\u7ae0\u3092\u30c8\u30fc\u30af\u30f3\u5316\u3057\u3066\u4e26\u3079\u305f\u884c\u5217\u3068\u3057\u307e\u3059\u3002\u3053\u306e\u884c\u5217\u3092\u3001Scaled Dot-Product Attention\u306eQuery\u3001Key\u3001Value\u306b\u5165\u529b\u3059\u308b\u3068\u3001Attention Matrix\uff08\u4e0b\u56f3\u5de6\uff09\u306f\u30af\u30a8\u30ea\u3068\u30ad\u30fc\u306e\u9593\u306e\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\uff06softmax\u304c\u9069\u7528\u3055\u308c\u305f\u884c\u5217\u3092\u8868\u3057\u307e\u3059\u3002\u5177\u4f53\u7684\u306b\u306f\u3001\u884c\u5217\u306e\u5404\u8981\u7d20\u306f\u3001\u5bfe\u5fdc\u3059\u308b\u30af\u30a8\u30ea\u3068\u30ad\u30fc\u306e\u9593\u306e\u95a2\u9023\u6027\uff08\u307e\u305f\u306f\u300c\u9069\u5408\u5ea6\u300d\uff09\u3092\u8868\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c7\u30b3\u30fc\u30c0\u306e\u5834\u5408\u3001\u672a\u6765\u306e\u60c5\u5831\u306b\u5bfe\u3059\u308b\u300c\u6ce8\u76ee\u300d\u3092\u9632\u3050\u305f\u3081\u306b\u3001\u30de\u30b9\u30af\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002\u5177\u4f53\u7684\u306b\u306f\u3001Attention Matrix\u306e\u7279\u5b9a\u306e\u8981\u7d20\u3092\u7121\u9650\u5927\u306e\u8ca0\u306e\u5024\uff08\u901a\u5e38\u306f-\u221e\uff09\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u30bd\u30d5\u30c8\u30de\u30c3\u30af\u30b9\u95a2\u6570\u304c\u3053\u308c\u3089\u306e\u8981\u7d20\u306b\u5bfe\u3057\u3066\u30bc\u30ed\u306e\u91cd\u307f\u3092\u5272\u308a\u5f53\u3066\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30c7\u30b3\u30fc\u30c0\u306f\u81ea\u8eab\u306e\u672a\u6765\u306e\u51fa\u529b\u306b\u300c\u6ce8\u76ee\u300d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"620\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-9-1024x620.png\" alt=\"\" class=\"wp-image-8310\" srcset=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-9-1024x620.png 1024w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-9-300x182.png 300w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-9-768x465.png 768w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-9-1536x930.png 1536w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-9-2048x1240.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u3053\u306eAttention Matrix\u306f\u3001Single-Head Attention\u3084Multi-Head Attention\u306e\u3088\u3046\u306b\u5165\u529b\u306b\u7dda\u5f62\u5c64\u3092\u8ffd\u52a0\u3057\u3066\u3082\u30b5\u30a4\u30ba\u306f\u5909\u308f\u308a\u307e\u305b\u3093\u3002\u7dda\u5f62\u5c64\u306b\u3088\u308a\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u306e\u6b21\u5143\u6570\u304c\u5c0f\u3055\u304f\u306a\u3063\u305f\u3068\u3057\u3066\u3082\u3001\u305d\u306e\u30d9\u30af\u30c8\u30eb\u304c\u4e26\u3076\u6570\u306f\u30b7\u30fc\u30b1\u30f3\u30b9\u9577\u306b\u4f9d\u5b58\u3059\u308b\u304b\u3089\u3067\u3059\u3002\u7dda\u5f62\u5c64\u3092\u8ffd\u52a0\u3059\u308b\u30e1\u30ea\u30c3\u30c8\u306f\u3001Attention Matrix\u306e\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u5897\u3084\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"573\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-5-1024x573.png\" alt=\"\" class=\"wp-image-8299\" srcset=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-5-1024x573.png 1024w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-5-300x168.png 300w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-5-768x430.png 768w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-5-1536x860.png 1536w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-5-2048x1146.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u4e0b\u56f3\u306f\u3001\u7dda\u5f62\u5c64\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067Attention Matrix\u304c\u5909\u5316\u3059\u308b\u3053\u3068\u3092\u8868\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"562\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-6-1024x562.png\" alt=\"\" class=\"wp-image-8300\" srcset=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-6-1024x562.png 1024w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-6-300x165.png 300w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-6-768x421.png 768w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-6-1536x843.png 1536w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-6-2048x1124.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u4ee5\u4e0a\u304c\u3001Attention Matrix\u306e\u8aac\u660e\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sparse Attention<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Sparse Attention\u3068\u306f<\/strong><\/h3>\n\n\n\n<p>\u3055\u3066\u3001\u672c\u984c\u306eSparse Attention\u306e\u8aac\u660e\u3092\u3057\u3066\u3044\u304d\u307e\u3059\u3002Attention Matrix\u306f\u3001\u5165\u529b\u30c6\u30ad\u30b9\u30c8\u306e\u5404\u5358\u8a9e\uff08\u307e\u305f\u306f\u30c8\u30fc\u30af\u30f3\uff09\u304c\u4ed6\u306e\u3059\u3079\u3066\u306e\u5358\u8a9e\u3068\u3069\u306e\u7a0b\u5ea6\u95a2\u9023\u3057\u3066\u3044\u308b\u304b\u3092\u793a\u3059\u305f\u3081\u3001\u5165\u529b\u30c6\u30ad\u30b9\u30c8\u306e\u9577\u3055\u306b\u5fdc\u3058\u3066\u4e8c\u4e57\u3067\u5927\u304d\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5165\u529b\u30b7\u30fc\u30b1\u30f3\u30b9\u304c\\(n\\)\u500b\u306e\u30c8\u30fc\u30af\u30f3\u304b\u3089\u306a\u308b\u5834\u5408\u3001Attention Matrix\u306f\\(n \u00d7 n\\)\u306e\u30b5\u30a4\u30ba\u3068\u306a\u308a\u3001\u9577\u3044\u30c6\u30ad\u30b9\u30c8\u3092\u6271\u3046\u969b\u306b\u8a08\u7b97\u91cf\u3068\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u304c\u5927\u304d\u304f\u306a\u308b\u3068\u3044\u3046\u554f\u984c\u3092\u5f15\u304d\u8d77\u3053\u3057\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u9577\u3044\u30b7\u30fc\u30b1\u30f3\u30b9\u3092\u52b9\u7387\u7684\u306b\u51e6\u7406\u3059\u308b\u305f\u3081\u306e\u69d8\u3005\u306a\u624b\u6cd5\u304c\u63d0\u6848\u3055\u308c\u3066\u304a\u308a\u3001\u4eca\u304b\u3089\u8aac\u660e\u3059\u308bSparse Attention\u3082\u305d\u306e\uff11\u3064\u3067\u3059\u3002<\/p>\n\n\n\n<p>Sparse Attention\u306f\u3001Attention Matrix\u3092\u30b9\u30d1\u30fc\u30b9\u306b\u3059\u308b\u3053\u3068\u3067Attention\u306e\u8a08\u7b97\u306e\u52b9\u7387\u5316\u3092\u5b9f\u73fe\u3059\u308b\u624b\u6cd5\u3067\u3059\u3002\u30b9\u30d1\u30fc\u30b9\u306a\u884c\u5217\u306b\u95a2\u3059\u308b\u7814\u7a76\u306f\u69d8\u3005\u884c\u308f\u308c\u3066\u304a\u308a\u3001\u30b9\u30d1\u30fc\u30b9\u6027\u3092\u6d3b\u7528\u3059\u308c\u3070\u8a08\u7b97\u52b9\u7387\u5316\u3084\u30e1\u30e2\u30ea\u524a\u6e1b\u3092\u9054\u6210\u3067\u304d\u308b\u53ef\u80fd\u6027\u3092\u79d8\u3081\u3066\u3044\u307e\u3059\u3002Sparse Attention\u306f\u3001\u30b9\u30d1\u30fc\u30b9\u5316\u306e\u6069\u6075\u3092\u4eab\u53d7\u3057\u305f\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u3002\u3067\u306f\u3001Sparse Attention\u3068\u3044\u3046\u306e\u306f\u3001\u3044\u3063\u305f\u3044\u3069\u306e\u3088\u3046\u306a\u8a08\u7b97\u3067\u5b9f\u73fe\u3055\u308c\u3001\u3069\u306e\u3088\u3046\u306a\u7a2e\u985e\u304c\u3042\u308b\u306e\u3067\u3057\u3087\u3046\u304b\u3002\u9806\u306b\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sparse Attention\u306e\u6570\u5f0f\u8868\u73fe<\/h3>\n\n\n\n<p>Scaled Dot-Product Attention\u306e\u6570\u5f0f\u3092\u3082\u3046\u4e00\u5ea6\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>$$<br>Softmax\\left(\\frac{QK^T}{\\sqrt{d_k}}\\right)V<br>$$<\/p>\n\n\n\n<p>\u3053\u3053\u3067Attention Matrix\u306f\u3001\u6570\u5f0f\u4e2d\u306e\\(Softmax\\left(\\frac{QK^T}{\\sqrt{d_k}}\\right)\\)\u3067\u3059\u306e\u3067\u3001\\(A=Softmax\\left(\\frac{QK^T}{\\sqrt{d_k}}\\right)\\)\u3068\u7f6e\u304f\u3068\u3001Attention\u306e\u51fa\u529b\u306f\\(AV\\)\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u3053\u3067\u3001\u6b63\u898f\u5316\u3068\u30bd\u30d5\u30c8\u30de\u30c3\u30af\u30b9\u95a2\u6570\u3092\u9069\u7528\u3059\u308b\u524d\u306eAttention Matrix\u3092\\(\\hat{A}\\)\u3068\u7f6e\u3044\u305f\u3068\u304d\u3001Sparse Attention\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5f0f\u3067\u8868\u3055\u308c\u307e\u3059[4]\u3002<\/p>\n\n\n\n<p>$$<br>\\boldsymbol{\\hat{A}_{ij}} = \\left\\{<br>\\begin{array}{]]}<br>\\boldsymbol{q}_i \\boldsymbol{k}^T_j  &amp; \\text{if token }i\\text{ attends to token }j, \\\\<br>-\\infty&nbsp;&amp;  \\text{if token }i\\text{ does not attend to token }j, <br>\\end{array}<br>\\right.<br>$$<\/p>\n\n\n\n<p>\u3064\u307e\u308a\u3001\u30b7\u30fc\u30b1\u30f3\u30b9\u4e2d\u306e\\(i\\)\u306e\u4f4d\u7f6e\u306e\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u304c\u3001\\(j\\)\u306e\u4f4d\u7f6e\u306e\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u306b\u6ce8\u76ee\u3092\u5411\u3051\u306a\u3044\u3068\u3053\u308d\u306f\u3001\\(-\\infty&nbsp;\\)\u306b\u3057\u3066\u3057\u307e\u3046\u306e\u3067\u3059\u3002\u3042\u308c\u3001\u3053\u308c\u3063\u3066Mask\u64cd\u4f5c\u3068\u540c\u3058\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3063\u305f\u65b9\u3001\u92ed\u3044\u3067\u3059\uff01<\/p>\n\n\n\n<p>Transformer\u306eDecoder\u3067\u306f\u5148\u8aad\u307f\u3057\u306a\u3044\u3088\u3046\u306b\\(j&gt;i\\)\u306e\u30c8\u30fc\u30af\u30f3\u30d9\u30af\u30c8\u30eb\u306f\u4f7f\u7528\u3057\u306a\u3044\u3088\u3046\u306b\u30de\u30b9\u30af\u3055\u308c\u3066\u3044\u305f\u308f\u3051\u3067\u3059\u3002\u305d\u306e\u6642\u306eAttention Matrix\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"319\" height=\"310\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-12.png\" alt=\"\" class=\"wp-image-8349\" srcset=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-12.png 319w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-12-300x292.png 300w\" sizes=\"(max-width: 319px) 100vw, 319px\" \/><\/figure><\/div>\n\n\n<p>\u4e00\u65e6\u3001Decoder\u306e\u8a71\u306f\u7f6e\u3044\u3066\u304a\u304f\u3068\u3057\u3064\u3064\u3082\u3001\u3053\u306e\u3088\u3046\u306b\u6ce8\u610f\u3092\u5411\u3051\u306a\u3044\u90e8\u5206\u3092\u7528\u610f\u3057\u3066\u3001\u30b9\u30d1\u30fc\u30b9\u306b\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306eSparse Attention\u3092\u5177\u4f53\u7684\u306a\u5f0f\u306b\u843d\u3068\u3057\u8fbc\u3080\u3068\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059[3]\u3002<\/p>\n\n\n\n<p>\u63a5\u7d9a\u30d1\u30bf\u30fc\u30f3\\(S=\\{S_1, \\cdots, S_n\\}\\)\u306b\u304a\u3044\u3066\u3001\\(S_i\\)\u306f\\(i\\)\u756a\u76ee\u306e\u51fa\u529b\u30d9\u30af\u30c8\u30eb\u304c\u5165\u529b\u30d9\u30af\u30c8\u30eb\u306e\u30bb\u30c3\u30c8\u3092\u8868\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>$$<br>\\text{Attend}(X, S) = \\left(a(\\boldsymbol{x}_i, S_i)\\right)_{i\\in\\{1,\\cdots,n\\}}<br>$$<\/p>\n\n\n\n<p>$$<br>a(\\boldsymbol{x}_i, S_i) = \\text{softmax}\\left(\\frac{(W_q \\boldsymbol{x}_i) K^T_{S_i}}{\\sqrt{d}}\\right)V_{S_i}<br>$$<\/p>\n\n\n\n<p>$$<br>K_{S_i} = \\left(W_k\\boldsymbol{x}_j\\right)_{j\\in S_i}, V_{S_i} = \\left(W_v\\boldsymbol{x}_j\\right)_{j\\in S_i} <br>$$<\/p>\n\n\n\n<p>\\(j\\in S_i\\)\u3067\u4f7f\u7528\u3059\u308b\u60c5\u5831\u3092\u5236\u9650\u3057\u3066\u3044\u308b\u306e\u3067\u3001\\(K_{S_i}\\)\u306e\u30b5\u30a4\u30ba\u304c\u5c0f\u3055\u304f\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u7406\u89e3\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u3053\u3067\u3001\\(S_i = \\{j:j\\le i\\}\\)\u3068\u3059\u308c\u3070\u3001Decoder\u306eAttention\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sparse Attention\u306e\u7a2e\u985e<\/h3>\n\n\n\n<p>Sparse Attention\u306e\u7a2e\u985e\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002Sparse Attention\u306e\u63a5\u7d9a\u30d1\u30bf\u30fc\u30f3\\(S\\)\u3092\u5b66\u7fd2\u306b\u3088\u308a\u7372\u5f97\u3059\u308b\u304b\u3001\u6c7a\u3081\u6253\u3061\u306b\u3059\u308b\u304b\u3067\u5206\u985e\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u524d\u8005\u3092Dynamic Sparse Attention[5]\u3001\u5f8c\u8005\u3092Static Sparse Attention\u3068\u3044\u3044\u307e\u3059\u3002Static Sparse Attention\u306b\u306f\u3001\u5168\u4f53\u306b\u6ce8\u610f\u3092\u5411\u3051\u3089\u308c\u308b\u6210\u5206\u3092\u6301\u3064Global Attention\u3068\u3001\u5c40\u6240\u7684\u306a\u6ce8\u610f\u306b\u7279\u5316\u3057\u305fLocal Attention\u3001\u30e9\u30f3\u30c0\u30e0\u306b\u6ce8\u610f\u3092\u5411\u3051\u308bRandom Attention\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u308c\u3089\u306eAttention Matrix\u306f\u4e0b\u56f3\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u3053\u308c\u3089\u306f\u5358\u4f53\u3067\u4f7f\u308f\u308c\u308b\u3068\u3044\u3046\u3088\u308a\u306f\u3001Global Attention\u3068Local Attention\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u4f7f\u3044\u65b9\u304c\u4e00\u822c\u7684\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"457\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-10-1024x457.png\" alt=\"\" class=\"wp-image-8314\" srcset=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-10-1024x457.png 1024w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-10-300x134.png 300w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-10-768x343.png 768w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-10-1536x686.png 1536w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-10-2048x915.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u8868\u73fe\u80fd\u529b\u306fSparse\u3067\u5341\u5206\u306a\u306e\u304b<\/strong><\/h3>\n\n\n\n<p>\u4efb\u610f\u306e\u30c8\u30fc\u30af\u30f3\u306f\u3001\u4ed6\u306e\u5168\u3066\u306e\u30c8\u30fc\u30af\u30f3\u306b\u6ce8\u610f\u3092\u5411\u3051\u3089\u308c\u308b\u3079\u304d\u3067\u3057\u3087\u3046\u3002\u3057\u304b\u3057\u3001\u5b66\u7fd2\u3055\u308c\u305f\u6ce8\u610f\u8868\u73fe\u306f\u30b9\u30d1\u30fc\u30b9\u3067\u3042\u308b\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u3001\u69cb\u9020\u7684\u306b\u30b9\u30d1\u30fc\u30b9\u306b\u3057\u3066\u3057\u307e\u3063\u3066\u3082\u554f\u984c\u306f\u306a\u3044\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u3044\u3046\u306e\u304c\u30a2\u30a4\u30c7\u30a3\u30a2\u306e\u30d9\u30fc\u30b9\u306b\u3042\u308a\u307e\u3059\u3002Sparse Attention\u306e\u63a5\u7d9a\u95a2\u4fc2\u3092\u30b0\u30e9\u30d5\u3068\u3057\u3066\u8003\u3048\u3066\u307f\u308b\u3068\u5206\u304b\u308a\u3084\u3059\u3044\u3067\u3059\u3002\u5168\u3066\u304c\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b\u5b8c\u5168\uff12\u90e8\u30b0\u30e9\u30d5\u306f\u3001Full Attention\u3092\u8868\u3057\u307e\u3059\u3002\uff11\u5c64\u306eAttention\u3067\u306f\u3001\u76f4\u63a5\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b\u30ce\u30fc\u30c9\u540c\u58eb\u306e\u60c5\u5831\u306e\u307f\u3092\u8003\u616e\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u591a\u5c64\u306b\u306a\u308b\u3068\u3001\u4f55\u56de\u304b\u8fba\u3092\u8fbf\u308b\u3053\u3068\u3067\u5230\u9054\u3067\u304d\u308b\u30ce\u30fc\u30c9\u306e\u60c5\u5831\u3082\u8003\u616e\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u4e0b\u56f3\u306eBand Attention\u3067\u3042\u308c\u3070\u3001\uff11\u5c64\u3067\u8003\u616e\u3067\u304d\u308b\u306e\u306f\u3001\u81ea\u5206\u81ea\u8eab\u3068\u96a3\u308a\u5408\u3063\u305f2\u3064\u306e\u30ce\u30fc\u30c9\u306e\u307f\u3067\u3059\u304c\u3001\u8907\u6570\u306e\u5c64\u3092\u91cd\u306d\u308b\u3053\u3068\u3067\u3001\u96a3\u63a5\u3057\u3066\u3044\u306a\u3044\u9060\u304f\u306e\u30ce\u30fc\u30c9\u306e\u60c5\u5831\u3082\u8003\u616e\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002Dilated Attention\u306f\u8208\u5473\u6df1\u3044\u3053\u3068\u306b\u3001\u5b8c\u5168\u306b2\u3064\u306b\u5206\u304b\u308c\u3066\u3044\u3066\u3001\u91cd\u306a\u3089\u306a\u3044\u306e\u3067\u3001\u4f55\u5c64\u30b9\u30bf\u30c3\u30af\u3057\u3066\u3082\u3001\u5168\u3066\u3092\u8003\u616e\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u3064\u307e\u308a\u3001\u4f55\u304c\u8a00\u3048\u308b\u304b\u3068\u3044\u3046\u3068\u3001\u6700\u4e0b\u5c64\u306eETC\u306b\u793a\u3059\u3088\u3046\u306b\u3001\u8907\u6570\u306eAttention\u30d1\u30bf\u30fc\u30f3\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u4f7f\u3046\u3053\u3068\u304c\u91cd\u8981\u306b\u306a\u308b\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"557\" src=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-11-1024x557.png\" alt=\"\" class=\"wp-image-8326\" srcset=\"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-11-1024x557.png 1024w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-11-300x163.png 300w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-11-768x417.png 768w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-11-1536x835.png 1536w, https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-11.png 1825w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Sparse Attention\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u304d\u307e\u3057\u305f\u3002Sparse Attention\u306f\u3001Attention Matrix\u3092\u30b9\u30d1\u30fc\u30b9\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u8a08\u7b97\u91cf\u3092\u5927\u5e45\u306b\u524a\u6e1b\u3057\u3001\u52b9\u7387\u7684\u306a\u5b66\u7fd2\u3092\u53ef\u80fd\u306b\u3059\u308b\u6280\u8853\u3067\u3059\u3002\u5177\u4f53\u7684\u306b\u306f\u3001Global Attention\u3001Local Attention\u3001Random Attention\u3001\u305d\u308c\u3089\u3092\u7d44\u307f\u5408\u308f\u305b\u305fAttention\u306a\u3069\u3001\u3055\u307e\u3056\u307e\u306aSparse Attention\u306e\u5f62\u5f0f\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u6280\u8853\u306f\u3001Transformer\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u308b\u305f\u3081\u306e\u91cd\u8981\u306a\u624b\u6bb5\u3068\u306a\u308a\u307e\u3059\u3002<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u53c2\u8003\u6587\u732e<\/h2>\n\n\n\n<p>[1] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin, \"Attention is all you need,\" in Proc. NeurIPS, 2017.<br>[2] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby, \"An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale,\" arXiv, 2020.<br>[3] Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever, \"Generating Long Sequences with Sparse Transformers,\" CoRR, 2020.<br>[4] Tianyang Lin, Yuxin Wang, Xiangyang Liu, and Xipeng Qiu, \"A Survey of Transformers,\" arXiv, 2021.<br>[5] Liu Liu, Zheng Qu, Zhaodong Chen, Yufei Ding, and Yuan Xie, \"Transformer Acceleration with Dynamic Sparse Attention,\" arXiv, 2021.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001Transformer\u306e\u57fa\u790e\u3068\u3057\u3066\u3001Multi-Head Attention\u306e\u4ed5\u7d44\u307f\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002 \u672c\u8a18\u4e8b\u306e\u69cb\u6210\u306f\u3001\u306f\u3058\u3081\u306bTransformer\u304a\u3088\u3073Transformer  &#8230; <\/p>\n","protected":false},"author":1,"featured_media":8372,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"vkexunit_cta_each_option":"","footnotes":""},"categories":[170,171,174,206],"tags":[],"class_list":["post-8277","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-learn","category-dl","category-206"],"jetpack_featured_media_url":"https:\/\/developers.agirobots.com\/jp\/wp-content\/uploads\/2023\/05\/image-13.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/posts\/8277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/comments?post=8277"}],"version-history":[{"count":70,"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/posts\/8277\/revisions"}],"predecessor-version":[{"id":9386,"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/posts\/8277\/revisions\/9386"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/media\/8372"}],"wp:attachment":[{"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/media?parent=8277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/categories?post=8277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developers.agirobots.com\/jp\/wp-json\/wp\/v2\/tags?post=8277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}