{"id":334010,"date":"2022-06-03T15:00:14","date_gmt":"2022-06-03T15:00:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=334010"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=334010","title":{"rendered":"<span>Flash attention is all you need<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.\u00a0<\/p>\n<p>\u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u043e\u0439 \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u0435\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043b\u0435\u0442 \u0432 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0430 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0444\u0435\u0440\u044b \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0433\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u043d\u0435\u043b\u044c\u0437\u044f (\u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u0442\u043e \u043c\u043e\u0436\u043d\u043e) \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438. \u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0441\u0430\u043c\u044b\u043c\u0438 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044f \u0438\u0445 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u0431\u0443\u0434\u044c \u0442\u043e <a href=\"https:\/\/arxiv.org\/abs\/1706.03762\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u043a\u0441\u0442<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/2010.11929\" rel=\"noopener noreferrer nofollow\">\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/2104.01778\" rel=\"noopener noreferrer nofollow\">\u0430\u0443\u0434\u0438\u043e<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/2103.15691\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u0434\u0435\u043e<\/a> \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 <a href=\"https:\/\/www.deepmind.com\/publications\/a-generalist-agent\" rel=\"noopener noreferrer nofollow\">\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u044b<\/a>. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d24\/72a\/c95\/d2472ac95ececaa2f41700f904f3cc23.png\" alt=\"\u0418\u0437 \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e Gato\" title=\"\u0418\u0437 \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e Gato\" width=\"1299\" height=\"945\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d24\/72a\/c95\/d2472ac95ececaa2f41700f904f3cc23.png\"\/><figcaption>\u0418\u0437 \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e Gato<\/figcaption><\/figure>\n<p>\u041d\u043e \u0437\u0430 \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0443\u044e \u043c\u043e\u0449\u044c \u0438 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u043c \u043f\u0430\u043c\u044f\u0442\u0438, \u0438\u0431\u043e \u0441\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0433\u043e\u043b\u043e\u0432\u043e\u0435 \u0447\u0443\u0434\u0438\u0449\u0435 \u043d\u0435\u043d\u0430\u0441\u044b\u0442\u043d\u043e \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u0447\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u0414\u0430 \u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432\u00a0 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 &#8212; \u0434\u0435\u043b\u043e \u043e\u0442\u043d\u044e\u0434\u044c \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435. <\/p>\n<p>\u0412 \u043d\u0435\u0434\u0430\u043b\u0435\u043a\u043e\u043c \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0432\u044b\u0448\u043b\u0430 \u0446\u0435\u043b\u0430\u044f \u043f\u043b\u0435\u044f\u0434\u0430 \u0440\u0430\u0431\u043e\u0442 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0445 \u0443\u0434\u0435\u0448\u0435\u0432\u043b\u0435\u043d\u0438\u044e \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u0439, \u0441\u0432\u043e\u0434\u044f\u0449\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0430\u0441\u0445\u043e\u0434 \u043f\u0430\u043c\u044f\u0442\u0438 \u043a \u0441\u0443\u0431\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u0431\u043e\u043b\u0435\u0435 <a href=\"https:\/\/arxiv.org\/abs\/2006.04768\" rel=\"noopener noreferrer nofollow\">\u043d\u0438\u0437\u043a\u043e\u0433\u043e \u0440\u0430\u043d\u0433\u0430<\/a>,  <a href=\"https:\/\/arxiv.org\/abs\/2001.04451\" rel=\"noopener noreferrer nofollow\">\u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/1904.10509\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f<\/a>,<a href=\"https:\/\/arxiv.org\/abs\/2007.03356\" rel=\"noopener noreferrer nofollow\"> \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/2007.14062\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e<\/a> \u0438 \u0432\u0430\u0433\u043e\u043d \u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0442\u0435\u043b\u0435\u0436\u043a\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u0434\u0435\u0439. \u041c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u0434\u0430\u0432\u0430\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043f\u043e\u0442\u0435\u0440\u044e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e vanilla attention, \u043d\u043e \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432 \u0435\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0431\u044b\u043b\u043e \u0438 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3c9\/f25\/2a1\/3c9f252a1376a23e1c0f0728442ed2b7.png\" alt=\"\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0438\u0445 \u0441\u043c\u0435\u0441\u044c - BigBird\" title=\"\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0438\u0445 \u0441\u043c\u0435\u0441\u044c - BigBird\" width=\"1122\" height=\"340\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3c9\/f25\/2a1\/3c9f252a1376a23e1c0f0728442ed2b7.png\"\/><figcaption>\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0438\u0445 \u0441\u043c\u0435\u0441\u044c &#8212; BigBird<\/figcaption><\/figure>\n<p>\u0418 \u043d\u0430 \u0434\u043d\u044f\u0445 \u0432\u044b\u0448\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 <a href=\"https:\/\/arxiv.org\/abs\/2205.14135\" rel=\"noopener noreferrer nofollow\"><strong>Flash Attention<\/strong><\/a><strong>,<\/strong> \u0433\u0434\u0435 \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 attention \u043d\u0430 GPU, \u043f\u0440\u0438\u0447\u0435\u043c \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0422\u043e \u0435\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u0438 \u043f\u0440\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u043d\u043e \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443.<\/p>\n<h2>\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0438\u0434\u0435\u044f<\/h2>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u043e\u043c \u0443\u0441\u043f\u0435\u0445\u0430 <strong>Flash Attention<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0435 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0441\u0430\u043c\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u0438\u0431\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0438 \u0441 \u043b\u0435\u0433\u0438\u043e\u043d\u043e\u043c CUDA \u044f\u0434\u0435\u0440 \u0438 \u0432\u0441\u044f\u043a\u0438\u043c\u0438 \u043d\u0430\u0432\u043e\u0440\u043e\u0442\u0430\u043c\u0438 \u0432\u044b\u0434\u0430\u044e\u0442 \u0442\u0443\u0447\u0443 \u0442\u0435\u0440\u0430\u0444\u043b\u043e\u043f\u0441, \u0430 \u043d\u0430 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u0434\u0440\u0443\u0437\u043a\u0443 \u043c\u0430\u0442\u0440\u0438\u0446 \u0438 \u0442\u0435\u043d\u0437\u043e\u0440\u043e\u0432. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2cb\/3ee\/680\/2cb3ee68094e96a04288008aefb8d588.png\" alt=\"(\u0421\u043b\u0435\u0432\u0430) \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u0430 GPU.  (\u0421\u043f\u0440\u0430\u0432\u0430) \u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.\" title=\"(\u0421\u043b\u0435\u0432\u0430) \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u0430 GPU.  (\u0421\u043f\u0440\u0430\u0432\u0430) \u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.\" width=\"1038\" height=\"544\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2cb\/3ee\/680\/2cb3ee68094e96a04288008aefb8d588.png\"\/><figcaption>(\u0421\u043b\u0435\u0432\u0430) \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u0430 GPU.  (\u0421\u043f\u0440\u0430\u0432\u0430) \u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.<\/figcaption><\/figure>\n<p>\u041f\u0430\u043c\u044f\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u044b \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e &#8212; \u0435\u0441\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u043a\u044d\u0448 \u043f\u0430\u043c\u044f\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u0432\u0441\u0435\u0433\u043e \u043f\u0430\u0440\u0430 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442, \u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0430\u044f, \u043d\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u043e <strong>HBM<\/strong> (high bandwidth memory). \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 1 \u0422\u0431\/\u0441 \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0430, <strong>HBM<\/strong> \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0435 \u043f\u043e\u0441\u043f\u0435\u0432\u0430\u0435\u0442 \u0437\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u043c\u0438 (\u043f\u0430\u043c\u044f\u0442\u044c \u043f\u0440\u0435\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u0430 \u0435\u0433\u043e, \u043d\u043e \u043e\u043d \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435). <\/p>\n<h2>\u041a\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 attention?<\/h2>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b  <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"Q\" alt=\"Q\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/073\/168\/f79\/073168f7912e2edd90e787410f7ad912.svg\" width=\"15\" height=\"20\"\/>(query), <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"K\" alt=\"K\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d18\/aff\/7e9\/d18aff7e98442c3a329eeee6f03c5b07.svg\" width=\"17\" height=\"17\"\/>(key), <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"V\" alt=\"V\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5ba\/82a\/674\/5ba82a6741a033829d126a9f734d5589.svg\" width=\"15\" height=\"17\"\/> (value) \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u043e \u0438\u0437 <strong>HBM<\/strong> \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 &#8212; \u043c\u0430\u0442\u0440\u0438\u0446\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"S = Q K^T\" alt=\"S = Q K^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d9c\/abe\/bf9\/d9cabebf9313d5364ab7303641662069.svg\" width=\"83\" height=\"24\"\/>\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\mathrm{P = softmax} (Q K^T \/ \\sqrt{d})\" alt=\"\\mathrm{P = softmax} (Q K^T \/ \\sqrt{d})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f8b\/867\/78d\/f8b86778d70fe4412c1a36dccdaab7cc.svg\" width=\"205\" height=\"25\"\/> &#8212; \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0438\u0437 <strong>HBM<\/strong> \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u043a\u044d\u0448 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 <code><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N d + N^2)\" alt=\"O(N d + N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/70d\/0cd\/723\/70d0cd72308c6b21c7c3d2217cbc53c8.svg\" width=\"113\" height=\"26\"\/><\/code>\u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u043f\u0430\u043c\u044f\u0442\u0438. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/84a\/4e8\/a54\/84a4e8a5465fd227c8d3d234141d2745.png\" alt=\"\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f attention. \u0418\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.\" title=\"\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f attention. \u0418\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.\" width=\"1592\" height=\"280\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/84a\/4e8\/a54\/84a4e8a5465fd227c8d3d234141d2745.png\"\/><figcaption>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f attention. \u0418\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/figcaption><\/figure>\n<h2>\u00a0\u0410 \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 Flash Attention?<\/h2>\n<h4>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438 \u0431\u043b\u043e\u043a\u0430\u043c\u0438<\/h4>\n<p>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 &#8212; \u043c\u0430\u0442\u0440\u0438\u0446\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"Q, K, V\" alt=\"Q, K, V\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c34\/0a3\/21a\/c340a321a846baa8cbfa3628c16f7dc3.svg\" width=\"65\" height=\"20\"\/>&#8212; \u043d\u0430\u0440\u0435\u0437\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0431\u043b\u043e\u043a\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0442\u0430\u043a\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0432\u043b\u0435\u0437\u0430\u043b\u043e \u0432 \u043a\u044d\u0448.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"Q, K\" alt=\"Q, K\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/192\/765\/942\/192765942a825dad2fcc68bc14d71613.svg\" width=\"42\" height=\"20\"\/>\u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u043e (<a href=\"https:\/\/mathworld.wolfram.com\/BlockMatrix.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0440\u0435\u0432\u043d\u044f\u044f \u0442\u0435\u043c\u0430<\/a>). \u0418 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\mathrm{softmax}\" alt=\"\\mathrm{softmax}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4c5\/7ee\/386\/4c57ee38658dbd900c58fc04f6952fc5.svg\" width=\"69\" height=\"17\"\/>, \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0431\u043b\u043e\u043a \u0437\u0430 \u0431\u043b\u043e\u043a\u043e\u043c, \u043f\u0440\u0438\u0447\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0442 (\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u043a\u0442\u043e\u0440) \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043e\u0432 \u0431\u043b\u043e\u043a\u0430. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dcd\/fb0\/482\/dcdfb0482ba12353ae56e90d32fb5132.png\" alt=\"\u041a\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f softmax\" title=\"\u041a\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f softmax\" width=\"1450\" height=\"148\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dcd\/fb0\/482\/dcdfb0482ba12353ae56e90d32fb5132.png\"\/><figcaption>\u041a\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f softmax<\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0ff\/671\/3af\/0ff6713afb81f93f4595d5ee84f1b52e.png\" alt=\"\u0421\u043b\u0438\u044f\u043d\u0438\u0435 softmax \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432\" title=\"\u0421\u043b\u0438\u044f\u043d\u0438\u0435 softmax \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432\" width=\"1548\" height=\"248\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0ff\/671\/3af\/0ff6713afb81f93f4595d5ee84f1b52e.png\"\/><figcaption>\u0421\u043b\u0438\u044f\u043d\u0438\u0435 softmax \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432<\/figcaption><\/figure>\n<h4>\u041f\u0435\u0440\u0435\u0441\u0447\u0435\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446<\/h4>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u0441\u0438\u0441\u0442\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"S\" alt=\"S\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f13\/a6d\/53d\/f13a6d53d662499a75cc1554a32297c2.svg\" width=\"13\" height=\"17\"\/>\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"P\" alt=\"P\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e8c\/380\/877\/e8c3808777852a128eeff07cb678ab24.svg\" width=\"15\" height=\"17\"\/>\u0440\u0430\u0437\u043c\u0435\u0440\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^2)\" alt=\"O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c57\/ff1\/ac7\/c57ff1ac7313593bbd210d14060eadc2.svg\" width=\"57\" height=\"25\"\/> \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b \u0432\u0435\u0441\u043e\u0432 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0435. \u041d\u043e \u0437\u043d\u0430\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u043a\u0442\u043e\u0440\u044b \u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\mathrm{softmax}\" alt=\"\\mathrm{softmax}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/91c\/ba6\/13c\/91cba613c1342c1d3c6cc9f0b3cd0a9a.svg\" width=\"69\" height=\"17\"\/> \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b \u0441\u043b\u043e\u044f, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c (\u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043a \u0441\u0442\u0430\u0442\u044c\u0435). \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u043d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0443\u0445\u043e\u0434\u0438\u043b\u043e \u043d\u0430 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u0438\u043c\u0435\u0435\u043c \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. <\/p>\n<h4>\u0421\u043b\u0438\u044f\u043d\u0438\u0435 \u044f\u0434\u0435\u0440<\/h4>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\mathrm{softmax}\" alt=\"\\mathrm{softmax}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/342\/04a\/b6e\/34204ab6eda874fd2fc872b4a1f3a9fb.svg\" width=\"69\" height=\"17\"\/>, dropout) \u0440\u0430\u0437\u043e\u043c \u0432 \u043e\u0434\u043d\u043e\u043c \u0421UDA kernel, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0433\u0434\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0431\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u044f\u0434\u0440\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u043c \u0440\u0430\u0441\u0445\u043e\u0434\u0430\u043c. <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/64a\/bf1\/69e\/64abf169e8ef040367a17a5a74e94a35.png\" alt=\"Attention \u0432 PyTorch \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 Flash Attention\" title=\"Attention \u0432 PyTorch \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 Flash Attention\" width=\"386\" height=\"412\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/64a\/bf1\/69e\/64abf169e8ef040367a17a5a74e94a35.png\"\/><figcaption>Attention \u0432 PyTorch \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 Flash Attention<\/figcaption><\/figure>\n<h4>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/143\/f6c\/366\/143f6c36635f8addf70aea519ebd6ca5.png\" alt=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c Flash Attention\" title=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c Flash Attention\" width=\"1596\" height=\"926\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/143\/f6c\/366\/143f6c36635f8addf70aea519ebd6ca5.png\"\/><figcaption>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c Flash Attention<\/figcaption><\/figure>\n<p>Flash attention \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e attention <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O = \\mathrm{softmax}(Q K^T\/\\sqrt{d}) V\" alt=\"O = \\mathrm{softmax}(Q K^T\/\\sqrt{d}) V\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/522\/047\/e62\/522047e62f4966125f9beff30d9c8634.svg\" width=\"221\" height=\"25\"\/>\u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^2d)\" alt=\"O(N^2d)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8f7\/fad\/e7a\/8f7fade7a03eb5fa32871643b2cdba75.svg\" width=\"67\" height=\"25\"\/> (\u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e attention) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N)\" alt=\"O(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8bb\/9a9\/fd0\/8bb9a9fd073df327b0d3163374a27bd9.svg\" width=\"48\" height=\"22\"\/>\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. <\/p>\n<h2>\u0411\u043b\u043e\u0447\u043d\u043e-\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0439  Flash Attention<\/h2>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0430\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 (\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c). \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0443\u043d\u0438\u043d\u0433 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439. \u041f\u043e\u0434\u043e\u0431\u0440\u0430\u0432 \u0443\u0434\u0430\u0447\u043d\u044b\u043c \u0438\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u0430\u0441\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435 \u0442\u0435\u0440\u044f\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/060\/321\/967\/0603219674b5bd2c195d11b00343ef6f.png\" alt=\"\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u0447\u043d\u043e-\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 Q \u0438 K \u043c\u0430\u0441\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043c\u0430\u0441\u043a\u043e\u0439. \" title=\"\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u0447\u043d\u043e-\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 Q \u0438 K \u043c\u0430\u0441\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043c\u0430\u0441\u043a\u043e\u0439. \" width=\"1058\" height=\"74\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/060\/321\/967\/0603219674b5bd2c195d11b00343ef6f.png\"\/><figcaption>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u0447\u043d\u043e-\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 Q \u0438 K \u043c\u0430\u0441\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043c\u0430\u0441\u043a\u043e\u0439. <\/figcaption><\/figure>\n<h2>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b<\/h2>\n<p>\u0410\u0432\u0442\u043e\u0440\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0441\u0432\u043e\u0435 \u0434\u0435\u0442\u0438\u0449\u0435 \u043d\u0430 \u0442\u0440\u0435\u0445 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u0445:<\/p>\n<ol>\n<li>\n<p>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 BERT\u0430 \u043d\u0430 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c23\/362\/d50\/c23362d501c5bcbf08777f55f57d1e8c.png\" alt=\"\u0412\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f BERT-large \u043d\u0430 8 GPU A100 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 72% \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u0430\" title=\"\u0412\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f BERT-large \u043d\u0430 8 GPU A100 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 72% \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u0430\" width=\"752\" height=\"124\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c23\/362\/d50\/c23362d501c5bcbf08777f55f57d1e8c.png\"\/><figcaption>\u0412\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f BERT-large \u043d\u0430 8 GPU A100 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 72% \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u0430<\/figcaption><\/figure>\n<\/li>\n<li>\n<p>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 GPT-2 \u043d\u0430 OpenWebtext<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/83d\/1a9\/c16\/83d1a9c167a2f0337fc51213dde16469.png\" alt=\"\u0412\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 OpenWebtext \u0438 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0431\u0435\u0439\u0437\u043b\u0430\u0439\u043d\u043e\u043c \u043e\u0442 \u041e\u0431\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0445\u0441\u044f\u041b\u0438\u0446\" title=\"\u0412\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 OpenWebtext \u0438 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0431\u0435\u0439\u0437\u043b\u0430\u0439\u043d\u043e\u043c \u043e\u0442 \u041e\u0431\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0445\u0441\u044f\u041b\u0438\u0446\" width=\"1214\" height=\"310\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/83d\/1a9\/c16\/83d1a9c167a2f0337fc51213dde16469.png\"\/><figcaption>\u0412\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 OpenWebtext \u0438 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0431\u0435\u0439\u0437\u043b\u0430\u0439\u043d\u043e\u043c \u043e\u0442 \u041e\u0431\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0445\u0441\u044f\u041b\u0438\u0446<\/figcaption><\/figure>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043d\u0430 <a href=\"https:\/\/openreview.net\/forum?id=qVyeW-grC2k\" rel=\"noopener noreferrer nofollow\">Long-range Arena<\/a><\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/575\/26c\/95d\/57526c95d1d9ef974f38141a9a4f7b02.png\" alt=\"\u0420\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b Attention \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0438\u0437 Long-range arena benchmark. \u041f\u043e\u0434 \u0447\u0435\u0440\u0442\u043e\u0439 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u043e\u0433\u043e\/\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.\" title=\"\u0420\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b Attention \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0438\u0437 Long-range arena benchmark. \u041f\u043e\u0434 \u0447\u0435\u0440\u0442\u043e\u0439 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u043e\u0433\u043e\/\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.\" width=\"1508\" height=\"432\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/575\/26c\/95d\/57526c95d1d9ef974f38141a9a4f7b02.png\"\/><figcaption>\u0420\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b Attention \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0438\u0437 Long-range arena benchmark. \u041f\u043e\u0434 \u0447\u0435\u0440\u0442\u043e\u0439 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u043e\u0433\u043e\/\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.<\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, FlashAttention \u0431\u044c\u0435\u0442 \u0434\u0430\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e BERT \u043e\u0442 Nvidia. \u0415\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u0437\u0430\u043c\u0435\u0442\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f GPT-2 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0438 \u0443 Flash Attention. \u041d\u0430 Long-range arena Flash Attention \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u0435\u0435 \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043e\u0432 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0448\u0435\u0432\u044b\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435\u043c, \u0431\u0443\u0434\u0443\u0447\u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0449\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0411\u043b\u043e\u0447\u043d\u043e-\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0434\u0430\u0435\u0442 \u0435\u0449\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u043d\u0435 \u0442\u0435\u0440\u044f\u044f \u043f\u043e \u0441\u0443\u0442\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0430\u0432\u0442\u043e\u0440\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0430 \u043f\u043e \u0441\u0435\u0442\u0438 \u0438 \u0440\u0430\u0441\u0445\u043e\u0434 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0438 &#171;\u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u043e\u0433\u043e&#187; \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041f\u0440\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0434\u043b\u0438\u043d\u0430\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 Flash Attention \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u0435\u0449\u0435 \u044d\u043a\u043e\u043d\u043e\u043c\u043d\u0435\u0435 \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/382\/37f\/53d\/38237f53deda00b40dfe33c2ff7363bc.png\" alt=\"(\u0421\u043b\u0435\u0432\u0430) \u0412\u0440\u0435\u043c\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0430 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0432\u043e\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (\u0421\u043f\u0440\u0430\u0432\u0430) \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0445\u043e\u0434\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0442 \u0434\u043b\u0438\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.\" title=\"(\u0421\u043b\u0435\u0432\u0430) \u0412\u0440\u0435\u043c\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0430 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0432\u043e\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (\u0421\u043f\u0440\u0430\u0432\u0430) \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0445\u043e\u0434\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0442 \u0434\u043b\u0438\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.\" width=\"1382\" height=\"472\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/382\/37f\/53d\/38237f53deda00b40dfe33c2ff7363bc.png\"\/><figcaption>(\u0421\u043b\u0435\u0432\u0430) \u0412\u0440\u0435\u043c\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0430 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0432\u043e\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (\u0421\u043f\u0440\u0430\u0432\u0430) \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0445\u043e\u0434\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0442 \u0434\u043b\u0438\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/figcaption><\/figure>\n<p>\u0418 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0438\u0448\u0435\u043d\u043a\u0438 \u043d\u0430 \u0442\u043e\u0440\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u044b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441\u043c\u043e\u0433\u043b\u0438 \u0441 \u0445\u043e\u0442\u044c \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0443\u0441\u043f\u0435\u0445\u043e\u043c \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 Path-X (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 128&#215;128), Path-256 (256&#215;256) \u0441 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u044b\u0448\u0435 \u0432\u044b\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0433\u0430\u0434\u0430\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u0444\u0435\u0439\u043d\u043e\u0439 \u0433\u0443\u0449\u0435. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c &#8212; \u043d\u0430\u0439\u0442\u0438, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u043f\u0443\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0431\u0435\u043b\u044b\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u043d\u0430 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0438\u043b\u0438 \u043d\u0435\u0442.  \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u0442\u0443\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0440\u0435\u0431\u0435\u043d\u043e\u043a. \u0420\u0435\u0431\u0435\u043d\u043e\u043a-\u0442\u043e \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u0430 \u0432\u043e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u0438\u043d\u044b \u043f\u043e\u0440\u044f\u0434\u043a\u0430 10000 \u043d\u0435 \u0432\u043b\u0435\u0437\u0435\u0442 \u0434\u0430\u0436\u0435 \u0432 \u043e\u0447\u0435\u043d\u044c \u0435\u043c\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u0432 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435, \u0434\u0430 \u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043d\u0435 \u0442\u0430\u043a-\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043b\u0438\u0431\u043e \u043f\u0430\u0434\u0430\u043b\u0438 \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438, \u043b\u0438\u0431\u043e \u0432\u044b\u0434\u0430\u0432\u0430\u043b\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 (\u0442.\u0435 50%). \u0422\u0443\u0442 \u0436\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0431\u0438\u0442\u044c ~60%.  <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/be5\/bab\/112\/be5bab11221eac66846e36bc15d5b0b9.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 Path-X\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 Path-X\" width=\"346\" height=\"416\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/be5\/bab\/112\/be5bab11221eac66846e36bc15d5b0b9.png\"\/><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 Path-X<\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/102\/da7\/228\/102da7228fe8da64dbc8b09158727a9c.png\" alt=\"\u0412\u0441\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0434\u043e Flash Attention \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 Path-X\/256\" title=\"\u0412\u0441\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0434\u043e Flash Attention \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 Path-X\/256\" width=\"572\" height=\"292\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/102\/da7\/228\/102da7228fe8da64dbc8b09158727a9c.png\"\/><figcaption>\u0412\u0441\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0434\u043e Flash Attention \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 Path-X\/256<\/figcaption><\/figure>\n<p>\u0412\u0441\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u044b\u043b\u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0441 \u041d\u0432\u0438\u0434\u0438\u0435\u0432\u0441\u043a\u043e\u0439 A100. <\/p>\n<h2>\u0411\u0443\u0434\u0443\u0449\u0438\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u043e\u0431\u043e\u0431\u0449\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 GPU. \u041a\u0440\u043e\u043c\u0435 \u0443\u0447\u0435\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u043a\u044d\u0448\u0430 \u043a <strong>HBM<\/strong> \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u0438 \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0435\u0449\u0435 \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a (\u043f\u043e\u0440\u044f\u0434\u043a\u0438) \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0438 \u043f\u043e\u0442\u043e\u0447\u0435\u0447\u043d\u0443\u044e \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0441\u0442\u044c \u0432 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0435 (\u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 FFN (feed forward net) \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u043e\u043a\u0435\u043d\u0443) \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043a \u0431\u043b\u043e\u0447\u043d\u044b\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f\u043c. <\/p>\n<h2>\u0418\u0442\u043e\u0433<\/h2>\n<p>\u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043e\u0432 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 \u0438 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0447\u0442\u043e \u0432\u043b\u0435\u0447\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044e \u0434\u0435\u043d\u0435\u0433, \u044d\u043b\u0435\u0442\u043a\u0440\u043e\u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0438 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432 CO2 (\u043a\u0443\u0434\u0430 \u0431\u0435\u0437 \u0437\u0435\u043b\u0435\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0441\u0442\u043a\u0438). \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u043f\u043b\u043e\u0449\u0435\u043d\u0430 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0444\u0440\u0435\u0439\u0432\u043e\u0440\u043a\u0430\u0445 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e, \u043d\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u043c\u0435\u0442\u0435\u043d.<\/p>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438 \u0438 \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430 <\/h2>\n<p><a href=\"https:\/\/arxiv.org\/abs\/2205.14135\" rel=\"noopener noreferrer nofollow\">\u0421\u0430\u043c\u0430 \u0441\u0442\u0430\u0442\u044c\u044f <\/a><\/p>\n<p><a href=\"https:\/\/github.com\/HazyResearch\/flash-attention\" rel=\"noopener noreferrer nofollow\">\u0413\u0438\u0442\u0445\u0430\u0431-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a><\/p>\n<p><a href=\"https:\/\/www.google.com\/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=&amp;ved=2ahUKEwik1eDiqpH4AhVOSPEDHetIAwIQFnoECAIQAQ&amp;url=https%3A%2F%2Ftwitter.com%2Ftri_dao%2Fstatus%2F1531437619791290369&amp;usg=AOvVaw36UAdi20hYAeqXp7VY1P1s\" rel=\"noopener noreferrer nofollow\">\u0411\u043b\u043e\u0433 \u043d\u0430 \u0442\u0432\u0438\u0442\u0442\u0435\u0440\u0435 \u043e\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u0439<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/669506\/\"> https:\/\/habr.com\/ru\/post\/669506\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.\u00a0<\/p>\n<p>\u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u043e\u0439 \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u0435\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043b\u0435\u0442 \u0432 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0430 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0444\u0435\u0440\u044b \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0433\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u043d\u0435\u043b\u044c\u0437\u044f (\u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u0442\u043e \u043c\u043e\u0436\u043d\u043e) \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438. \u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0441\u0430\u043c\u044b\u043c\u0438 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044f \u0438\u0445 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u0431\u0443\u0434\u044c \u0442\u043e <a href=\"https:\/\/arxiv.org\/abs\/1706.03762\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u043a\u0441\u0442<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/2010.11929\" rel=\"noopener noreferrer nofollow\">\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/2104.01778\" rel=\"noopener noreferrer nofollow\">\u0430\u0443\u0434\u0438\u043e<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/2103.15691\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u0434\u0435\u043e<\/a> \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 <a href=\"https:\/\/www.deepmind.com\/publications\/a-generalist-agent\" rel=\"noopener noreferrer nofollow\">\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u044b<\/a>. <\/p>\n<figure class=\"full-width\"><figcaption>\u0418\u0437 \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e Gato<\/figcaption><\/figure>\n<p>\u041d\u043e \u0437\u0430 \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0443\u044e \u043c\u043e\u0449\u044c \u0438 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u043c \u043f\u0430\u043c\u044f\u0442\u0438, \u0438\u0431\u043e \u0441\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0433\u043e\u043b\u043e\u0432\u043e\u0435 \u0447\u0443\u0434\u0438\u0449\u0435 \u043d\u0435\u043d\u0430\u0441\u044b\u0442\u043d\u043e \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u0447\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u0414\u0430 \u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432\u00a0 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 &#8212; \u0434\u0435\u043b\u043e \u043e\u0442\u043d\u044e\u0434\u044c \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435. <\/p>\n<p>\u0412 \u043d\u0435\u0434\u0430\u043b\u0435\u043a\u043e\u043c \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0432\u044b\u0448\u043b\u0430 \u0446\u0435\u043b\u0430\u044f \u043f\u043b\u0435\u044f\u0434\u0430 \u0440\u0430\u0431\u043e\u0442 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0445 \u0443\u0434\u0435\u0448\u0435\u0432\u043b\u0435\u043d\u0438\u044e \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u0439, \u0441\u0432\u043e\u0434\u044f\u0449\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0430\u0441\u0445\u043e\u0434 \u043f\u0430\u043c\u044f\u0442\u0438 \u043a \u0441\u0443\u0431\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u0431\u043e\u043b\u0435\u0435 <a href=\"https:\/\/arxiv.org\/abs\/2006.04768\" rel=\"noopener noreferrer nofollow\">\u043d\u0438\u0437\u043a\u043e\u0433\u043e \u0440\u0430\u043d\u0433\u0430<\/a>,  <a href=\"https:\/\/arxiv.org\/abs\/2001.04451\" rel=\"noopener noreferrer nofollow\">\u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/1904.10509\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f<\/a>,<a href=\"https:\/\/arxiv.org\/abs\/2007.03356\" rel=\"noopener noreferrer nofollow\"> \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/2007.14062\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e<\/a> \u0438 \u0432\u0430\u0433\u043e\u043d \u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0442\u0435\u043b\u0435\u0436\u043a\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u0434\u0435\u0439. \u041c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u0434\u0430\u0432\u0430\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043f\u043e\u0442\u0435\u0440\u044e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e vanilla attention, \u043d\u043e \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432 \u0435\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0431\u044b\u043b\u043e \u0438 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c. <\/p>\n<figure class=\"full-width\"><figcaption>\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0438\u0445 \u0441\u043c\u0435\u0441\u044c &#8212; BigBird<\/figcaption><\/figure>\n<p>\u0418 \u043d\u0430 \u0434\u043d\u044f\u0445 \u0432\u044b\u0448\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 <a href=\"https:\/\/arxiv.org\/abs\/2205.14135\" rel=\"noopener noreferrer nofollow\"><strong>Flash Attention<\/strong><\/a><strong>,<\/strong> \u0433\u0434\u0435 \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 attention \u043d\u0430 GPU, \u043f\u0440\u0438\u0447\u0435\u043c \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0422\u043e \u0435\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u0438 \u043f\u0440\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u043d\u043e \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443.<\/p>\n<h2>\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0438\u0434\u0435\u044f<\/h2>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u043e\u043c \u0443\u0441\u043f\u0435\u0445\u0430 <strong>Flash Attention<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0435 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0441\u0430\u043c\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u0438\u0431\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0438 \u0441 \u043b\u0435\u0433\u0438\u043e\u043d\u043e\u043c CUDA \u044f\u0434\u0435\u0440 \u0438 \u0432\u0441\u044f\u043a\u0438\u043c\u0438 \u043d\u0430\u0432\u043e\u0440\u043e\u0442\u0430\u043c\u0438 \u0432\u044b\u0434\u0430\u044e\u0442 \u0442\u0443\u0447\u0443 \u0442\u0435\u0440\u0430\u0444\u043b\u043e\u043f\u0441, \u0430 \u043d\u0430 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u0434\u0440\u0443\u0437\u043a\u0443 \u043c\u0430\u0442\u0440\u0438\u0446 \u0438 \u0442\u0435\u043d\u0437\u043e\u0440\u043e\u0432. <\/p>\n<figure class=\"full-width\"><figcaption>(\u0421\u043b\u0435\u0432\u0430) \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u0430 GPU.  (\u0421\u043f\u0440\u0430\u0432\u0430) \u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.<\/figcaption><\/figure>\n<p>\u041f\u0430\u043c\u044f\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u044b \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e &#8212; \u0435\u0441\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u043a\u044d\u0448 \u043f\u0430\u043c\u044f\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u0432\u0441\u0435\u0433\u043e \u043f\u0430\u0440\u0430 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442, \u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0430\u044f, \u043d\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u043e <strong>HBM<\/strong> (high bandwidth memory). \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 1 \u0422\u0431\/\u0441 \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0430, <strong>HBM<\/strong> \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0435 \u043f\u043e\u0441\u043f\u0435\u0432\u0430\u0435\u0442 \u0437\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u043c\u0438 (\u043f\u0430\u043c\u044f\u0442\u044c \u043f\u0440\u0435\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u0430 \u0435\u0433\u043e, \u043d\u043e \u043e\u043d \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435). <\/p>\n<h2>\u041a\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 attention?<\/h2>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b  (query), (key),  (value) \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u043e \u0438\u0437 <strong>HBM<\/strong> \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 &#8212; \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438  &#8212; \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0438\u0437 <strong>HBM<\/strong> \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u043a\u044d\u0448 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 <code><\/code>\u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u043f\u0430\u043c\u044f\u0442\u0438. <\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f attention. \u0418\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/figcaption><\/figure>\n<h2>\u00a0\u0410 \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 Flash Attention?<\/h2>\n<h4>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438 \u0431\u043b\u043e\u043a\u0430\u043c\u0438<\/h4>\n<p>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 &#8212; \u043c\u0430\u0442\u0440\u0438\u0446\u044b &#8212; \u043d\u0430\u0440\u0435\u0437\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0431\u043b\u043e\u043a\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0442\u0430\u043a\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0432\u043b\u0435\u0437\u0430\u043b\u043e \u0432 \u043a\u044d\u0448.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u043e (<a href=\"https:\/\/mathworld.wolfram.com\/BlockMatrix.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0440\u0435\u0432\u043d\u044f\u044f \u0442\u0435\u043c\u0430<\/a>). \u0418 , \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0431\u043b\u043e\u043a \u0437\u0430 \u0431\u043b\u043e\u043a\u043e\u043c, \u043f\u0440\u0438\u0447\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0442 (\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u043a\u0442\u043e\u0440) \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043e\u0432 \u0431\u043b\u043e\u043a\u0430. <\/p>\n<figure class=\"full-width\"><figcaption>\u041a\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f softmax<\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption>\u0421\u043b\u0438\u044f\u043d\u0438\u0435 softmax \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432<\/figcaption><\/figure>\n<h4>\u041f\u0435\u0440\u0435\u0441\u0447\u0435\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446<\/h4>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u0441\u0438\u0441\u0442\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430  \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b \u0432\u0435\u0441\u043e\u0432 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0435. \u041d\u043e \u0437\u043d\u0430\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u043a\u0442\u043e\u0440\u044b \u0432  \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b \u0441\u043b\u043e\u044f, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c (\u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043a \u0441\u0442\u0430\u0442\u044c\u0435). \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u043d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0443\u0445\u043e\u0434\u0438\u043b\u043e \u043d\u0430 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u0438\u043c\u0435\u0435\u043c \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. <\/p>\n<h4>\u0421\u043b\u0438\u044f\u043d\u0438\u0435 \u044f\u0434\u0435\u0440<\/h4>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446, , dropout) \u0440\u0430\u0437\u043e\u043c \u0432 \u043e\u0434\u043d\u043e\u043c \u0421UDA kernel, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0433\u0434\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0431\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u044f\u0434\u0440\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u043c \u0440\u0430\u0441\u0445\u043e\u0434\u0430\u043c. <\/p>\n<figure class=\"\"><figcaption>Attention \u0432 PyTorch \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 Flash Attention<\/figcaption><\/figure>\n<h4>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/h4>\n<figure class=\"full-width\"><figcaption>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c Flash Attention<\/figcaption><\/figure>\n<p>Flash attention \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e attention \u0437\u0430  (\u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e attention) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. <\/p>\n<h2>\u0411\u043b\u043e\u0447\u043d\u043e-\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0439  Flash Attention<\/h2>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0430\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 (\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c). \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0443\u043d\u0438\u043d\u0433 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439. \u041f\u043e\u0434\u043e\u0431\u0440\u0430\u0432 \u0443\u0434\u0430\u0447\u043d\u044b\u043c \u0438\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u0430\u0441\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435 \u0442\u0435\u0440\u044f\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435. <\/p>\n<figure class=\"full-width\"><figcaption>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u0447\u043d\u043e-\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 Q \u0438 K \u043c\u0430\u0441\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043c\u0430\u0441\u043a\u043e\u0439. <\/figcaption><\/figure>\n<h2>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b<\/h2>\n<p>\u0410\u0432\u0442\u043e\u0440\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0441\u0432\u043e\u0435 \u0434\u0435\u0442\u0438\u0449\u0435 \u043d\u0430 \u0442\u0440\u0435\u0445 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u0445:<\/p>\n<ol>\n<li>\n<p>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 BERT\u0430 \u043d\u0430 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438<\/p>\n<figure class=\"full-width\"><figcaption>\u0412\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f BERT-large \u043d\u0430 8 GPU A100 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 72% \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u0430<\/figcaption><\/figure>\n<\/li>\n<li>\n<p>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 GPT-2 \u043d\u0430 OpenWebtext<\/p>\n<figure class=\"full-width\"><figcaption>\u0412\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 OpenWebtext \u0438 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0431\u0435\u0439\u0437\u043b\u0430\u0439\u043d\u043e\u043c \u043e\u0442 \u041e\u0431\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0445\u0441\u044f\u041b\u0438\u0446<\/figcaption><\/figure>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043d\u0430 <a href=\"https:\/\/openreview.net\/forum?id=qVyeW-grC2k\" rel=\"noopener noreferrer nofollow\">Long-range Arena<\/a><\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><figcaption>\u0420\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b Attention \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0438\u0437 Long-range arena benchmark. \u041f\u043e\u0434 \u0447\u0435\u0440\u0442\u043e\u0439 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u043e\u0433\u043e\/\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.<\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, FlashAttention \u0431\u044c\u0435\u0442 \u0434\u0430\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e BERT \u043e\u0442 Nvidia. \u0415\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u0437\u0430\u043c\u0435\u0442\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f GPT-2 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0438 \u0443 Flash Attention. \u041d\u0430 Long-range arena Flash Attention \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u0435\u0435 \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043e\u0432 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0448\u0435\u0432\u044b\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435\u043c, \u0431\u0443\u0434\u0443\u0447\u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0449\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0411\u043b\u043e\u0447\u043d\u043e-\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0434\u0430\u0435\u0442 \u0435\u0449\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u043d\u0435 \u0442\u0435\u0440\u044f\u044f \u043f\u043e \u0441\u0443\u0442\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0430\u0432\u0442\u043e\u0440\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0430 \u043f\u043e \u0441\u0435\u0442\u0438 \u0438 \u0440\u0430\u0441\u0445\u043e\u0434 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0438 &#171;\u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u043e\u0433\u043e&#187; \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041f\u0440\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0434\u043b\u0438\u043d\u0430\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 Flash Attention \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u0435\u0449\u0435 \u044d\u043a\u043e\u043d\u043e\u043c\u043d\u0435\u0435 \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<figure class=\"full-width\"><figcaption>(\u0421\u043b\u0435\u0432\u0430) \u0412\u0440\u0435\u043c\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0430 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0432\u043e\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (\u0421\u043f\u0440\u0430\u0432\u0430) \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0445\u043e\u0434\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0442 \u0434\u043b\u0438\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/figcaption><\/figure>\n<p>\u0418 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0438\u0448\u0435\u043d\u043a\u0438 \u043d\u0430 \u0442\u043e\u0440\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u044b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441\u043c\u043e\u0433\u043b\u0438 \u0441 \u0445\u043e\u0442\u044c \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0443\u0441\u043f\u0435\u0445\u043e\u043c \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 Path-X (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 128&#215;128), Path-256 (256&#215;256) \u0441 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u044b\u0448\u0435 \u0432\u044b\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0433\u0430\u0434\u0430\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u0444\u0435\u0439\u043d\u043e\u0439 \u0433\u0443\u0449\u0435. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c &#8212; \u043d\u0430\u0439\u0442\u0438, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u043f\u0443\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0431\u0435\u043b\u044b\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u043d\u0430 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0438\u043b\u0438 \u043d\u0435\u0442.  \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u0442\u0443\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0440\u0435\u0431\u0435\u043d\u043e\u043a. \u0420\u0435\u0431\u0435\u043d\u043e\u043a-\u0442\u043e \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u0430 \u0432\u043e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u0438\u043d\u044b \u043f\u043e\u0440\u044f\u0434\u043a\u0430 10000 \u043d\u0435 \u0432\u043b\u0435\u0437\u0435\u0442 \u0434\u0430\u0436\u0435 \u0432 \u043e\u0447\u0435\u043d\u044c \u0435\u043c\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u0432 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435, \u0434\u0430 \u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043d\u0435 \u0442\u0430\u043a-\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043b\u0438\u0431\u043e \u043f\u0430\u0434\u0430\u043b\u0438 \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438, \u043b\u0438\u0431\u043e \u0432\u044b\u0434\u0430\u0432\u0430\u043b\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 (\u0442.\u0435 50%). \u0422\u0443\u0442 \u0436\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0431\u0438\u0442\u044c ~60%.  <\/p>\n<figure class=\"\"><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 Path-X<\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption>\u0412\u0441\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0434\u043e Flash Attention \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 Path-X\/256<\/figcaption><\/figure>\n<p>\u0412\u0441\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u044b\u043b\u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0441 \u041d\u0432\u0438\u0434\u0438\u0435\u0432\u0441\u043a\u043e\u0439 A100. <\/p>\n<h2>\u0411\u0443\u0434\u0443\u0449\u0438\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u043e\u0431\u043e\u0431\u0449\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 GPU. \u041a\u0440\u043e\u043c\u0435 \u0443\u0447\u0435\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u043a\u044d\u0448\u0430 \u043a <strong>HBM<\/strong> \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u0438 \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0435\u0449\u0435 \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a (\u043f\u043e\u0440\u044f\u0434\u043a\u0438) \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0438 \u043f\u043e\u0442\u043e\u0447\u0435\u0447\u043d\u0443\u044e \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0441\u0442\u044c \u0432 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0435 (\u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 FFN (feed forward net) \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u043e\u043a\u0435\u043d\u0443) \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043a \u0431\u043b\u043e\u0447\u043d\u044b\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f\u043c. <\/p>\n<h2>\u0418\u0442\u043e\u0433<\/h2>\n<p>\u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043e\u0432 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 \u0438 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0447\u0442\u043e \u0432\u043b\u0435\u0447\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044e \u0434\u0435\u043d\u0435\u0433, \u044d\u043b\u0435\u0442\u043a\u0440\u043e\u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0438 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432 CO2 (\u043a\u0443\u0434\u0430 \u0431\u0435\u0437 \u0437\u0435\u043b\u0435\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0441\u0442\u043a\u0438). \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u043f\u043b\u043e\u0449\u0435\u043d\u0430 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0444\u0440\u0435\u0439\u0432\u043e\u0440\u043a\u0430\u0445 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e, \u043d\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u043c\u0435\u0442\u0435\u043d.<\/p>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438 \u0438 \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430 <\/h2>\n<p><a href=\"https:\/\/arxiv.org\/abs\/2205.14135\" rel=\"noopener noreferrer nofollow\">\u0421\u0430\u043c\u0430 \u0441\u0442\u0430\u0442\u044c\u044f <\/a><\/p>\n<p><a href=\"https:\/\/github.com\/HazyResearch\/flash-attention\" rel=\"noopener noreferrer nofollow\">\u0413\u0438\u0442\u0445\u0430\u0431-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a><\/p>\n<p><a href=\"https:\/\/www.google.com\/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=&amp;ved=2ahUKEwik1eDiqpH4AhVOSPEDHetIAwIQFnoECAIQAQ&amp;url=https%3A%2F%2Ftwitter.com%2Ftri_dao%2Fstatus%2F1531437619791290369&amp;usg=AOvVaw36UAdi20hYAeqXp7VY1P1s\" rel=\"noopener noreferrer nofollow\">\u0411\u043b\u043e\u0433 \u043d\u0430 \u0442\u0432\u0438\u0442\u0442\u0435\u0440\u0435 \u043e\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u0439<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/669506\/\"> https:\/\/habr.com\/ru\/post\/669506\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-334010","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334010"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334010\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}