{"id":501612,"date":"2026-11-04T13:05:01","date_gmt":"2026-11-04T10:05:01","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=501612"},"modified":"2026-11-04T13:05:01","modified_gmt":"2026-11-04T10:05:01","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=501612","title":{"rendered":"\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0432\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 Jev \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u043c GPU \u0432 Colab"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/7f\/00\/43\/7f004305df639a4602d5c8b0dee5b302.png\" width=\"2048\" height=\"1152\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/7f\/00\/43\/7f004305df639a4602d5c8b0dee5b302.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/7f\/00\/43\/7f004305df639a4602d5c8b0dee5b302.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>15 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f 2026 \u0433\u043e\u0434\u0430 TypeSafe AI \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0430 Jev \u2014 \u043c\u043e\u0434\u0435\u043b\u044c \u043a\u043b\u0430\u0441\u0441\u0430 \u00abSystem One\u00bb: \u043e\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043e\u0446\u0435\u043d\u043a\u0438 \u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u0442\u0435\u043a\u0441\u0442\u0430. \u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 Jev \u0430\u043d\u0430\u043b\u043e\u0433\u0438 \u043f\u043e\u0431\u0435\u0436\u0430\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043c\u0443 \u043d\u0435 \u043b\u0435\u043d\u044c: Liquid AI, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 d1 \u0443\u0436\u0435 \u0447\u0435\u0440\u0435\u0437 \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438. \u0410 \u043c\u044b \u0447\u0435\u043c \u0445\u0443\u0436\u0435? \u041d\u0443, \u043f\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0443, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0445\u0443\u0436\u0435. \u0417\u0430\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e.<\/p>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0430 \u00ab\u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442\u00bb \u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u043a\u0432\u043e\u0439, \u0438 \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 Jev \u043d\u0430 T4 \u0432 Colab: \u044f\u0434\u0440\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 70 \u0441\u0442\u0440\u043e\u043a, \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0443 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0437\u0430\u043c\u0435\u0440 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438. \u0421\u0440\u0430\u0437\u0443 \u043e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c: \u044d\u0442\u043e \u043d\u0435 Jev. \u041c\u044b \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043e\u0431\u044b\u0447\u043d\u0443\u044e instruct-\u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437 \u0435\u0451 \u043b\u043e\u0433\u0438\u0442\u043e\u0432 \u0431\u0435\u0437 \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0443 \u0434\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043e\u043d\u0430 \u043d\u0435 \u0434\u043e\u0442\u044f\u043d\u0435\u0442.<\/p>\n<hr\/>\n<h2>\u276f \u0427\u0442\u043e \u043c\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c<\/h2>\n<p>\u0423 Jev \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439: \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u0442\u0435\u043a\u0441\u0442) \u0438 \u043d\u0430\u0431\u043e\u0440 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438. \u0412\u043e\u043f\u0440\u043e\u0441\u044b \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0440\u0451\u0445 \u0442\u0438\u043f\u043e\u0432: \u0434\u0430\/\u043d\u0435\u0442, \u0432\u044b\u0431\u043e\u0440 \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438 \u043e\u0446\u0435\u043d\u043a\u0430 \u043f\u043e \u0448\u043a\u0430\u043b\u0435. \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435: \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Bool, Choice \u0438 Score, \u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<\/p>\n<h2>\u276f \u041a\u0430\u043a LLM \u00ab\u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442\u00bb: \u043e\u0442 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0434\u043e \u043b\u043e\u0433\u0438\u0442\u043e\u0432<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u044c \u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u0442\u0430\u043c \u043d\u0435\u0442: \u043d\u0430\u043c \u0445\u0432\u0430\u0442\u0438\u0442 \u0448\u0435\u0441\u0442\u0438 \u0448\u0430\u0433\u043e\u0432.<\/p>\n<h4>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434<\/h4>\n<ol>\n<li>\n<p><strong>\u0422\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0446\u0438\u044f.<\/strong> \u0422\u0435\u043a\u0441\u0442 \u0440\u0435\u0436\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u043e\u043a\u0435\u043d\u044b (\u043a\u0443\u0441\u043a\u0438 \u0441\u043b\u043e\u0432), \u0438 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u043e\u043c\u0435\u0440 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435. \u0423 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0442\u044b\u0441\u044f\u0447 \u0434\u043e \u0441\u043e\u0442\u0435\u043d \u0442\u044b\u0441\u044f\u0447 \u0442\u043e\u043a\u0435\u043d\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u042d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u0438.<\/strong> \u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0435\u043a\u0442\u043e\u0440, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443\u043c\u0435\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043b\u043e\u0438 \u0441\u0435\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0430.<\/strong> \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f (attention) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u043e\u043a\u0435\u043d\u0443 \u00ab\u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c\u00bb \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0438 \u043f\u043e\u0434\u043c\u0435\u0448\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u0441\u043b\u043e\u0451\u0432 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0451 \u0441\u043a\u0440\u044b\u0442\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435: \u0432\u0435\u043a\u0442\u043e\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0436\u0435 \u0443\u0447\u0442\u0451\u043d \u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441\u043b\u0435\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0442\u043e\u043a\u0435\u043d.<\/strong> \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u043e\u043a\u0435\u043d, \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0440\u044b\u0442\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u043f\u0440\u043e\u043c\u043f\u0442\u0430: \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u0436\u0435 \u0432\u043e\u0448\u043b\u043e \u0432 \u043d\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u041b\u043e\u0433\u0438\u0442\u044b.<\/strong> \u042d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u00ab\u0441\u043b\u043e\u0432\u0430\u0440\u044c \u00d7 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u00bb, \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u0441\u043b\u043e\u0432\u0430\u0440\u044f. \u042d\u0442\u0438 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0442\u0430\u043c\u0438: \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u043e\u0433\u0438\u0442, \u0442\u0435\u043c \u043e\u0445\u043e\u0442\u043d\u0435\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u0431\u044b \u044d\u0442\u043e\u0442 \u0442\u043e\u043a\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>Softmax.<\/strong> \u041b\u043e\u0433\u0438\u0442\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 p_i = exp(z_i) \/ \u03a3 exp(z_j): \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b \u0438 \u0432 \u0441\u0443\u043c\u043c\u0435 \u0434\u0430\u044e\u0442 \u0435\u0434\u0438\u043d\u0438\u0446\u0443.<\/p>\n<\/li>\n<\/ol>\n<p>\u041e\u0431\u044b\u0447\u043d\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0441 \u044d\u0442\u0438\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u0443 \u0432\u0435\u0449\u044c: \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u043e\u043a\u0435\u043d (\u0441\u0430\u043c\u044b\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u0439 \u0438\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439), \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u043a \u0442\u0435\u043a\u0441\u0442\u0443 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0441\u0451 \u0437\u0430\u043d\u043e\u0432\u043e \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c JSON \u0432\u0438\u0434\u0430 {&#171;angry&#187;: true, &#171;team&#187;: &#171;billing&#187;, &#171;urgency&#187;: 3}, \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0440\u0430\u0437: \u0441\u043a\u043e\u0431\u043a\u0438, \u043a\u0430\u0432\u044b\u0447\u043a\u0438, \u043a\u043b\u044e\u0447\u0438 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u0436\u0435 \u0442\u043e\u043a\u0435\u043d\u044b. \u0422\u043e\u0447\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u043d\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0434\u0432\u0443\u0445-\u0442\u0440\u0451\u0445 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0448\u0430\u0433\u043e\u0432, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0436\u0434\u0451\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e.<\/p>\n<h4>\u0413\u0434\u0435 \u043f\u0440\u044f\u0447\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u043c\u043f\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u00ab\u043e\u0442\u0432\u0435\u0442\u044c \u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u043a\u0432\u043e\u0439: A, B \u0438\u043b\u0438 C\u00bb, \u0442\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0436\u0435 \u0448\u0430\u0433\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0442\u0430\u043a \u0440\u0430\u0437\u0434\u0430\u0451\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438 A, B \u0438 C. \u041d\u0438\u0447\u0435\u0433\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0438 \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e: \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u044d\u0442\u0438 \u0442\u0440\u0438 \u0447\u0438\u0441\u043b\u0430. \u041c\u044b \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c softmax \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0431\u0443\u043a\u0432\u0430\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432: p_A = exp(z_A) \/ (exp(z_A) + exp(z_B) + exp(z_C)).<\/p>\n<p>\u0412\u044b\u0445\u043e\u0434\u0438\u0442, \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043b\u0435\u0436\u0438\u0442 \u0443\u0436\u0435 \u0432 \u043b\u043e\u0433\u0438\u0442\u0430\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u0440\u043e\u043c\u043f\u0442\u0430. \u0421\u0430\u043c \u043f\u0440\u043e\u043c\u043f\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434 (GPU \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0441\u0435 \u0435\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u044b \u0441\u0440\u0430\u0437\u0443 \u043e\u0434\u043d\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439), \u0438 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0436\u0434\u0430\u0442\u044c \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438. \u041d\u0438\u0436\u0435 \u043c\u044b \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u0440\u0438\u043c.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u0443\u043a\u0432\u044b, \u0430 \u043d\u0435 \u0441\u043b\u043e\u0432\u0430? \u0421\u043b\u043e\u0432\u043e \u0432\u0440\u043e\u0434\u0435 billing \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u0438 \u0442\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0442\u044c \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0448\u0430\u0433\u043e\u0432. \u041e\u0434\u043d\u0430 \u0431\u0443\u043a\u0432\u0430 \u2014 \u043e\u0434\u0438\u043d \u0442\u043e\u043a\u0435\u043d, \u0438 \u0432\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0447\u0435\u0441\u0442\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439. \u041f\u043b\u0430\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c: \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043b\u044e\u0431\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u0441\u043f\u0438\u0441\u043a\u0430. \u0421 \u044d\u0442\u0438\u043c \u043c\u044b \u0442\u043e\u0436\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f.<\/p>\n<h4>\u0427\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u00ab\u043d\u0435 \u0433\u0430\u043b\u043b\u044e\u0446\u0438\u043d\u0438\u0440\u0443\u0435\u0442\u00bb<\/h4>\n<p>\u041e\u0442\u0432\u0435\u0442 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432: \u043c\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0431\u0443\u043a\u0432\u044b \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430. \u041d\u043e \u044d\u0442\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0430, \u0430 \u043d\u0435 \u0438\u0441\u0442\u0438\u043d\u044b: \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0430. \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c.<\/p>\n<h2>\u276f \u0416\u0435\u043b\u0435\u0437\u043e \u0438 \u043c\u043e\u0434\u0435\u043b\u044c<\/h2>\n<p>\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 Colab \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0434\u0430\u0451\u0442 T4 \u0441 16 \u0413\u0411 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043e\u043a\u043e\u043b\u043e 15 \u0413\u0411), \u0441\u0435\u0441\u0441\u0438\u044f \u0436\u0438\u0432\u0451\u0442 \u0434\u043e 12 \u0447\u0430\u0441\u043e\u0432, \u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 GPU \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442: \u043b\u043e\u0442\u0435\u0440\u0435\u044f, \u0437\u0430\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430\u044f. \u0423 T4 \u043d\u0435\u0442 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 bfloat16, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432 float16.<\/p>\n<p>\u0411\u0435\u0440\u0451\u043c <code>Qwen\/Qwen2.5-1.5B-Instruct<\/code>: \u0432 fp16 \u044d\u0442\u043e \u043e\u043a\u043e\u043b\u043e 3 \u0413\u0411, \u0438 \u0442\u0430\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 float16. \u0415\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0442\u043e\u0447\u043d\u0435\u0435, \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 <code>Qwen\/Qwen2.5-3B-Instruct<\/code> (\u043e\u043a\u043e\u043b\u043e 6 \u0413\u0411). \u041c\u043e\u0434\u0435\u043b\u0438, \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 bf16, \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u044b\u0434\u0430\u044e\u0442 \u0432 fp16 NaN, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043b\u043e\u0433\u0438\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430: <code>!pip install -q -U transformers accelerate scikit-learn datasets<\/code>, \u0437\u0430\u0442\u0435\u043c Runtime \u2192 Change runtime type \u2192 T4 GPU.<\/p>\n<h2>\u276f \u0428\u0430\u0433 1. \u042f\u0434\u0440\u043e<\/h2>\n<pre><code class=\"python\">import torchfrom transformers import AutoTokenizer, AutoModelForCausalLMLETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'SYSTEM = ('You are a decision engine. Read the state, then answer the question '          'with exactly one option letter and nothing else.')def Bool(text):    return {'type': 'bool', 'instructions': text, 'options': ['Yes', 'No']}def Choice(text, options):    return {'type': 'choice', 'instructions': text, 'options': list(options)}def Score(text, lo=1, hi=5):    vals = list(range(lo, hi + 1))    return {'type': 'score', 'instructions': text, 'options': [str(v) for v in vals], 'values': vals}class MiniJev:    def __init__(self, model_id, dtype=torch.float16, device='cuda'):        self.tok = AutoTokenizer.from_pretrained(model_id, padding_side='left')        if self.tok.pad_token is None:            self.tok.pad_token = self.tok.eos_token        self.model = AutoModelForCausalLM.from_pretrained(model_id, dtype=dtype).to(device).eval()        self.device, self._ids = device, {}    def _label_ids(self, label):        if label not in self._ids:            ids = set()            for v in (label, ' ' + label):  # 'A' \u0438 ' A', \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0442\u043e\u043a\u0435\u043d                t = self.tok.encode(v, add_special_tokens=False)                if len(t) == 1:                    ids.add(t[0])            self._ids[label] = sorted(ids)        return self._ids[label]    def _prompt(self, state, instructions, options):        lines = '\\n'.join(f'{LETTERS[i]}. {o}' for i, o in enumerate(options))        user = (f'State:\\n{state}\\n\\nQuestion: {instructions}\\n\\n'                f'Options:\\n{lines}\\n\\nAnswer with the letter only.')        msgs = [{'role': 'system', 'content': SYSTEM}, {'role': 'user', 'content': user}]        return self.tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)    @torch.no_grad()    def _option_logits(self, prompts, k):        enc = self.tok(prompts, return_tensors='pt', padding=True,                       add_special_tokens=False).to(self.device)        logits = self.model(**enc).logits[:, -1, :].float()  # readout at the last position        assert torch.isfinite(logits).all(), 'NaN\/inf: try float32 or another model'        return torch.stack([torch.stack([torch.logsumexp(logits[i, self._label_ids(LETTERS[j])], 0)                                         for j in range(k)]) for i in range(len(prompts))])    def logprobs(self, state, q, debias=True):        opts, k = q['options'], len(q['options'])        shifts = range(k) if debias else [0]        prompts = [self._prompt(state, q['instructions'], opts[r:] + opts[:r]) for r in shifts]        lp = torch.log_softmax(self._option_logits(prompts, k), -1)  # (shifts, k)        out = torch.zeros(k, device=lp.device)        for row, r in zip(lp, shifts):            for j in range(k):                out[(j + r) % k] += row[j] \/ len(shifts)        return out  # mean log-prob of each ORIGINAL option    def decide(self, state, questions, T=1.0, debias=True):        res = {}        for name, q in questions.items():            p = torch.softmax(self.logprobs(state, q, debias) \/ T, -1).tolist()            item = {'probs': dict(zip(q['options'], p))}            if q['type'] == 'bool':                item['p_yes'] = p[0]            if q['type'] == 'score':                item['value'] = sum(a * b for a, b in zip(p, q['values']))            res[name] = item        return res<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"python\">jev = MiniJev('Qwen\/Qwen2.5-1.5B-Instruct')state = 'I was charged twice this month, please refund one of them.'print(jev.decide(state, {    'angry': Bool('Is the customer angry?'),    'team': Choice('Which team should handle it?', ['billing', 'tech support', 'sales']),    'urgency': Score('How urgent is it?'),}))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c, \u043f\u043b\u044e\u0441 <code>p_yes<\/code> \u0434\u043b\u044f \u0434\u0430\/\u043d\u0435\u0442 \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 value \u0434\u043b\u044f \u0448\u043a\u0430\u043b\u044b.\u00a0<\/p>\n<h4>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0438<\/h4>\n<ol>\n<li>\n<p><strong>\u041f\u0440\u043e\u043c\u043f\u0442.<\/strong> <code>_prompt<\/code> \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0432\u043e\u043f\u0440\u043e\u0441 \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b A, B, C. \u0428\u0430\u0431\u043b\u043e\u043d \u0447\u0430\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043a\u043e\u043d\u0435\u0446 \u00ab\u0445\u043e\u0434 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u0430\u00bb, \u0442\u0430\u043a \u0447\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u043e\u043a\u0435\u043d \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0430\u0447\u0430\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434.<\/strong> <code>_option_logits<\/code> \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u0442 \u0432\u0435\u0441\u044c \u0431\u0430\u0442\u0447 \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0431\u0435\u0440\u0451\u0442 <code>logits[:, -1, :]<\/code>: \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u043e\u0442\u0432\u0435\u0442\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043a\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432.<\/strong> \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0431\u0443\u043a\u0432\u044b \u0431\u0435\u0440\u0451\u043c id \u0442\u043e\u043a\u0435\u043d\u043e\u0432 A \u0438 \u00a0A (\u0441 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c): \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0447\u0430\u0442\u044c\u0441\u044f \u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445. \u0411\u0435\u0440\u0451\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u0434\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0442\u043e\u043a\u0435\u043d\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/strong> \u0415\u0441\u043b\u0438 \u0443 \u0431\u0443\u043a\u0432\u044b \u0434\u0432\u0430 \u0442\u043e\u043a\u0435\u043d\u0430, \u0438\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f. \u0414\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 <code>logsumexp<\/code>: \u044d\u0442\u043e log(exp(a) + exp(b)), \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u044f\u043c\u043e \u0432 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430\u0445, \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c.<\/strong> \u041c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0434\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043b\u043e\u0432\u0443 \u0432\u0440\u043e\u0434\u0435 The. \u041c\u044b \u044d\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438 \u043d\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0436\u0434\u0443 \u0431\u0443\u043a\u0432\u0430\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041b\u0435\u0432\u044b\u0439 \u043f\u0430\u0434\u0434\u0438\u043d\u0433.<\/strong> \u041f\u0440\u043e\u043c\u043f\u0442\u044b \u0440\u0430\u0437\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0443 \u0432\u0441\u0435\u0445 \u0431\u044b\u043b\u0430 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043a\u043e\u043d\u0446\u043e\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u0430. \u0414\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0441 RoPE \u0441\u0434\u0432\u0438\u0433 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438\u0437-\u0437\u0430 \u043f\u0430\u0434\u0434\u0438\u043d\u0433\u0430 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442: \u043d\u0430 \u043a\u0440\u043e\u0448\u0435\u0447\u043d\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u0430\u0442\u0447 \u0438 \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441\u043e\u0432\u043f\u0430\u043b\u0438 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e 3\u00b710\u207b\u2078.<\/p>\n<\/li>\n<\/ol>\n<h4>\u0411\u043e\u0440\u044c\u0431\u0430 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c<\/h4>\n<p>\u041c\u043e\u0434\u0435\u043b\u0438 \u0441\u043a\u043b\u043e\u043d\u043d\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u0441\u043f\u0438\u0441\u043a\u0430. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>debias=True<\/code> \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0434\u0432\u0438\u0433\u0438: \u0434\u043b\u044f [&#8216;billing&#8217;, &#8216;tech support&#8217;, &#8216;sales&#8217;] \u044d\u0442\u043e \u0442\u0440\u0438 \u043f\u0440\u043e\u043c\u043f\u0442\u0430, \u0433\u0434\u0435 \u0431\u0443\u043a\u0432\u043e\u0439 A \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. \u0417\u0430\u0442\u0435\u043c \u043b\u043e\u0433-\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u0440\u0435\u0434\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c. \u0414\u043b\u044f \u0434\u0430\/\u043d\u0435\u0442 \u044d\u0442\u043e \u0434\u0432\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0430, \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u0438\u0437 \u043f\u044f\u0442\u0438 \u2014 \u043f\u044f\u0442\u044c. \u0412 \u0442\u0435\u0441\u0442\u0435 \u0441 \u00ab\u043f\u043e\u0434\u043a\u0440\u0443\u0447\u0435\u043d\u043d\u043e\u0439\u00bb \u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u043e\u043d\u0443\u0441\u043e\u043c \u043b\u044e\u0431\u0438\u0442 \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u0431\u0435\u0437 \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0431\u0435\u0436\u0434\u0430\u043b \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0430 \u0441 \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u0435\u043c \u0432\u0435\u0440\u043d\u044b\u0439.<\/p>\n<h2>\u276f \u0428\u0430\u0433 2. \u041a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0430<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0430 \u043c\u0438\u043b\u043b\u0438\u043e\u043d: \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u0438\u043c \u0447\u0438\u0441\u043b\u0430\u043c? \u041f\u043e\u043a\u0430 \u043d\u0435\u0442. \u041c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0443\u0447\u0430\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u043e\u043a\u0435\u043d, \u0430 \u043d\u0435 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0447\u0435\u0441\u0442\u043d\u044b\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 0,9 \u0432 \u0435\u0451 \u0443\u0441\u0442\u0430\u0445 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u00ab\u0432 90% \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u044f \u043f\u0440\u0430\u0432\u0430\u00bb. \u0422\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u0430: \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0443\u0432\u0435\u0440\u0435\u043d\u0430 \u0432 \u0441\u0435\u0431\u0435 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043a\u043e\u0448\u0435\u043d\u0430 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043e\u0434\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u00abYes\u00bb.<\/p>\n<p>\u0418\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0451\u0448\u0435\u0432\u043e: \u043d\u0443\u0436\u043d\u043e 100\u2013300 \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438 \u043f\u0430\u0440\u0430 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430.<\/p>\n<p><strong>\u041a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0430 \u041f\u043b\u0430\u0442\u0442\u0430<\/strong> \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0434\u0430\/\u043d\u0435\u0442. \u0411\u0435\u0440\u0451\u043c \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043b\u043e\u0433-\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 z = log P(yes) \u2212 log P(no): \u044d\u0442\u043e \u00ab\u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u00bb \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0435. \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u043c \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044e p = \u03c3(a\u00b7z + b) \u0432\u0441\u0435\u0433\u043e \u0441 \u0434\u0432\u0443\u043c\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438: a \u0440\u0430\u0441\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442 \u0438\u043b\u0438 \u0441\u0436\u0438\u043c\u0430\u0435\u0442 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0430 b \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u0442 \u043f\u043e\u0440\u043e\u0433.<\/p>\n<p><strong>\u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong> \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432. \u0423 \u043d\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 T: \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a softmax(s \/ T). \u041f\u0440\u0438 T &gt; 1 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043f\u0440\u0438 T &lt; 1 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>\u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043c\u0435\u0440\u0438\u043c \u0447\u0435\u0440\u0435\u0437 <strong>ECE<\/strong> (expected calibration error). \u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0434\u0435\u0441\u044f\u0442\u0438 \u043a\u043e\u0440\u0437\u0438\u043d\u0430\u043c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043b\u0435\u0439 \u0432\u0435\u0440\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. ECE \u2014 \u044d\u0442\u043e \u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u0430\u044f \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430. \u0415\u0441\u043b\u0438 ECE \u0440\u0430\u0432\u043d\u0430 0,05, \u0442\u043e \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 5 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432.<\/p>\n<pre><code class=\"python\">import numpy as npfrom sklearn.linear_model import LogisticRegressionfrom scipy.optimize import minimize_scalardef ece(probs, y, bins=10):    probs, y = np.asarray(probs), np.asarray(y)    conf, ok = probs.max(1), probs.argmax(1) == y    edges = np.linspace(0, 1, bins + 1)    total = 0.0    for lo, hi in zip(edges[:-1], edges[1:]):        m = (conf &gt; lo) &amp; (conf &lt;= hi)        if m.any():            total += m.mean() * abs(ok[m].mean() - conf[m].mean())    return float(total)class Platt:    def fit(self, z, y):        self.lr = LogisticRegression(C=1e6).fit(np.asarray(z).reshape(-1, 1), y)        return self    def predict(self, z):        return self.lr.predict_proba(np.asarray(z).reshape(-1, 1))[:, 1]def fit_temperature(S, y):  # S: (n, k) log-probs, y: (n,)    S, y = np.asarray(S), np.asarray(y)    def nll(log_t):        z = S \/ np.exp(log_t)        z = z - z.max(1, keepdims=True)        lp = z - np.log(np.exp(z).sum(1, keepdims=True))        return -lp[np.arange(len(y)), y].mean()    return float(np.exp(minimize_scalar(nll, bounds=(-3, 3), method='bounded').x))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041a\u043e\u0434 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438 \u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u043d\u0430 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0442\u0435\u0441\u0442 \u043d\u0438\u0436\u0435.<\/p>\n<h2>\u276f \u0428\u0430\u0433 3. \u0418\u0437\u043c\u0435\u0440\u044f\u0435\u043c \u043d\u0430 SST-2<\/h2>\n<p>\u0412\u043e\u0437\u044c\u043c\u0451\u043c SST-2 \u0438\u0437 GLUE: \u0431\u0438\u043d\u0430\u0440\u043d\u0443\u044e \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0446\u0435\u043d\u0437\u0438\u0439. \u0418\u0437 600 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 200 \u043f\u043e\u0439\u0434\u0443\u0442 \u043d\u0430 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0443, 400 \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443.<\/p>\n<pre><code class=\"python\">from datasets import load_datasetds = load_dataset('glue', 'sst2', split='validation').shuffle(seed=0)q = Bool('Is the sentiment of this movie review positive?')def margins(rows):    out = []    for r in rows:        lp = jev.logprobs(r['sentence'], q)  # [log P(yes), log P(no)]        out.append((lp[0] - lp[1]).item())    return np.array(out)z = margins(ds.select(range(600)))y = np.array(ds[:600]['label'])  # 1 = positive = 'Yes'z_cal, y_cal, z_te, y_te = z[:200], y[:200], z[200:], y[200:]platt = Platt().fit(z_cal, y_cal)p_raw = 1 \/ (1 + np.exp(-z_te))p_cal = platt.predict(z_te)def report(name, p):    print(name, 'acc=%.3f' % ((p &gt; .5) == y_te).mean(),          'ECE=%.3f' % ece(np.stack([1 - p, p], 1), y_te))report('raw', p_raw)report('calibrated', p_cal)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041f\u0440\u043e\u0433\u043e\u043d \u0434\u0435\u043b\u0430\u043b\u0441\u044f \u0432 Colab. \u041c\u0435\u0442\u043e\u0434\u0438\u043a\u0430:<\/p>\n<ul>\n<li>\n<p>\u0434\u0430\u0442\u0430\u0441\u0435\u0442: GLUE SST-2, \u0432\u044b\u0431\u043e\u0440\u043a\u0430 validation, \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 seed=0;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0437\u044f\u0442\u044b \u043f\u0435\u0440\u0432\u044b\u0435 600 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432: \u043f\u0435\u0440\u0432\u044b\u0435 200 \u043f\u043e\u0448\u043b\u0438 \u0432 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0434\u043b\u044f Platt scaling, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 400 \u0441\u0442\u0430\u043b\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u043e\u0439;<\/p>\n<\/li>\n<li>\n<p>MiniJev \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u043b \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u043e\u0432 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 Yes \u0438 No, \u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043c\u044b \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u043b\u0438 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430 400 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p><strong>\u041c\u0435\u0442\u0440\u0438\u043a\u0430<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u0414\u043e \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u041f\u043e\u0441\u043b\u0435 Platt scaling<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Accuracy<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,927<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,927<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">ECE<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,068<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,025<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>ECE \u0441\u043d\u0438\u0437\u0438\u043b\u0430\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 63%, \u0430 accuracy \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c. \u042d\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435.<\/p>\n<p>\u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0431\u0435\u0437 \u0444\u0430\u043d\u0444\u0430\u0440: \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430, \u043e\u0434\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0438 400 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f: \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0432\u0441\u0451 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0438\u043d\u0430\u0447\u0435.<\/p>\n<h2>\u276f \u0428\u0430\u0433 4. \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0442\u0438\u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 JSON<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0435: \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u0447\u0442\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0442\u043e\u0432 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438. \u041c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u043b\u0438 \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435 \u0436\u0435 \u0442\u0440\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044e (I was charged twice this month, please refund one of them.): \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e JSON \u0438 MiniJev. \u0417\u0430\u043c\u0435\u0440 \u0434\u0435\u043b\u0430\u043b\u0441\u044f \u0441\u0435\u0440\u0438\u0435\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0438\u0436\u0435 \u043c\u0435\u0434\u0438\u0430\u043d\u0430, \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c.<\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f JSON \u0432\u0435\u0440\u043d\u0443\u043b\u0430:<\/p>\n<pre><code class=\"json\">{  \"angry\": true,  \"team\": \"billing\",  \"urgency\": 3}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>MiniJev \u0432\u0435\u0440\u043d\u0443\u043b:<\/p>\n<pre><code class=\"python\">{'angry': {'probs': {'Yes': 0.9996947050094604, 'No': 0.00030534894904121757},           'p_yes': 0.9996947050094604}, 'team': {'probs': {'billing': 0.9999345541000366,                    'tech support': 5.19801105838269e-05,                    'sales': 1.3419315109786112e-05}}, 'urgency': {'probs': {'1': 0.7022849917411804,                       '2': 0.21086421608924866,                       '3': 0.04661112278699875,                       '4': 0.011071112006902695,                       '5': 0.029168494045734406},             'value': 1.4539737105369568}}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041e\u0442\u0434\u0435\u043b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0430 \u043a\u0430\u043a billing \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e 99,99%: \u0440\u0435\u0434\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043d\u0435 \u0441\u043e\u043c\u043d\u0435\u0432\u0430\u0435\u0442\u0441\u044f \u0438, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043f\u0440\u0430\u0432\u0430. \u0412\u0440\u0435\u043c\u044f:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p><strong>\u0421\u043f\u043e\u0441\u043e\u0431<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u041c\u0435\u0434\u0438\u0430\u043d\u0430<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u041c\u0438\u043d\u0438\u043c\u0443\u043c<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041e\u0431\u044b\u0447\u043d\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f JSON<\/p>\n<\/td>\n<td>\n<p align=\"left\">1,0514 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">1,0205 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">1,3433 \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">MiniJev<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,1959 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,1914 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,2338 \u0441<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041f\u043e \u043c\u0435\u0434\u0438\u0430\u043d\u0435 MiniJev <strong>\u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432 5,37 \u0440\u0430\u0437\u0430<\/strong>. JSON \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0430\u043b\u0438\u0434\u0435\u043d: Python \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b \u0435\u0433\u043e \u0432 {&#8216;angry&#8217;: True, &#8216;team&#8217;: &#8216;billing&#8217;, &#8216;urgency&#8217;: 3}.<\/p>\n<p>\u041e\u0442\u043a\u0443\u0434\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430? \u041e\u0431\u044b\u0447\u043d\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0432\u044b\u0434\u0430\u0451\u0442 JSON \u0442\u043e\u043a\u0435\u043d \u0437\u0430 \u0442\u043e\u043a\u0435\u043d\u043e\u043c, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u043e\u043a\u0435\u043d \u0436\u0434\u0451\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e. MiniJev \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0445\u043e\u0434\u043e\u0432 \u043f\u043e \u043f\u0440\u043e\u043c\u043f\u0442\u0443 \u0438 \u0447\u0438\u0442\u0430\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043b\u043e\u0433\u0438\u0442\u044b. \u0417\u0430\u043c\u0435\u0440 \u0441\u0434\u0435\u043b\u0430\u043d \u043d\u0430 \u043a\u043e\u0434\u0435 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>decide<\/code> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0442\u043e \u0435\u0441\u0442\u044c \u0441 <code>debias=True<\/code>: \u043d\u0430 \u0442\u0440\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f 2 + 3 + 5 = 10 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u043f\u0440\u043e\u0433\u043d\u0430\u043d\u043d\u044b\u0445 \u0442\u0440\u0435\u043c\u044f \u0431\u0430\u0442\u0447\u0430\u043c\u0438. MiniJev \u0432\u044b\u0438\u0433\u0440\u0430\u043b, \u0434\u0430\u0436\u0435 \u043d\u0435 \u044d\u043a\u043e\u043d\u043e\u043c\u044f.<\/p>\n<p>\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0434\u043e\u043a\u0430\u0437\u0430\u043d\u043e. \u041c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043b\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u0430 \u043d\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0442\u0432\u0435\u0442\u043e\u0432: \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u0441\u0440\u043e\u0447\u043d\u043e\u0441\u0442\u044c 3, \u0430 MiniJev \u0432\u044b\u0434\u0430\u043b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u0440\u0435\u0434\u043d\u0438\u043c \u043e\u043a\u043e\u043b\u043e 1,45. \u041a\u0430\u043a\u043e\u0439 \u0438\u0437 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043b\u0443\u0447\u0448\u0435, \u044d\u0442\u043e\u0442 \u0437\u0430\u043c\u0435\u0440 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442. \u042d\u0442\u043e \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0438 \u043e\u0434\u043d\u0430 \u0441\u0435\u0440\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a. \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u043c\u044b \u043d\u0435 \u0438\u0437\u043c\u0435\u0440\u044f\u043b\u0438.<\/p>\n<h2>\u276f \u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0438\u0437 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430: \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u043c\u0435\u043d\u044f\u0435\u0442 \u043e\u0446\u0435\u043d\u043a\u0443<\/h2>\n<p>\u041c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b\u0438 MiniJev \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438: I was charged twice this month, please refund one of them. \u041e\u0442\u0434\u0435\u043b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0432\u043e \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0445 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u043b\u0441\u044f \u043a\u0430\u043a billing, \u0430 \u0432\u043e\u0442 \u043e\u0446\u0435\u043d\u043a\u0430 \u0441\u0440\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0435\u043b\u0430 \u043e\u0442 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p><strong>\u0424\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043e \u0441\u0440\u043e\u0447\u043d\u043e\u0441\u0442\u0438<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u0421\u0440\u0435\u0434\u043d\u044f\u044f \u043e\u0446\u0435\u043d\u043a\u0430<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439: How urgent is it?<\/p>\n<\/td>\n<td>\n<p align=\"left\">1,40 \/ 5<\/p>\n<\/td>\n<td>\n<p align=\"left\">1 \u2014 72,74%<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 1: How urgent is it to resolve this customer issue?<\/p>\n<\/td>\n<td>\n<p align=\"left\">4,48 \/ 5<\/p>\n<\/td>\n<td>\n<p align=\"left\">5 \u2014 82,14%<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 2: How urgently should a support agent handle this issue, from 1 (low) to 5 (critical)?<\/p>\n<\/td>\n<td>\n<p align=\"left\">4,48 \/ 5<\/p>\n<\/td>\n<td>\n<p align=\"left\">5 \u2014 82,14%<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 3: Assign a priority: 1=routine, 2=low, 3=normal, 4=high, 5=critical.<\/p>\n<\/td>\n<td>\n<p align=\"left\">1,68 \/ 5<\/p>\n<\/td>\n<td>\n<p align=\"left\">1 \u2014 66,50%<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u0442\u0435\u043a\u0441\u0442\u0435 \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u043c\u0435\u043d\u044f\u043b\u0430\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 2,80 \u0431\u0430\u043b\u043b\u0430 \u0438\u0437 5. \u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u0443\u0442\u043e\u0447\u043d\u0451\u043d\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0434\u0430\u043b\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0448\u043a\u0430\u043b\u044b \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 routine \/ low \/ normal \/ high \/ critical \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0434\u0432\u043e\u0439\u043d\u043e\u0435 \u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u0435\u043d\u0435\u0433 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e \u0441\u0430\u043c\u044b\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u00abroutine\u00bb, \u0442\u043e \u0435\u0441\u0442\u044c \u0440\u0443\u0442\u0438\u043d\u0443. \u0412\u0438\u0434\u0438\u043c\u043e, \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u0435\u043d\u0435\u0433 \u043c\u043d\u043e\u0433\u043e.<\/p>\n<p>\u042d\u0442\u043e \u043d\u0435 \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439, \u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u043e\u043c: \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440. \u041d\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 zero-shot-\u043f\u043e\u0434\u0445\u043e\u0434\u0430. \u041b\u043e\u0433\u0438\u0442\u044b \u0434\u0430\u044e\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u043f\u0440\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430\u0445. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>debias=True<\/code> \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0438\u0437-\u0437\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043d\u043e \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a \u0441\u043c\u044b\u0441\u043b\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0430.<\/p>\n<h2>\u276f \u0415\u0441\u043b\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442<\/h2>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0435.<\/strong> \u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043e\u043a \u043d\u0430 \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u0445 \u0438\u043b\u0438 \u0441\u043e\u0442\u043d\u044f\u0445 \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c\u0438 \u0441\u0440\u043e\u0447\u043d\u043e\u0441\u0442\u0438. \u0422\u0430\u043a \u0432\u044b \u0438\u0437\u043c\u0435\u0440\u0438\u0442\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u043e\u0446\u0435\u043d\u043e\u043a, \u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435.<\/strong> <code>Qwen\/Qwen2.5-3B-Instruct<\/code> \u0432\u043b\u0435\u0437\u0430\u0435\u0442 \u0432 T4 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432 \u043f\u0440\u043e\u043c\u043f\u0442\u0435.<\/strong> \u042d\u0442\u043e \u0443\u0434\u043b\u0438\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u043c\u043f\u0442, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u0430\u0442\u044c \u0448\u043a\u0430\u043b\u0443 \u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 LoRA \u0441 \u043f\u043e\u0442\u0435\u0440\u044f\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043b\u043e\u0433\u0438\u0442\u0430\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432.<\/strong> \u0422\u043e\u0442 \u0436\u0435 \u043e\u0434\u043d\u043e\u043f\u0440\u043e\u0445\u043e\u0434\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043d\u043e \u0432\u0435\u0441\u0430 \u0443\u0447\u0430\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u043e\u0442\u043e\u0432\u0430\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f,<\/strong> \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>d1-3B<\/code> \u043e\u0442 Liquid AI, \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n<\/li>\n<\/ul>\n<h2>\u276f \u0418\u0442\u043e\u0433\u0438<\/h2>\n<p>\u0417\u0430 70 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 T4 \u043c\u044b \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c <strong>\u0432 5,37 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435<\/strong> \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e JSON. \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0440\u043e\u0447\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0434\u0435\u043d\u044c\u0433\u0438 \u0437\u0430 \u0434\u0432\u043e\u0439\u043d\u043e\u0435 \u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u043e\u043d\u0430 \u0442\u0430\u043a \u0438 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0430\u0441\u044c: \u043e\u0442 1,4 \u0434\u043e 4,5 \u0438\u0437 5, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438. \u0417\u0430\u0442\u043e \u043d\u0430 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f \u0443 \u043d\u0435\u0451 \u0443\u0448\u043b\u043e \u0432\u0441\u0435\u0433\u043e 0,2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b.<\/p>\n<details class=\"spoiler\">\n<summary>\u041c\u043e\u0436\u0435\u0442\u00a0\u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e:<\/summary>\n<div class=\"spoiler__content\">\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/timeweb\/articles\/1099224\/\"><strong>\u0427\u0442\u043e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u043e \u0432\u0430\u0448\u0435\u043c \u0431\u0440\u0435\u043d\u0434\u0435: \u0440\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u044f \u0432 \u044d\u043f\u043e\u0445\u0443 \u0418\u0418-\u043e\u0442\u0432\u0435\u0442\u043e\u0432<\/strong><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/timeweb\/articles\/1102272\/\"><strong>\u0417\u0435\u043b\u0451\u043d\u044b\u0439 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u0441\u043b\u043e\u043c\u0430\u043d\u043d\u0430\u044f \u043a\u043e\u0440\u0437\u0438\u043d\u0430: \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0441\u0446\u0435\u043d\u0430\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432 Statuser<\/strong><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/timeweb\/articles\/1095842\/\"><strong>\u041a\u0430\u043a \u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b Hermes Agent \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c, Obsidian, \u043f\u043e\u0447\u0442\u0435 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u043d\u0430 Telegram-\u0431\u043e\u0442\u043e\u0432<\/strong><\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/13\/04\/b6\/1304b630a68a95f4a26202c92c8c72a8.jpg\" alt=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u21a9    \" title=\"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u21a9    \" width=\"1080\" height=\"607\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/13\/04\/b6\/1304b630a68a95f4a26202c92c8c72a8.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/13\/04\/b6\/1304b630a68a95f4a26202c92c8c72a8.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/timeweb.cloud\/?utm_source=habr&amp;utm_medium=banner&amp;utm_campaign=promo\"><strong><em>\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u21a9<\/em><\/strong><\/a>    <\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p><a href=\"https:\/\/t.me\/timewebru\"><strong>\u041d\u043e\u0432\u043e\u0441\u0442\u0438, \u043e\u0431\u0437\u043e\u0440\u044b \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0438 \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u044b \u043e\u0442\u00a0\u043a\u043e\u043c\u0430\u043d\u0434\u044b\u00a0<\/strong><\/a><a href=\"http:\/\/Timeweb.Cloud\"><strong>Timeweb.Cloud<\/strong><\/a><a href=\"https:\/\/t.me\/timewebru\"><strong>\u00a0\u2014 \u0432\u00a0\u043d\u0430\u0448\u0435\u043c Telegram\u2011\u043a\u0430\u043d\u0430\u043b\u0435<\/strong><\/a>\u00a0<strong>\u21a9<\/strong><\/p>\n<\/blockquote>\n<\/div>\n<p>\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\/1103368\/\">https:\/\/habr.com\/ru\/articles\/1103368\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>15 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f 2026 \u0433\u043e\u0434\u0430 TypeSafe AI \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0430 Jev \u2014 \u043c\u043e\u0434\u0435\u043b\u044c \u043a\u043b\u0430\u0441\u0441\u0430 \u00abSystem One\u00bb: \u043e\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043e\u0446\u0435\u043d\u043a\u0438 \u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u0442\u0435\u043a\u0441\u0442\u0430. \u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 Jev \u0430\u043d\u0430\u043b\u043e\u0433\u0438 \u043f\u043e\u0431\u0435\u0436\u0430\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043c\u0443 \u043d\u0435 \u043b\u0435\u043d\u044c: Liquid AI, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 d1 \u0443\u0436\u0435 \u0447\u0435\u0440\u0435\u0437 \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438. \u0410 \u043c\u044b \u0447\u0435\u043c \u0445\u0443\u0436\u0435? \u041d\u0443, \u043f\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0443, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0445\u0443\u0436\u0435. \u0417\u0430\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e.\u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0430 \u00ab\u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442\u00bb \u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u043a\u0432\u043e\u0439, \u0438 \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 Jev \u043d\u0430 T4 \u0432 Colab: \u044f\u0434\u0440\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 70 \u0441\u0442\u0440\u043e\u043a, \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0443 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0437\u0430\u043c\u0435\u0440 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438. \u0421\u0440\u0430\u0437\u0443 \u043e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c: \u044d\u0442\u043e \u043d\u0435 Jev. \u041c\u044b \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043e\u0431\u044b\u0447\u043d\u0443\u044e instruct-\u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437 \u0435\u0451 \u043b\u043e\u0433\u0438\u0442\u043e\u0432 \u0431\u0435\u0437 \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0443 \u0434\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043e\u043d\u0430 \u043d\u0435 \u0434\u043e\u0442\u044f\u043d\u0435\u0442.\u276f \u0427\u0442\u043e \u043c\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c\u0423 Jev \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439: \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u0442\u0435\u043a\u0441\u0442) \u0438 \u043d\u0430\u0431\u043e\u0440 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438. \u0412\u043e\u043f\u0440\u043e\u0441\u044b \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0440\u0451\u0445 \u0442\u0438\u043f\u043e\u0432: \u0434\u0430\/\u043d\u0435\u0442, \u0432\u044b\u0431\u043e\u0440 \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438 \u043e\u0446\u0435\u043d\u043a\u0430 \u043f\u043e \u0448\u043a\u0430\u043b\u0435. \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435: \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Bool, Choice \u0438 Score, \u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c\u0438.\u276f \u041a\u0430\u043a LLM \u00ab\u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442\u00bb: \u043e\u0442 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0434\u043e \u043b\u043e\u0433\u0438\u0442\u043e\u0432\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u044c \u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u0442\u0430\u043c \u043d\u0435\u0442: \u043d\u0430\u043c \u0445\u0432\u0430\u0442\u0438\u0442 \u0448\u0435\u0441\u0442\u0438 \u0448\u0430\u0433\u043e\u0432.\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434\u0422\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0446\u0438\u044f. \u0422\u0435\u043a\u0441\u0442 \u0440\u0435\u0436\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u043e\u043a\u0435\u043d\u044b (\u043a\u0443\u0441\u043a\u0438 \u0441\u043b\u043e\u0432), \u0438 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u043e\u043c\u0435\u0440 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435. \u0423 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0442\u044b\u0441\u044f\u0447 \u0434\u043e \u0441\u043e\u0442\u0435\u043d \u0442\u044b\u0441\u044f\u0447 \u0442\u043e\u043a\u0435\u043d\u043e\u0432.\u042d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0435\u043a\u0442\u043e\u0440, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443\u043c\u0435\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043b\u043e\u0438 \u0441\u0435\u0442\u0438.\u0421\u043b\u043e\u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0430. \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f (attention) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u043e\u043a\u0435\u043d\u0443 \u00ab\u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c\u00bb \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0438 \u043f\u043e\u0434\u043c\u0435\u0448\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u0441\u043b\u043e\u0451\u0432 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0451 \u0441\u043a\u0440\u044b\u0442\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435: \u0432\u0435\u043a\u0442\u043e\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0436\u0435 \u0443\u0447\u0442\u0451\u043d \u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441\u043b\u0435\u0432\u0430.\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0442\u043e\u043a\u0435\u043d. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u043e\u043a\u0435\u043d, \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0440\u044b\u0442\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u043f\u0440\u043e\u043c\u043f\u0442\u0430: \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u0436\u0435 \u0432\u043e\u0448\u043b\u043e \u0432 \u043d\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.\u041b\u043e\u0433\u0438\u0442\u044b. \u042d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u00ab\u0441\u043b\u043e\u0432\u0430\u0440\u044c \u00d7 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u00bb, \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u0441\u043b\u043e\u0432\u0430\u0440\u044f. \u042d\u0442\u0438 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0442\u0430\u043c\u0438: \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u043e\u0433\u0438\u0442, \u0442\u0435\u043c \u043e\u0445\u043e\u0442\u043d\u0435\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u0431\u044b \u044d\u0442\u043e\u0442 \u0442\u043e\u043a\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c.Softmax. \u041b\u043e\u0433\u0438\u0442\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 p_i = exp(z_i) \/ \u03a3 exp(z_j): \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b \u0438 \u0432 \u0441\u0443\u043c\u043c\u0435 \u0434\u0430\u044e\u0442 \u0435\u0434\u0438\u043d\u0438\u0446\u0443.\u041e\u0431\u044b\u0447\u043d\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0441 \u044d\u0442\u0438\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u0443 \u0432\u0435\u0449\u044c: \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u043e\u043a\u0435\u043d (\u0441\u0430\u043c\u044b\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u0439 \u0438\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439), \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u043a \u0442\u0435\u043a\u0441\u0442\u0443 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0441\u0451 \u0437\u0430\u043d\u043e\u0432\u043e \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c JSON \u0432\u0438\u0434\u0430 {&#171;angry&#187;: true, &#171;team&#187;: &#171;billing&#187;, &#171;urgency&#187;: 3}, \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0440\u0430\u0437: \u0441\u043a\u043e\u0431\u043a\u0438, \u043a\u0430\u0432\u044b\u0447\u043a\u0438, \u043a\u043b\u044e\u0447\u0438 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u0436\u0435 \u0442\u043e\u043a\u0435\u043d\u044b. \u0422\u043e\u0447\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u043d\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0434\u0432\u0443\u0445-\u0442\u0440\u0451\u0445 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0448\u0430\u0433\u043e\u0432, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0436\u0434\u0451\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e.\u0413\u0434\u0435 \u043f\u0440\u044f\u0447\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u043c\u043f\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u00ab\u043e\u0442\u0432\u0435\u0442\u044c \u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u043a\u0432\u043e\u0439: A, B \u0438\u043b\u0438 C\u00bb, \u0442\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0436\u0435 \u0448\u0430\u0433\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0442\u0430\u043a \u0440\u0430\u0437\u0434\u0430\u0451\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438 A, B \u0438 C. \u041d\u0438\u0447\u0435\u0433\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0438 \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e: \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u044d\u0442\u0438 \u0442\u0440\u0438 \u0447\u0438\u0441\u043b\u0430. \u041c\u044b \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c softmax \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0431\u0443\u043a\u0432\u0430\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432: p_A = exp(z_A) \/ (exp(z_A) + exp(z_B) + exp(z_C)).\u0412\u044b\u0445\u043e\u0434\u0438\u0442, \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043b\u0435\u0436\u0438\u0442 \u0443\u0436\u0435 \u0432 \u043b\u043e\u0433\u0438\u0442\u0430\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u0440\u043e\u043c\u043f\u0442\u0430. \u0421\u0430\u043c \u043f\u0440\u043e\u043c\u043f\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434 (GPU \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0441\u0435 \u0435\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u044b \u0441\u0440\u0430\u0437\u0443 \u043e\u0434\u043d\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439), \u0438 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0436\u0434\u0430\u0442\u044c \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438. \u041d\u0438\u0436\u0435 \u043c\u044b \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u0440\u0438\u043c.\u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u0443\u043a\u0432\u044b, \u0430 \u043d\u0435 \u0441\u043b\u043e\u0432\u0430? \u0421\u043b\u043e\u0432\u043e \u0432\u0440\u043e\u0434\u0435 billing \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u0438 \u0442\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0442\u044c \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0448\u0430\u0433\u043e\u0432. \u041e\u0434\u043d\u0430 \u0431\u0443\u043a\u0432\u0430 \u2014 \u043e\u0434\u0438\u043d \u0442\u043e\u043a\u0435\u043d, \u0438 \u0432\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0447\u0435\u0441\u0442\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439. \u041f\u043b\u0430\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c: \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043b\u044e\u0431\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u0441\u043f\u0438\u0441\u043a\u0430. \u0421 \u044d\u0442\u0438\u043c \u043c\u044b \u0442\u043e\u0436\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f.\u0427\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u00ab\u043d\u0435 \u0433\u0430\u043b\u043b\u044e\u0446\u0438\u043d\u0438\u0440\u0443\u0435\u0442\u00bb\u041e\u0442\u0432\u0435\u0442 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432: \u043c\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0431\u0443\u043a\u0432\u044b \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430. \u041d\u043e \u044d\u0442\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0430, \u0430 \u043d\u0435 \u0438\u0441\u0442\u0438\u043d\u044b: \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0430. \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c.\u276f \u0416\u0435\u043b\u0435\u0437\u043e \u0438 \u043c\u043e\u0434\u0435\u043b\u044c\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 Colab \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0434\u0430\u0451\u0442 T4 \u0441 16 \u0413\u0411 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043e\u043a\u043e\u043b\u043e 15 \u0413\u0411), \u0441\u0435\u0441\u0441\u0438\u044f \u0436\u0438\u0432\u0451\u0442 \u0434\u043e 12 \u0447\u0430\u0441\u043e\u0432, \u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 GPU \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442: \u043b\u043e\u0442\u0435\u0440\u0435\u044f, \u0437\u0430\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430\u044f. \u0423 T4 \u043d\u0435\u0442 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 bfloat16, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432 float16.\u0411\u0435\u0440\u0451\u043c Qwen\/Qwen2.5-1.5B-Instruct: \u0432 fp16 \u044d\u0442\u043e \u043e\u043a\u043e\u043b\u043e 3 \u0413\u0411, \u0438 \u0442\u0430\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 float16. \u0415\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0442\u043e\u0447\u043d\u0435\u0435, \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 Qwen\/Qwen2.5-3B-Instruct (\u043e\u043a\u043e\u043b\u043e 6 \u0413\u0411). \u041c\u043e\u0434\u0435\u043b\u0438, \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 bf16, \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u044b\u0434\u0430\u044e\u0442 \u0432 fp16 NaN, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043b\u043e\u0433\u0438\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u044c.\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430: !pip install -q -U transformers accelerate scikit-learn datasets, \u0437\u0430\u0442\u0435\u043c Runtime \u2192 Change runtime type \u2192 T4 GPU.\u276f \u0428\u0430\u0433 1. \u042f\u0434\u0440\u043eimport torchfrom transformers import AutoTokenizer, AutoModelForCausalLMLETTERS = &#8216;ABCDEFGHIJKLMNOPQRSTUVWXYZ&#8217;SYSTEM = (&#8216;You are a decision engine. Read the state, then answer the question &#8216;          &#8216;with exactly one option letter and nothing else.&#8217;)def Bool(text):    return {&#8216;type&#8217;: &#8216;bool&#8217;, &#8216;instructions&#8217;: text, &#8216;options&#8217;: [&#8216;Yes&#8217;, &#8216;No&#8217;]}def Choice(text, options):    return {&#8216;type&#8217;: &#8216;choice&#8217;, &#8216;instructions&#8217;: text, &#8216;options&#8217;: list(options)}def Score(text, lo=1, hi=5):    vals = list(range(lo, hi + 1))    return {&#8216;type&#8217;: &#8216;score&#8217;, &#8216;instructions&#8217;: text, &#8216;options&#8217;: [str(v) for v in vals], &#8216;values&#8217;: vals}class MiniJev:    def __init__(self, model_id, dtype=torch.float16, device=&#8217;cuda&#8217;):        self.tok = AutoTokenizer.from_pretrained(model_id, padding_side=&#8217;left&#8217;)        if self.tok.pad_token is None:            self.tok.pad_token = self.tok.eos_token        self.model = AutoModelForCausalLM.from_pretrained(model_id, dtype=dtype).to(device).eval()        self.device, self._ids = device, {}    def _label_ids(self, label):        if label not in self._ids:            ids = set()            for v in (label, &#8216; &#8216; + label):  # &#8216;A&#8217; \u0438 &#8216; A&#8217;, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0442\u043e\u043a\u0435\u043d                t = self.tok.encode(v, add_special_tokens=False)                if len(t) == 1:                    ids.add(t[0])            self._ids[label] = sorted(ids)        return self._ids[label]    def _prompt(self, state, instructions, options):        lines = &#8216;\\n&#8217;.join(f'{LETTERS[i]}. {o}&#8217; for i, o in enumerate(options))        user = (f&#8217;State:\\n{state}\\n\\nQuestion: {instructions}\\n\\n&#8217;                f&#8217;Options:\\n{lines}\\n\\nAnswer with the letter only.&#8217;)        msgs = [{&#8216;role&#8217;: &#8216;system&#8217;, &#8216;content&#8217;: SYSTEM}, {&#8216;role&#8217;: &#8216;user&#8217;, &#8216;content&#8217;: user}]        return self.tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)    @torch.no_grad()    def _option_logits(self, prompts, k):        enc = self.tok(prompts, return_tensors=&#8217;pt&#8217;, padding=True,                       add_special_tokens=False).to(self.device)        logits = self.model(**enc).logits[:, -1, :].float()  # readout at the last position        assert torch.isfinite(logits).all(), &#8216;NaN\/inf: try float32 or another model&#8217;        return torch.stack([torch.stack([torch.logsumexp(logits[i, self._label_ids(LETTERS[j])], 0)                                         for j in range(k)]) for i in range(len(prompts))])    def logprobs(self, state, q, debias=True):        opts, k = q[&#8216;options&#8217;], len(q[&#8216;options&#8217;])        shifts = range(k) if debias else [0]        prompts = [self._prompt(state, q[&#8216;instructions&#8217;], opts[r:] + opts[:r]) for r in shifts]        lp = torch.log_softmax(self._option_logits(prompts, k), -1)  # (shifts, k)        out = torch.zeros(k, device=lp.device)        for row, r in zip(lp, shifts):            for j in range(k):                out[(j + r) % k] += row[j] \/ len(shifts)        return out  # mean log-prob of each ORIGINAL option    def decide(self, state, questions, T=1.0, debias=True):        res = {}        for name, q in questions.items():            p = torch.softmax(self.logprobs(state, q, debias) \/ T, -1).tolist()            item = {&#8216;probs&#8217;: dict(zip(q[&#8216;options&#8217;], p))}            if q[&#8216;type&#8217;] == &#8216;bool&#8217;:                item[&#8216;p_yes&#8217;] = p[0]            if q[&#8216;type&#8217;] == &#8216;score&#8217;:                item[&#8216;value&#8217;] = sum(a * b for a, b in zip(p, q[&#8216;values&#8217;]))            res[name] = item        return res\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435:jev = MiniJev(&#8216;Qwen\/Qwen2.5-1.5B-Instruct&#8217;)state = &#8216;I was charged twice this month, please refund one of them.&#8217;print(jev.decide(state, {    &#8216;angry&#8217;: Bool(&#8216;Is the customer angry?&#8217;),    &#8216;team&#8217;: Choice(&#8216;Which team should handle it?&#8217;, [&#8216;billing&#8217;, &#8216;tech support&#8217;, &#8216;sales&#8217;]),    &#8216;urgency&#8217;: Score(&#8216;How urgent is it?&#8217;),}))\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c, \u043f\u043b\u044e\u0441 p_yes \u0434\u043b\u044f \u0434\u0430\/\u043d\u0435\u0442 \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 value \u0434\u043b\u044f \u0448\u043a\u0430\u043b\u044b.\u00a0\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0438\u041f\u0440\u043e\u043c\u043f\u0442. _prompt \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0432\u043e\u043f\u0440\u043e\u0441 \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b A, B, C. \u0428\u0430\u0431\u043b\u043e\u043d \u0447\u0430\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043a\u043e\u043d\u0435\u0446 \u00ab\u0445\u043e\u0434 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u0430\u00bb, \u0442\u0430\u043a \u0447\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u043e\u043a\u0435\u043d \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0430\u0447\u0430\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430.\u041e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434. _option_logits \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u0442 \u0432\u0435\u0441\u044c \u0431\u0430\u0442\u0447 \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0431\u0435\u0440\u0451\u0442 logits[:, -1, :]: \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u043e\u0442\u0432\u0435\u0442\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e.\u041c\u0435\u0442\u043a\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0431\u0443\u043a\u0432\u044b \u0431\u0435\u0440\u0451\u043c id \u0442\u043e\u043a\u0435\u043d\u043e\u0432 A \u0438 \u00a0A (\u0441 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c): \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0447\u0430\u0442\u044c\u0441\u044f \u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445. \u0411\u0435\u0440\u0451\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u0434\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0442\u043e\u043a\u0435\u043d\u043e\u043c.\u0421\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u0443 \u0431\u0443\u043a\u0432\u044b \u0434\u0432\u0430 \u0442\u043e\u043a\u0435\u043d\u0430, \u0438\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f. \u0414\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 logsumexp: \u044d\u0442\u043e log(exp(a) + exp(b)), \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u044f\u043c\u043e \u0432 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430\u0445, \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438.\u041d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c. \u041c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0434\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043b\u043e\u0432\u0443 \u0432\u0440\u043e\u0434\u0435 The. \u041c\u044b \u044d\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438 \u043d\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0436\u0434\u0443 \u0431\u0443\u043a\u0432\u0430\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432.\u041b\u0435\u0432\u044b\u0439 \u043f\u0430\u0434\u0434\u0438\u043d\u0433. \u041f\u0440\u043e\u043c\u043f\u0442\u044b \u0440\u0430\u0437\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0443 \u0432\u0441\u0435\u0445 \u0431\u044b\u043b\u0430 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u043a\u043e\u043d\u0446\u043e\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u0430. \u0414\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0441 RoPE \u0441\u0434\u0432\u0438\u0433 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438\u0437-\u0437\u0430 \u043f\u0430\u0434\u0434\u0438\u043d\u0433\u0430 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442: \u043d\u0430 \u043a\u0440\u043e\u0448\u0435\u0447\u043d\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u0430\u0442\u0447 \u0438 \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441\u043e\u0432\u043f\u0430\u043b\u0438 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e 3\u00b710\u207b\u2078.\u0411\u043e\u0440\u044c\u0431\u0430 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c\u041c\u043e\u0434\u0435\u043b\u0438 \u0441\u043a\u043b\u043e\u043d\u043d\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u0441\u043f\u0438\u0441\u043a\u0430. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 debias=True \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0434\u0432\u0438\u0433\u0438: \u0434\u043b\u044f [&#8216;billing&#8217;, &#8216;tech&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-501612","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/501612","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=501612"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/501612\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=501612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=501612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=501612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}