{"id":466197,"date":"2025-07-06T21:00:33","date_gmt":"2025-07-06T21:00:33","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=466197"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=466197","title":{"rendered":"<span>\u0427\u0430\u0441\u0442\u044c 4: Mamba \u2014 State Space Models vs \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b<\/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<h4>\u041e\u0431\u043e \u043c\u043d\u0435<\/h4>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0412\u0430\u0441\u0438\u043b\u0438\u0439 \u0422\u0435\u0445\u0438\u043d. \u0417\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 6 \u043b\u0435\u0442 \u044f \u043f\u0440\u043e\u0448\u0451\u043b \u043f\u0443\u0442\u044c \u043e\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0430 \u0432 ML \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438 \u0432 \u0447\u0435\u043c \u043d\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f, \u0434\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435 \u0438 \u043f\u0440\u0438\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u043e\u0431\u044c\u044fc\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438.  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u044e \u043f\u0440\u043e\u0440\u044b\u0432\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 &#171;\u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445&#187;:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/921608\/\" rel=\"noopener noreferrer nofollow\">ResNet-18 \u2014 \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u043f\u043e\u043a\u043e\u0440\u0438\u0432\u0448\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/922868\/\" rel=\"noopener noreferrer nofollow\">Vision Transformer (ViT) \u2014 \u041a\u043e\u0433\u0434\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0432\u0438\u0434\u0435\u0442\u044c<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/924410\/\" rel=\"noopener noreferrer nofollow\">Diffusion Transformer (DiT) \u2014 Stable Diffusion 3 \u043a\u0430\u043a \u043e\u043d\u0430 \u0435\u0441\u0442\u044c<\/a> <strong>\u0421\u0435\u0433\u043e\u0434\u043d\u044f<\/strong>: Mamba \u2014 \u0440\u0435\u0432\u043e\u043b\u044e\u0446\u0438\u044f \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \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!<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u041f\u0440\u043e\u043b\u043e\u0433: \u041f\u043e\u0447\u0435\u043c\u0443 Mamba?<\/h4>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0442\u0443\u0441\u043e\u0432\u043a\u0443 \u0443\u0447\u0435\u043d\u044b\u0445 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0435\u0440\u0435\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0441\u043e \u0432\u0441\u0435\u043c\u0438. \u0414\u043b\u044f 10 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u2014 100 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432 (\u0434\u0430, \u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u044b \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441 \u043f\u0435\u0440\u0432\u044b\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0438 \u0434\u0430 \u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u0438 \u0441\u0430\u043c \u0441 \u0441\u043e\u0431\u043e\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u043a\u0442\u043e \u043f\u043e\u0439\u043c\u0435\u0442 \u044d\u0442\u0438\u0445 \u0443\u0447\u0435\u043d\u044b\u0445!). \u0414\u043b\u044f 1000 \u2014 1 000 000! \u042d\u0442\u043e <strong>\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c<\/strong> (O(n\u00b2)) \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0432 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0430\u0445.<br \/> <strong>Mamba<\/strong> (State Space Models) \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u043e:<\/p>\n<ul>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430 <strong>\u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u0443\u044e \u0441\u0435\u0442\u044c<\/strong> (O(n)).<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/strong>: \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0431\u043e\u0440 \u0432\u0430\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435<\/strong> \u0432 5 \u0440\u0430\u0437 \u043d\u0430 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u0430\u0445.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/289\/6fa\/072\/2896fa07284d25753b6a74d49afe63e8.png\" alt=\"\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/289\/6fa\/072\/2896fa07284d25753b6a74d49afe63e8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/289\/6fa\/072\/2896fa07284d25753b6a74d49afe63e8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439<\/figcaption><\/div>\n<\/figure>\n<hr\/>\n<h4>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Mamba<\/h4>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/983\/f9a\/436\/983f9a43644c0657d9c755cb66864cc0.png\" alt=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043c\u0430\u043c\u0431\u044b\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/983\/f9a\/436\/983f9a43644c0657d9c755cb66864cc0.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/983\/f9a\/436\/983f9a43644c0657d9c755cb66864cc0.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043c\u0430\u043c\u0431\u044b<\/figcaption><\/div>\n<\/figure>\n<h3>1. State Space Models (SSM)<\/h3>\n<p><strong>State Space Models (SSM)<\/strong> \u2014 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u0445. \u0418\u0445 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p><strong>\u041b\u0438\u043d\u0435\u0439\u043d\u043e\u0441\u0442\u044c<\/strong>: \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e (<code>s(t) = A\u00b7s(t-1) + B\u00b7x(t)<\/code>), \u0431\u0435\u0437 \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u044f<\/strong>: \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0438\u0437 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0436\u0430\u0442\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435<\/strong>: \u0432\u0441\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0436\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0435\u043a\u0442\u043e\u0440 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430.<\/p>\n<\/li>\n<\/ol>\n<h4>\u041e\u0442\u043b\u0438\u0447\u0438\u044f \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u041c\u043e\u0434\u0435\u043b\u044c<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 SSM<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>RNN\/GRU\/LSTM<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 (tanh, sigmoid)<\/p>\n<\/td>\n<td>\n<p align=\"left\">SSM \u2014 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043b\u0438\u043d\u0435\u0439\u043d\u044b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435 (O(n\u00b2))<\/p>\n<\/td>\n<td>\n<p align=\"left\">SSM \u2014 \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u044b\u0435 (O(n))<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>S4 SSM<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041b\u0438\u043d\u0435\u0439\u043d\u043e\u0441\u0442\u044c + \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">Mamba \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 <strong>\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/strong> (B, C, \u0394t \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0432\u0445\u043e\u0434\u0430)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Mamba<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">SSM + <strong>\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/strong> + \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 scan<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044f \u043a \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u042f\u0434\u0440\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b<\/strong>:<\/p>\n<pre><code>ds(t)\/dt = A\u00b7s(t) + B\u00b7x(t) y(t) = C\u00b7s(t) + D\u00b7x(t) <\/code><\/pre>\n<p><strong>\u0413\u0434\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>x(t)<\/strong> \u2014 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b (\u0442\u043e\u043a\u0435\u043d) \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 t<\/p>\n<\/li>\n<li>\n<p><strong>s(t)<\/strong> \u2014 \u0441\u043a\u0440\u044b\u0442\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u043f\u0430\u043c\u044f\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438)<\/p>\n<\/li>\n<li>\n<p><strong>ds(t)\/dt<\/strong> \u2014 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p><strong>A<\/strong> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 &#171;\u0437\u0430\u0431\u044b\u0432\u0430\u043d\u0438\u0435&#187; \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e)<\/p>\n<\/li>\n<li>\n<p><strong>B<\/strong> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u0445\u043e\u0434\u0430 (\u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435)<\/p>\n<\/li>\n<li>\n<p><strong>C<\/strong> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u044b\u0445\u043e\u0434\u0430 (\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 \u0432\u044b\u0445\u043e\u0434)<\/p>\n<\/li>\n<li>\n<p><strong>D<\/strong> \u2014 \u0441\u043a\u0432\u043e\u0437\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c (\u043f\u0440\u044f\u043c\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434)<\/p>\n<\/li>\n<li>\n<p><strong>y(t)<\/strong> \u2014 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0414\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/strong>:<\/p>\n<pre><code class=\"python\">A_d = exp(-\u0394t * A)   # \u0414\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 B_d = (A\u207b\u00b9)(exp(\u0394t\u00b7A) - I)B  # \u0414\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u0445\u043e\u0434\u0430 s_t = A_d \u00b7 s_{t-1} + B_d \u00b7 x_t <\/code><\/pre>\n<p><strong>\u0413\u0434\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>A_d<\/strong> \u2014 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \u043c\u0430\u0442\u0440\u0438\u0446\u044b A (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 &#171;\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438&#187;)<\/p>\n<\/li>\n<li>\n<p><strong>B_d<\/strong> \u2014 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \u043c\u0430\u0442\u0440\u0438\u0446\u044b B (\u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u0430 \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f)<\/p>\n<\/li>\n<li>\n<p><strong>\u0394t<\/strong> \u2014 \u0448\u0430\u0433 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (\u0443\u0447\u0438\u0442\u0441\u044f: \u0431\u043e\u043b\u044c\u0448\u043e\u0439 = \u0434\u043e\u043b\u0433\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 = \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u043d\u0438\u0435)<\/p>\n<\/li>\n<\/ul>\n<h3>2. \u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p><strong>\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c Mamba<\/strong>:<\/p>\n<pre><code class=\"python\">B = Linear(x_t)  # \u041b\u0438\u043d\u0435\u0439\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u0430 \u0394t = softplus(Linear(x_t))  # \u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f softplus: log(1 + exp(x)) <\/code><\/pre>\n<p><strong>\u0413\u0434\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>Linear()<\/strong> \u2014 \u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (y = Wx + b)<\/p>\n<\/li>\n<li>\n<p><strong>softplus()<\/strong> \u2014 \u0433\u043b\u0430\u0434\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f ReLU, \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0394t &gt; 0<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0435\u0448\u0430\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>&#171;\u0412\u0430\u0436\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d? \u0417\u0430\u043f\u043e\u043c\u043d\u044e \u043d\u0430\u0434\u043e\u043b\u0433\u043e (\u2191 \u0394t)&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;\u0428\u0443\u043c? \u041f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e (\u2193 \u0394t)&#187;<\/p>\n<\/li>\n<\/ul>\n<h3>3. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 Scan<\/h3>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b RNN<\/strong>:<\/p>\n<pre><code class=\"python\">state = cumprod(A) * cumsum(B)  # O(log n) \u0432\u043c\u0435\u0441\u0442\u043e O(n) <\/code><\/pre>\n<p><strong>\u0413\u0434\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>cumprod()<\/strong> \u2014 \u043a\u0443\u043c\u0443\u043b\u044f\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (a1, a1<em>a2, a1<\/em>a2*a3, &#8230;)<\/p>\n<\/li>\n<li>\n<p><strong>cumsum()<\/strong> \u2014 \u043a\u0443\u043c\u0443\u043b\u044f\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430 (b1, b1+b2, b1+b2+b3, &#8230;)<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/strong>:<\/p>\n<ol>\n<li>\n<p>\u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0431\u043b\u043e\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0431\u043b\u043e\u043a\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438 (\u0434\u0435\u0440\u0435\u0432\u043e \u0441\u043b\u0438\u044f\u043d\u0438\u0439)<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/h4>\n<p><em>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u0440\u0430\u0437\u044b &#171;\u041c\u0430\u043c\u0430 \u043c\u044b\u043b\u0430 \u0440\u0430\u043c\u0443&#187;<\/em><\/p>\n<h3>1. \u0422\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<pre><code>\"\u041c\"\u219210, \"\u0430\"\u219211, \" \"\u219212, \"\u043c\"\u219213, \"\u044b\"\u219214, \"\u043b\"\u219215, \"\u0440\"\u219216, \"\u0443\"\u219217 \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c: [10, 11, 13, 11, 12, ...] <\/code><\/pre>\n<h3>2. \u042d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433<\/h3>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u2192 \u0432\u0435\u043a\u0442\u043e\u0440:<\/p>\n<pre><code>10 \u2192 [0.2, -0.1, 0.4, 1.1] 11 \u2192 [0.7, 0.3, -0.2, 0.5] <\/code><\/pre>\n<h3>3. \u0411\u043b\u043e\u043a Mamba<\/h3>\n<p><strong>\u0414\u043b\u044f \u0442\u043e\u043a\u0435\u043d\u0430 &#171;\u043c&#187; (\u043f\u043e\u0437\u0438\u0446\u0438\u044f 2)<\/strong>:<\/p>\n<ol>\n<li>\n<p><strong>\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442<\/strong> (Conv1D):<\/p>\n<pre><code class=\"python\">conv(\"\u041c\u0430\") = [0.5, 0.1, 0.3, 0.9]  # \u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 <\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/strong>:<\/p>\n<pre><code class=\"python\">\u0394t = sigmoid(\"\u043c\") \u2192 0.7  # \u0412\u044b\u0441\u043e\u043a\u0430\u044f \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c new_state = (1 - 0.7*A) * state + 0.7*B * x_token <\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Gating \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c<\/strong>:<\/p>\n<pre><code class=\"python\">gate = sigmoid(Linear(x))  # \u0420\u0435\u0448\u0430\u0435\u0442, \u043a\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c output = gate * (C * state + D * x_token) <\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0412\u044b\u0445\u043e\u0434<\/strong>: <code>y = output<\/code><\/p>\n<\/li>\n<\/ol>\n<h3>4. \u041f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435 12 \u0431\u043b\u043e\u043a\u043e\u0432:<\/p>\n<pre><code class=\"python\">logits = linear_layer(output)  # \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 next_token = argmax(logits) \u2192 \"\u0430\"  # \"\u041c\u0430\u043c\u0430...\" <\/code><\/pre>\n<hr\/>\n<h4>\u041a\u043e\u0434: \u0421\u0435\u0440\u0434\u0446\u0435 Mamba<\/h4>\n<h3>\u042f\u0434\u0440\u043e SSM<\/h3>\n<pre><code class=\"python\">class MambaBlock(nn.Module):     def forward(self, x):         # \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442         x_conv = depthwise_conv1d(x)                  # \u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b         \u0394, B, C = self.x_proj(x_conv)           A_d = exp(-\u0394 * self.A)                  # \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 scan         state = cumprod(A_d) * cumsum(B * x_conv)         y = einsum('btd,btd-&gt;bt', state, C) + self.D * x_conv                  # Gating \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c         return y * torch.sigmoid(self.gate_proj(x)) <\/code><\/pre>\n<h3>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 Scan<\/h3>\n<pre><code class=\"python\">def parallel_scan(A, B):     A_cum = torch.cumprod(A, dim=1)  # \u041f\u0440\u043e\u0434\u0443\u043a\u0442: [a0, a0*a1, a0*a1*a2, ...]     B_cum = torch.cumsum(B * A_cum, dim=1)  # \u0412\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430     return B_cum \/ (A_cum + 1e-7)  # \u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <\/code><\/pre>\n<hr\/>\n<h4>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435: Mamba vs \u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>Mamba<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">O(n\u00b2)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>O(n)<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041f\u0430\u043c\u044f\u0442\u044c (\u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441)<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">O(n)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>O(1)<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0414\u043b\u0438\u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">~128K<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>&gt;1M \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">SOTA<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u043e<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0416\u0451\u0441\u0442\u043a\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0431\u043e\u0440<\/strong><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u0421\u0438\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b Mamba:<\/h3>\n<ol>\n<li>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437 \u0414\u041d\u041a\/\u0431\u0435\u043b\u043a\u043e\u0432\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u043d\u0430 edge-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 (\u0442\u0435\u043b\u0435\u0444\u043e\u043d\u044b).<\/p>\n<\/li>\n<\/ol>\n<h3>\u0421\u043b\u0430\u0431\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b:<\/h3>\n<ol>\n<li>\n<p>\u041a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u044b (\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435).<\/p>\n<\/li>\n<li>\n<p>\u041c\u0443\u043b\u044c\u0442\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 (\u043f\u043e\u043a\u0430).<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/h4>\n<ol>\n<li>\n<p>\ud83e\uddec <strong>BioMamba<\/strong>: <\/p>\n<ul>\n<li>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437 \u0433\u0435\u043d\u043e\u043c\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 (3 \u043c\u043b\u0440\u0434 \u043f\u0430\u0440 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0439).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\ud83d\uddbc\ufe0f <strong>Vim<\/strong> (Vision Mamba): <\/p>\n<ul>\n<li>\n<p>\u041d\u0430 30% \u0431\u044b\u0441\u0442\u0440\u0435\u0435 ViT \u043d\u0430 ImageNet.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/abs\/2401.09417\" rel=\"noopener noreferrer nofollow\">\u0421\u0442\u0430\u0442\u044c\u044f<\/a>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4>\u0420\u0435\u0437\u044e\u043c\u0435<\/h4>\n<p><strong>Mamba<\/strong> \u2014 \u043f\u0440\u043e\u0440\u044b\u0432 \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:<\/p>\n<ul>\n<li>\n<p><strong>State Space Model<\/strong> \u0441 \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c O(n)<\/strong> vs O(n\u00b2) \u0443 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/strong>: \u0433\u0435\u043d\u043e\u043c\u0438\u043a\u0430, \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b, edge-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f<\/strong>: \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u044b.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0421\u0441\u044b\u043b\u043a\u0438<\/strong>:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/abs\/2312.00752\" rel=\"noopener noreferrer nofollow\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/state-spaces\/mamba\" rel=\"noopener noreferrer nofollow\">\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 SSM<\/a><\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u0424\u0438\u043b\u043e\u0441\u043e\u0444\u0441\u043a\u0438\u0439 \u0438\u0442\u043e\u0433<\/h4>\n<p>Mamba \u043d\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b, \u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0418\u0418:<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f <strong>\u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong> \u2014 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f <strong>\u043c\u0443\u043b\u044c\u0442\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/strong> \u2014 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e. <strong>\u0411\u0443\u0434\u0443\u0449\u0435\u0435<\/strong>: \u0413\u0438\u0431\u0440\u0438\u0434\u043d\u044b\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u0433\u0434\u0435 Mamba \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u2014 \u043a\u0440\u043e\u0441\u0441-\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u044f\u0437\u0438.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u044c \u0441\u0435\u0431\u044f<\/h4>\n<ol>\n<li>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c Mamba O(n), \u0430 \u043d\u0435 O(n\u00b2)?<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0414\u041d\u041a?<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/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\/articles\/925416\/\"> https:\/\/habr.com\/ru\/articles\/925416\/<\/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<h4>\u041e\u0431\u043e \u043c\u043d\u0435<\/h4>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0412\u0430\u0441\u0438\u043b\u0438\u0439 \u0422\u0435\u0445\u0438\u043d. \u0417\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 6 \u043b\u0435\u0442 \u044f \u043f\u0440\u043e\u0448\u0451\u043b \u043f\u0443\u0442\u044c \u043e\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0430 \u0432 ML \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438 \u0432 \u0447\u0435\u043c \u043d\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f, \u0434\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435 \u0438 \u043f\u0440\u0438\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u043e\u0431\u044c\u044fc\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438.  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u044e \u043f\u0440\u043e\u0440\u044b\u0432\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 &#171;\u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445&#187;:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/921608\/\" rel=\"noopener noreferrer nofollow\">ResNet-18 \u2014 \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u043f\u043e\u043a\u043e\u0440\u0438\u0432\u0448\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/922868\/\" rel=\"noopener noreferrer nofollow\">Vision Transformer (ViT) \u2014 \u041a\u043e\u0433\u0434\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0432\u0438\u0434\u0435\u0442\u044c<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/924410\/\" rel=\"noopener noreferrer nofollow\">Diffusion Transformer (DiT) \u2014 Stable Diffusion 3 \u043a\u0430\u043a \u043e\u043d\u0430 \u0435\u0441\u0442\u044c<\/a> <strong>\u0421\u0435\u0433\u043e\u0434\u043d\u044f<\/strong>: Mamba \u2014 \u0440\u0435\u0432\u043e\u043b\u044e\u0446\u0438\u044f \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \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!<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u041f\u0440\u043e\u043b\u043e\u0433: \u041f\u043e\u0447\u0435\u043c\u0443 Mamba?<\/h4>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0442\u0443\u0441\u043e\u0432\u043a\u0443 \u0443\u0447\u0435\u043d\u044b\u0445 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0435\u0440\u0435\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0441\u043e \u0432\u0441\u0435\u043c\u0438. \u0414\u043b\u044f 10 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u2014 100 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432 (\u0434\u0430, \u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u044b \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441 \u043f\u0435\u0440\u0432\u044b\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0438 \u0434\u0430 \u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u0438 \u0441\u0430\u043c \u0441 \u0441\u043e\u0431\u043e\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u043a\u0442\u043e \u043f\u043e\u0439\u043c\u0435\u0442 \u044d\u0442\u0438\u0445 \u0443\u0447\u0435\u043d\u044b\u0445!). \u0414\u043b\u044f 1000 \u2014 1 000 000! \u042d\u0442\u043e <strong>\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c<\/strong> (O(n\u00b2)) \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0432 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0430\u0445.<br \/> <strong>Mamba<\/strong> (State Space Models) \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u043e:<\/p>\n<ul>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430 <strong>\u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u0443\u044e \u0441\u0435\u0442\u044c<\/strong> (O(n)).<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/strong>: \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0431\u043e\u0440 \u0432\u0430\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435<\/strong> \u0432 5 \u0440\u0430\u0437 \u043d\u0430 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u0430\u0445.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"\">\n<div><figcaption>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439<\/figcaption><\/div>\n<\/figure>\n<hr\/>\n<h4>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Mamba<\/h4>\n<figure class=\"\">\n<div><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043c\u0430\u043c\u0431\u044b<\/figcaption><\/div>\n<\/figure>\n<h3>1. State Space Models (SSM)<\/h3>\n<p><strong>State Space Models (SSM)<\/strong> \u2014 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u0445. \u0418\u0445 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p><strong>\u041b\u0438\u043d\u0435\u0439\u043d\u043e\u0441\u0442\u044c<\/strong>: \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e (<code>s(t) = A\u00b7s(t-1) + B\u00b7x(t)<\/code>), \u0431\u0435\u0437 \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u044f<\/strong>: \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0438\u0437 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0436\u0430\u0442\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435<\/strong>: \u0432\u0441\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0436\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0435\u043a\u0442\u043e\u0440 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430.<\/p>\n<\/li>\n<\/ol>\n<h4>\u041e\u0442\u043b\u0438\u0447\u0438\u044f \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u041c\u043e\u0434\u0435\u043b\u044c<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 SSM<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>RNN\/GRU\/LSTM<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 (tanh, sigmoid)<\/p>\n<\/td>\n<td>\n<p align=\"left\">SSM \u2014 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043b\u0438\u043d\u0435\u0439\u043d\u044b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435 (O(n\u00b2))<\/p>\n<\/td>\n<td>\n<p align=\"left\">SSM \u2014 \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u044b\u0435 (O(n))<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>S4 SSM<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041b\u0438\u043d\u0435\u0439\u043d\u043e\u0441\u0442\u044c + \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">Mamba \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 <strong>\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/strong> (B, C, \u0394t \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0432\u0445\u043e\u0434\u0430)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Mamba<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">SSM + <strong>\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/strong> + \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 scan<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044f \u043a \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u042f\u0434\u0440\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b<\/strong>:<\/p>\n<pre><code>ds(t)\/dt = A\u00b7s(t) + B\u00b7x(t) y(t) = C\u00b7s(t) + D\u00b7x(t) <\/code><\/pre>\n<p><strong>\u0413\u0434\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>x(t)<\/strong> \u2014 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b (\u0442\u043e\u043a\u0435\u043d) \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 t<\/p>\n<\/li>\n<li>\n<p><strong>s(t)<\/strong> \u2014 \u0441\u043a\u0440\u044b\u0442\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u043f\u0430\u043c\u044f\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438)<\/p>\n<\/li>\n<li>\n<p><strong>ds(t)\/dt<\/strong> \u2014 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p><strong>A<\/strong> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 &#171;\u0437\u0430\u0431\u044b\u0432\u0430\u043d\u0438\u0435&#187; \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e)<\/p>\n<\/li>\n<li>\n<p><strong>B<\/strong> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u0445\u043e\u0434\u0430 (\u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435)<\/p>\n<\/li>\n<li>\n<p><strong>C<\/strong> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u044b\u0445\u043e\u0434\u0430 (\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 \u0432\u044b\u0445\u043e\u0434)<\/p>\n<\/li>\n<li>\n<p><strong>D<\/strong> \u2014 \u0441\u043a\u0432\u043e\u0437\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c (\u043f\u0440\u044f\u043c\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434)<\/p>\n<\/li>\n<li>\n<p><strong>y(t)<\/strong> \u2014 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0414\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/strong>:<\/p>\n<pre><code class=\"python\">A_d = exp(-\u0394t * A)   # \u0414\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 B_d = (A\u207b\u00b9)(exp(\u0394t\u00b7A) - I)B  # \u0414\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u0445\u043e\u0434\u0430 s_t = A_d \u00b7 s_{t-1} + B_d \u00b7 x_t <\/code><\/pre>\n<p><strong>\u0413\u0434\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>A_d<\/strong> \u2014 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \u043c\u0430\u0442\u0440\u0438\u0446\u044b A (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 &#171;\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438&#187;)<\/p>\n<\/li>\n<li>\n<p><strong>B_d<\/strong> \u2014 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \u043c\u0430\u0442\u0440\u0438\u0446\u044b B (\u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u0430 \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f)<\/p>\n<\/li>\n<li>\n<p><strong>\u0394t<\/strong> \u2014 \u0448\u0430\u0433 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (\u0443\u0447\u0438\u0442\u0441\u044f: \u0431\u043e\u043b\u044c\u0448\u043e\u0439 = \u0434\u043e\u043b\u0433\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 = \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u043d\u0438\u0435)<\/p>\n<\/li>\n<\/ul>\n<h3>2. \u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p><strong>\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c Mamba<\/strong>:<\/p>\n<pre><code class=\"python\">B = Linear(x_t)  # \u041b\u0438\u043d\u0435\u0439\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u0430 \u0394t = softplus(Linear(x_t))  # \u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f softplus: log(1 + exp(x)) <\/code><\/pre>\n<p><strong>\u0413\u0434\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>Linear()<\/strong> \u2014 \u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (y = Wx + b)<\/p>\n<\/li>\n<li>\n<p><strong>softplus()<\/strong> \u2014 \u0433\u043b\u0430\u0434\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f ReLU, \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0394t &gt; 0<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0435\u0448\u0430\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>&#171;\u0412\u0430\u0436\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d? \u0417\u0430\u043f\u043e\u043c\u043d\u044e \u043d\u0430\u0434\u043e\u043b\u0433\u043e (\u2191 \u0394t)&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;\u0428\u0443\u043c? \u041f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e (\u2193 \u0394t)&#187;<\/p>\n<\/li>\n<\/ul>\n<h3>3. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 Scan<\/h3>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b RNN<\/strong>:<\/p>\n<pre><code class=\"python\">state = cumprod(A) * cumsum(B)  # O(log n) \u0432\u043c\u0435\u0441\u0442\u043e O(n) <\/code><\/pre>\n<p><strong>\u0413\u0434\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>cumprod()<\/strong> \u2014 \u043a\u0443\u043c\u0443\u043b\u044f\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (a1, a1<em>a2, a1<\/em>a2*a3, &#8230;)<\/p>\n<\/li>\n<li>\n<p><strong>cumsum()<\/strong> \u2014 \u043a\u0443\u043c\u0443\u043b\u044f\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430 (b1, b1+b2, b1+b2+b3, &#8230;)<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/strong>:<\/p>\n<ol>\n<li>\n<p>\u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0431\u043b\u043e\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0431\u043b\u043e\u043a\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438 (\u0434\u0435\u0440\u0435\u0432\u043e \u0441\u043b\u0438\u044f\u043d\u0438\u0439)<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/h4>\n<p><em>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u0440\u0430\u0437\u044b &#171;\u041c\u0430\u043c\u0430 \u043c\u044b\u043b\u0430 \u0440\u0430\u043c\u0443&#187;<\/em><\/p>\n<h3>1. \u0422\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<pre><code>\"\u041c\"\u219210, \"\u0430\"\u219211, \" \"\u219212, \"\u043c\"\u219213, \"\u044b\"\u219214, \"\u043b\"\u219215, \"\u0440\"\u219216, \"\u0443\"\u219217 \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c: [10, 11, 13, 11, 12, ...] <\/code><\/pre>\n<h3>2. \u042d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433<\/h3>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u2192 \u0432\u0435\u043a\u0442\u043e\u0440:<\/p>\n<pre><code>10 \u2192 [0.2, -0.1, 0.4, 1.1] 11 \u2192 [0.7, 0.3, -0.2, 0.5] <\/code><\/pre>\n<h3>3. \u0411\u043b\u043e\u043a Mamba<\/h3>\n<p><strong>\u0414\u043b\u044f \u0442\u043e\u043a\u0435\u043d\u0430 &#171;\u043c&#187; (\u043f\u043e\u0437\u0438\u0446\u0438\u044f 2)<\/strong>:<\/p>\n<ol>\n<li>\n<p><strong>\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442<\/strong> (Conv1D):<\/p>\n<pre><code class=\"python\">conv(\"\u041c\u0430\") = [0.5, 0.1, 0.3, 0.9]  # \u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 <\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/strong>:<\/p>\n<pre><code class=\"python\">\u0394t = sigmoid(\"\u043c\") \u2192 0.7  # \u0412\u044b\u0441\u043e\u043a\u0430\u044f \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c new_state = (1 - 0.7*A) * state + 0.7*B * x_token <\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Gating \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c<\/strong>:<\/p>\n<pre><code class=\"python\">gate = sigmoid(Linear(x))  # \u0420\u0435\u0448\u0430\u0435\u0442, \u043a\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c output = gate * (C * state + D * x_token) <\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0412\u044b\u0445\u043e\u0434<\/strong>: <code>y = output<\/code><\/p>\n<\/li>\n<\/ol>\n<h3>4. \u041f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435 12 \u0431\u043b\u043e\u043a\u043e\u0432:<\/p>\n<pre><code class=\"python\">logits = linear_layer(output)  # \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 next_token = argmax(logits) \u2192 \"\u0430\"  # \"\u041c\u0430\u043c\u0430...\" <\/code><\/pre>\n<hr\/>\n<h4>\u041a\u043e\u0434: \u0421\u0435\u0440\u0434\u0446\u0435 Mamba<\/h4>\n<h3>\u042f\u0434\u0440\u043e SSM<\/h3>\n<pre><code class=\"python\">class MambaBlock(nn.Module):     def forward(self, x):         # \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442         x_conv = depthwise_conv1d(x)                  # \u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b         \u0394, B, C = self.x_proj(x_conv)           A_d = exp(-\u0394 * self.A)                  # \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 scan         state = cumprod(A_d) * cumsum(B * x_conv)         y = einsum('btd,btd-&gt;bt', state, C) + self.D * x_conv                  # Gating \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c         return y * torch.sigmoid(self.gate_proj(x)) <\/code><\/pre>\n<h3>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 Scan<\/h3>\n<pre><code class=\"python\">def parallel_scan(A, B):     A_cum = torch.cumprod(A, dim=1)  # \u041f\u0440\u043e\u0434\u0443\u043a\u0442: [a0, a0*a1, a0*a1*a2, ...]     B_cum = torch.cumsum(B * A_cum, dim=1)  # \u0412\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430     return B_cum \/ (A_cum + 1e-7)  # \u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <\/code><\/pre>\n<hr\/>\n<h4>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435: Mamba vs \u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>Mamba<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">O(n\u00b2)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>O(n)<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041f\u0430\u043c\u044f\u0442\u044c (\u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441)<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">O(n)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>O(1)<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0414\u043b\u0438\u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">~128K<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>&gt;1M \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">SOTA<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u043e<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0416\u0451\u0441\u0442\u043a\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0431\u043e\u0440<\/strong><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u0421\u0438\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b Mamba:<\/h3>\n<ol>\n<li>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437 \u0414\u041d\u041a\/\u0431\u0435\u043b\u043a\u043e\u0432\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u043d\u0430 edge-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 (\u0442\u0435\u043b\u0435\u0444\u043e\u043d\u044b).<\/p>\n<\/li>\n<\/ol>\n<h3>\u0421\u043b\u0430\u0431\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b:<\/h3>\n<ol>\n<li>\n<p>\u041a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u044b (\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435).<\/p>\n<\/li>\n<li>\n<p>\u041c\u0443\u043b\u044c\u0442\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 (\u043f\u043e\u043a\u0430).<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/h4>\n<ol>\n<li>\n<p>\ud83e\uddec <strong>BioMamba<\/strong>: <\/p>\n<ul>\n<li>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437 \u0433\u0435\u043d\u043e\u043c\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 (3 \u043c\u043b\u0440\u0434 \u043f\u0430\u0440 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0439).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\ud83d\uddbc\ufe0f <strong>Vim<\/strong> (Vision Mamba): <\/p>\n<ul>\n<li>\n<p>\u041d\u0430 30% \u0431\u044b\u0441\u0442\u0440\u0435\u0435 ViT \u043d\u0430 ImageNet.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/abs\/2401.09417\" rel=\"noopener noreferrer nofollow\">\u0421\u0442\u0430\u0442\u044c\u044f<\/a>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4>\u0420\u0435\u0437\u044e\u043c\u0435<\/h4>\n<p><strong>Mamba<\/strong> \u2014 \u043f\u0440\u043e\u0440\u044b\u0432 \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:<\/p>\n<ul>\n<li>\n<p><strong>State Space Model<\/strong> \u0441 \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c O(n)<\/strong> vs O(n\u00b2) \u0443 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/strong>: \u0433\u0435\u043d\u043e\u043c\u0438\u043a\u0430, \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b, edge-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f<\/strong>: \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u044b.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0421\u0441\u044b\u043b\u043a\u0438<\/strong>:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/abs\/2312.00752\" rel=\"noopener noreferrer nofollow\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/state-spaces\/mamba\" rel=\"noopener noreferrer nofollow\">\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 SSM<\/a><\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u0424\u0438\u043b\u043e\u0441\u043e\u0444\u0441\u043a\u0438\u0439 \u0438\u0442\u043e\u0433<\/h4>\n<p>Mamba \u043d\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b, \u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0418\u0418:<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f <strong>\u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong> \u2014 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f <strong>\u043c\u0443\u043b\u044c\u0442\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/strong> \u2014 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e. <strong>\u0411\u0443\u0434\u0443\u0449\u0435\u0435<\/strong>: \u0413\u0438\u0431\u0440\u0438\u0434\u043d\u044b\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u0433\u0434\u0435 Mamba \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u2014 \u043a\u0440\u043e\u0441\u0441-\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u044f\u0437\u0438.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u044c \u0441\u0435\u0431\u044f<\/h4>\n<ol>\n<li>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c Mamba O(n), \u0430 \u043d\u0435 O(n\u00b2)?<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0414\u041d\u041a?<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/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\/articles\/925416\/\"> https:\/\/habr.com\/ru\/articles\/925416\/<\/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-466197","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/466197","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=466197"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/466197\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=466197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=466197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=466197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}