{"id":353235,"date":"2024-05-20T22:23:55","date_gmt":"2024-05-20T22:23:55","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=353235"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=353235","title":{"rendered":"<span>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0432\u043e\u0439 \u043a\u043b\u043e\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Fine-tuned LLM<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p> \u041e\u0431\u0440\u0435\u0442\u0438\u0442\u0435 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0430  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/44f\/b95\/d0c\/44fb95d0c2f05d12d9a0b4259fc649af.png\" alt=\"Image generated by Stable Diffusion.  \" title=\"Image generated by Stable Diffusion.  \" width=\"828\" height=\"567\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/44f\/b95\/d0c\/44fb95d0c2f05d12d9a0b4259fc649af.png\"\/><\/p>\n<div><figcaption>Image generated by Stable Diffusion.  <\/figcaption><\/div>\n<\/figure>\n<p><a href=\"https:\/\/betterprogramming.pub\/unleash-your-digital-twin-how-fine-tuning-llm-can-create-your-perfect-doppelganger-b5913e7dda2e\" rel=\"noopener noreferrer nofollow\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u0421\u0435\u0440\u0433\u0435\u044f \u0421\u0430\u0432\u0432\u043e\u0432\u0430.<\/a><\/p>\n<p><strong>\u0426\u0435\u043b\u044c \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/strong> &#8212; \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0438 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c LLM \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442.\u00a0\u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 Falcon-7B \u0441 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430\u043c\u0438 LoRa, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438\u00a0<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\" rel=\"noopener noreferrer nofollow\">Lit-GPT<\/a>.  <\/p>\n<p>\u0412\u044b \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0438\u0441\u044c, \u043a\u0430\u043a\u043e\u0432\u043e \u044d\u0442\u043e &#8212; \u0438\u043c\u0435\u0442\u044c \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0430?\u00a0\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e \u0441\u0435\u0431\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0441\u0442\u0438 \u0431\u0435\u0441\u0435\u0434\u044b, \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0438 \u0434\u0430\u0436\u0435 \u0432\u044b\u0440\u0430\u0436\u0430\u0442\u044c \u043c\u044b\u0441\u043b\u0438?\u00a0\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0430 (\u0418\u0418) \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u0443 \u043d\u0435\u043a\u043e\u0433\u0434\u0430 \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0438\u0434\u0435\u044e \u0434\u043e\u0441\u0442\u0438\u0436\u0438\u043c\u043e\u0439.  <\/p>\n<p>\u0423\u0441\u0438\u043b\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0430 \u043f\u0440\u0438\u0432\u0435\u043b\u0438 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u044b\u0441\u043e\u043a\u043e\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 open-source LLMs, \u0432\u043a\u043b\u044e\u0447\u0430\u044f LLaMA, Falcon, StableLM \u0438 Pythia. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u044d\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438, \u0447\u0442\u043e\u0431\u044b \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043a \u0432\u0430\u0448\u0435\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u0447\u0430\u0442-\u0431\u043e\u0442\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b. \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0449\u0438\u0442\u0443 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Cloud APIs.  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u044f \u0445\u043e\u0442\u0435\u043b, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0432 \u043c\u043e\u0435\u043c \u0441\u0442\u0438\u043b\u0435, \u043f\u043e\u0434\u0440\u0430\u0436\u0430\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0448\u0443\u0442\u043a\u0438, \u0444\u0440\u0430\u0437\u043e\u0447\u043a\u0438 \u0438 \u0441\u043b\u043e\u0432\u0430.<\/p>\n<h2>\u0421\u0431\u043e\u0440 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445  <\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0443\u0433\u043b\u0443\u0431\u0438\u0442\u044c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438, \u0445\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 GPT-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439.\u00a0\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0448\u0430\u0433 \u0432\u043f\u0435\u0440\u0435\u0434 \u0438 \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0443\u0441\u0441\u043a\u043e\u043c\u0443 \u044f\u0437\u044b\u043a\u0443.<\/p>\n<ul>\n<li>\n<p>\u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0445 \u0442\u0435\u043a\u0441\u0442\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0440\u0443\u0441\u0441\u043a\u0438\u0439 &#8212; \u043c\u043e\u0439 \u0440\u043e\u0434\u043d\u043e\u0439 \u044f\u0437\u044b\u043a, \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0431\u0430\u0437\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0430\u044f \u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0421\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445  <\/h2>\n<p>\u042f \u0432\u044b\u0431\u0440\u0430\u043b Telegram, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 API \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d \u0441\u043b\u0443\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439 \u0434\u043b\u044f \u043c\u043e\u0435\u0433\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0434\u0440\u0443\u0437\u044c\u044f\u043c\u0438.\u00a0\u042d\u0442\u043e\u0442 \u0432\u044b\u0431\u043e\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0433\u043b\u0443\u0431\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u043b\u0443\u0447\u0448\u0435 \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u043d\u044f.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044f\u00a0<a href=\"https:\/\/docs.telethon.dev\/en\/stable\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0432\u0441\u044e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0443 \u0438\u0437 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445 \u0447\u0430\u0442\u043e\u0432 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0445 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<ol>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u043b\u0438\u0435\u043d\u0442 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">from telethon.sync import TelegramClient  client = TelegramClient(PHONE_NUMBER, TELEGRAM_APP_ID, TELEGRAM_APP_HASH) client.start()<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">def get_dialogs(limit: int | None = 100) -> list[Dialog]:     \"\"\"Get all dialogs from the Telegram.\"\"\"     dialogs: list[Dialog] = client.get_dialogs(limit=limit)     dialogs = [dialog for dialog in dialogs if dialog.is_user]  # remove groups or channels     logger.info(f\"Found {len(dialogs)} dialogs\")     return dialogs<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0418 \u043f\u043e\u0434 \u043a\u043e\u043d\u0435\u0446 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043e\u043a:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">def parse_messages(dialog: Dialog, limit: int = 1000) -> list[dict]:     \"\"\"Get all messages from the dialog.\"\"\"     all_messages_list = []     offset_id = 0      while True:         messages: list[Message] = client(             GetHistoryRequest(                 peer=dialog,                 offset_id=offset_id,                 offset_date=None,                 add_offset=0,                 limit=limit,                 max_id=0,                 min_id=0,                 hash=0,             )         ).messages         if not messages:             break          all_messages_list.extend(             {                 \"date\": message.date.isoformat(),                 \"message\": message.message,                 \"out\": message.out,             }             for message in messages             # Filter audio or video content             if message.message and not message.is_bot         )         offset_id = offset_id = messages[-1].id     return all_messages_list<\/code><\/pre>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/gist.github.com\/slgero\/b3b020b60ca92154641f39e5813c98e7\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/862\/9b9\/8bf\/8629b98bfd985e446993d916ad3c70bf.png\" width=\"720\" height=\"270\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/862\/9b9\/8bf\/8629b98bfd985e446993d916ad3c70bf.png\"\/><\/figure>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u044f \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u043b \u0430\u0443\u0434\u0438\u043e- \u0438 \u0432\u0438\u0434\u0435\u043e\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043b\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0435.\u00a0\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u0435 \u043c\u043e\u0433\u043b\u0430 \u0431\u044b\u0442\u044c \u0443\u0442\u0435\u0440\u044f\u043d\u0430.\u00a0\u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u043e\u0431\u044a\u0435\u043c\u043d\u0430\u044f \u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.   <\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445  <\/h2>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438. <\/p>\n<p><strong>Fine-tune<\/strong> \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u0435\u0431\u044f \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430\u043d\u0430\u043b\u0438\u0437 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u0430).\u00a0ChatGPT (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0441\u044f \u043a\u0430\u043a fine-tuned \u0432\u0435\u0440\u0441\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 GPT-3) \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c.\u00a0\u041d\u0430\u0431\u043e\u0440\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0442\u0440\u0438 \u043a\u043b\u044e\u0447\u0430:\u00a0<strong>instruction<\/strong>,\u00a0<strong>input <\/strong>(\u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438) \u0438 <strong>response\u00a0<\/strong>\u043e\u0442 LLM.\u00a0\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438:   <\/p>\n<pre><code class=\"python\">[     {         \"instruction\": \"Can cats communicate?\",         \"context\": \"Cats need to communicate with each other for bonding, and relating with each other; they need to collaborate, play, and share resources...\",         \"response\": \"Cat vocalizations have been categorized according to a range of characteristics...\",     } ]<\/code><\/pre>\n<p>\u0421\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u043e\u0447\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/86c\/047\/409\/86c047409e808d1e3a2b0e8bb468043e.png\" alt=\"Fine-tuning a pretrained LLM to follow instructions.  \" title=\"Fine-tuning a pretrained LLM to follow instructions.  \" width=\"720\" height=\"284\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/86c\/047\/409\/86c047409e808d1e3a2b0e8bb468043e.png\"\/><\/p>\n<div><figcaption><em>Fine-tuning a pretrained LLM to follow instructions.<\/em>  <\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438.\u00a0\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0432\u0435\u0441\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u0432\u0435\u0442\u0430.\u00a0\u041e\u0434\u043d\u0430\u043a\u043e, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043c\u043e\u0435\u0433\u043e \u043e\u043f\u044b\u0442\u0430, \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 (\u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a 7B) \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u0440\u044f\u0434 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439.\u00a0\u0422\u0430\u043a \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043b\u0443\u0447\u0448\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043e\u0435\u0433\u043e \u0447\u0430\u0442\u0430, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0420\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0431\u0435\u0441\u0435\u0434\u044b \u043d\u0430 \u0431\u0430\u0442\u0447\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0440\u044b\u0432 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0434\u0435\u043d\u044c.\u00a0\u0422\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u044d\u0442\u043e \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u043b\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u0430, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0438\u0434\u0443\u0449\u0438\u0445 \u043f\u043e\u0434\u0440\u044f\u0434 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0432 \u043e\u0434\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u043a \u043a \u0441\u0432\u043e\u0438\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0438 \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043d\u0438\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c6c\/458\/4c8\/c6c4584c8c5bcfb9e0aeddccfbe661cd.png\" alt=\"Preprocessing chat messages.  \" title=\"Preprocessing chat messages.  \" width=\"1100\" height=\"490\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c6c\/458\/4c8\/c6c4584c8c5bcfb9e0aeddccfbe661cd.png\"\/><\/p>\n<div><figcaption>Preprocessing chat messages.  <\/figcaption><\/div>\n<\/figure>\n<p>\u042f \u0442\u0430\u043a\u0436\u0435 \u043e\u0447\u0438\u0441\u0442\u0438\u043b \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0447\u0430\u0442\u043e\u0432 \u043e\u0442 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0442\u0430\u043a\u043e\u0439 \u043a\u0430\u043a \u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0430\u0440\u043e\u043b\u0438 \u0438\u043b\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0438\u0441\u044c\u043c\u0430.<\/p>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c 51\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0447\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u043e \u0441\u00a0<a href=\"https:\/\/www.databricks.com\/blog\/2023\/04\/12\/dolly-first-open-commercially-viable-instruction-tuned-llm\" rel=\"noopener noreferrer nofollow\">Dolly 2.0 instruction dataset<\/a>\u00a0\u043e\u0442 Databricks (~15\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439) \u0438\u00a0<a href=\"https:\/\/github.com\/tatsu-lab\/stanford_alpaca\" rel=\"noopener noreferrer nofollow\">Alpaca dataset<\/a>\u00a0(~52\u041a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439).<\/p>\n<h2>\u041c\u043e\u0434\u0435\u043b\u044c  <\/h2>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u0432\u044b\u0431\u0440\u0430\u0442\u044c open-source large LLM\u00a0<a href=\"https:\/\/falconllm.tii.ae\/\" rel=\"noopener noreferrer nofollow\">Falcon<\/a> \u043e\u0442\u00a0<a href=\"https:\/\/tii.ae\/\" rel=\"noopener noreferrer nofollow\">Technology Innovation Institute<\/a>.\u00a0\u042d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0430\u0432\u0442\u043e\u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u043a\u043e\u0434\u0435\u0440\u0430 \u0441 \u0434\u0432\u0443\u043c\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438: \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441 7 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441 40 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.\u00a0\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 40B \u043e\u0431\u0443\u0447\u0430\u043b\u0441\u044f \u043d\u0430 384 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445 AWS \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 2 \u043c\u0435\u0441\u044f\u0446\u0435\u0432.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f4c\/690\/044\/f4c690044ec91252a93207ec4531007a.png\" alt=\"Open LLM Leaderboard.  \" title=\"Open LLM Leaderboard.  \" width=\"700\" height=\"189\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f4c\/690\/044\/f4c690044ec91252a93207ec4531007a.png\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/huggingface.co\/spaces\/HuggingFaceH4\/open_llm_leaderboard\" rel=\"noopener noreferrer nofollow\"><u>Open LLM Leaderboard.<\/u><\/a>  <\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437\u00a0<a href=\"https:\/\/huggingface.co\/tiiuae\/falcon-40b\" rel=\"noopener noreferrer nofollow\">\u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e<\/a>\u00a0\u043e\u0431 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 Falcon \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 GPT-3 \u0438 LLaMA, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f multi-query attention (<a href=\"https:\/\/arxiv.org\/abs\/1911.02150\" rel=\"noopener noreferrer nofollow\">Shazeer 2019<\/a>) \u0438 \u00a0<a href=\"https:\/\/huggingface.co\/datasets\/tiiuae\/falcon-refinedweb\" rel=\"noopener noreferrer nofollow\">RefinedWeb<\/a> corpus\u00a0\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (<a href=\"https:\/\/arxiv.org\/abs\/2306.01116\" rel=\"noopener noreferrer nofollow\">\u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043b\u044e\u0447\u043e\u043c \u043a \u0443\u0441\u043f\u0435\u0445\u0443<\/a>).  <\/p>\n<h2>\u0422\u043e\u0447\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 LLM \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e LoRa  <\/h2>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f LLM (Large Language Model), \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0446\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u044c\u044f OpenAI\u00a0<a href=\"https:\/\/cdn.openai.com\/palms.pdf\" rel=\"noopener noreferrer nofollow\">PALMS: Pre-training an Autoencoder Latent Model for Sequence Generation<\/a>. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 fine-tuning, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u0445 \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0447\u0442\u043e \u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438, \u043d\u043e \u0441 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f ~\u00a0<em>0,1<\/em>.\u00a0\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0435\u0435 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0432 \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438.<\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e fine-tune \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u043e\u0432.\u00a0\u041e\u043d\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0441\u043b\u043e\u044f\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u043e\u0431\u0443\u0447\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0438.\u00a0\u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u0435\u0441\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0432\u0435\u043b\u0438\u043a\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/737\/02c\/2d6\/73702c2d68ca4a581fd31503eaef3d50.png\" alt=\"Architecture of adapter-based knowledge injection into LLMs.  \" title=\"Architecture of adapter-based knowledge injection into LLMs.  \" width=\"720\" height=\"360\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/737\/02c\/2d6\/73702c2d68ca4a581fd31503eaef3d50.png\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/arxiv.org\/abs\/2212.08120\" rel=\"noopener noreferrer nofollow\"><u>Architecture of adapter-based knowledge injection into LLMs.<\/u><\/a>  <\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f LoRa \u0447\u0435\u0440\u043f\u0430\u0435\u0442 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0438\u0437 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u0437\u0430 \u0442\u0435\u043c, \u043a\u0430\u043a \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u0435\u0441\u0430 \u043c\u0430\u0442\u0440\u0438\u0446 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u0432 \u0440\u0430\u0431\u043e\u0442\u0435\u00a0<a href=\"https:\/\/arxiv.org\/abs\/2012.13255\" rel=\"noopener noreferrer nofollow\">Aghajanyan et al. (2020)<\/a>.\u00a0\u042d\u0442\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u0447\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u00a0<strong><em>W<\/em><\/strong>\u00a0\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0443\u043c\u043c\u044b\u00a0W + A * B\u00a0\u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.\u00a0\u0418\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u00a0<strong><em>W<\/em><\/strong>\u00a0\u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u0430, \u0438 \u043e\u0431\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u044b\u00a0<strong><em>A<\/em><\/strong>\u00a0\u0438\u00a0<strong><em>B<\/em><\/strong>.\u00a0\u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a\u00a0\u0394W = W + A * B.\u00a0\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u044b\u00a0<strong><em>A<\/em><\/strong>\u00a0\u0438\u00a0<strong><em>B<\/em><\/strong>\u00a0\u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.\u00a0\u0412 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445, \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434 LoRa, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fe3\/d29\/dfd\/fe3d29dfd9d8f6181438bc2ffed5586b.png\" alt=\"Forward pass with\u00a0updated\u00a0model.  \" title=\"Forward pass with\u00a0updated\u00a0model.  \" width=\"720\" height=\"477\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fe3\/d29\/dfd\/fe3d29dfd9d8f6181438bc2ffed5586b.png\"\/><\/p>\n<div><figcaption>Forward pass with\u00a0<strong>updated<\/strong>\u00a0model.  <\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u00a0<strong><em>r<\/em><\/strong>\u00a0\u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u0432\u044b\u0448\u0435 &#8212; \u044d\u0442\u043e\u00a0<strong>\u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/strong>\u00a0, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u0440\u0430\u043d\u0433\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0434\u043b\u044f \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438.\u00a0\u041c\u0435\u043d\u044c\u0448\u0438\u0439 r \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435 \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u0440\u0430\u043d\u0433\u0430, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043c\u0435\u043d\u044c\u0448\u0435\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438.\u00a0\u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e r \u0432 LoRa \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441 \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043e\u0434\u0435\u043b\u0438, \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438 \u0440\u0438\u0441\u043a\u043e\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0439 \u0438\u043b\u0438 \u0447\u0440\u0435\u0437\u043c\u0435\u0440\u043d\u043e\u0439 \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/abs\/2303.15647\" rel=\"noopener noreferrer nofollow\">Scaling Down to Scale Up: A Guide to Parameter-Efficient Fine-Tuning<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/lightning.ai\/pages\/community\/article\/understanding-llama-adapters\/\" rel=\"noopener noreferrer nofollow\">Understanding Parameter-Efficient Finetuning of Large Language Models: From Prefix Tuning to LLaMA-Adapters<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/lightning.ai\/pages\/community\/tutorial\/lora-llm\/\" rel=\"noopener noreferrer nofollow\">Parameter-Efficient LLM Finetuning With Low-Rank Adaptation (LoRA)<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/dataman-ai.medium.com\/fine-tune-a-gpt-lora-e9b72ad4ad3\" rel=\"noopener noreferrer nofollow\">Fine-tuning a GPT \u2014 LoRA<\/a><\/p>\n<\/li>\n<\/ul>\n<h2>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442  <\/h2>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u00a0\u00a0<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\" rel=\"noopener noreferrer nofollow\">Lit-GPT library<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e open-source LLM \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0431\u0430\u0437\u0435\u00a0<a href=\"https:\/\/lightning.ai\/docs\/fabric\/stable\/\" rel=\"noopener noreferrer nofollow\">Lightning Fabric<\/a>.\u00a0\u041a\u0430\u0441\u0430\u0435\u043c\u043e \u0436\u0435\u043b\u0435\u0437\u0430 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043e\u0434\u0438\u043d \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 A100 \u0441 \u043e\u0431\u044a\u0435\u043c\u043e\u043c \u043f\u0430\u043c\u044f\u0442\u0438 40 \u0413\u0411.  <\/p>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438  <\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0445 \u0432\u00a0lit-gpt\u00a0\u0444\u043e\u0440\u043c\u0430\u0442.\u00a0\u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c:  <\/p>\n<pre><code class=\"python\"># download the model weights: python scripts\/download.py --repo_id tiiuae\/falcon-7b  # convert the weights into a standardized form: python scripts\/convert_hf_checkpoint.py --checkpoint_dir checkpoints\/tiiuae\/falcon-7b<\/code><\/pre>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 supported weights, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a RedPajama, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00ab<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\/tree\/main\/tutorials\" rel=\"noopener noreferrer nofollow\">howto section<\/a>\u00bb.  <\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u044c\u0442\u0435 \u0434\u0430\u0442\u0430\u0441\u0435\u0442  <\/h2>\n<p>Fine-tuning \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0448\u0430\u0433\u0430 &#8212; \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u0432 Lit-Parrot, \u0430 \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c fine-tuning \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442.<\/p>\n<p>\u042f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439\u00a0Alpaca script, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438.\u00a0\u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u0432:<\/p>\n<pre><code class=\"python\">def generate_prompt(example: dict[str, str]) -> str:     \"\"\"Generates a standardized message to prompt the model\"\"\"     return (         \"You (I) are chatting with a user R. Write a reply to his message.\\n\\n\"         f\"### Your previous communication:\\n{example['context']}\\n\\n\"         f\"### His new message:\\n{example['instruction']}\\n\\n\"         f\"### Your response:{example['response']}\"     )<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445:  <\/p>\n<pre><code class=\"python\">python scripts\/prepare_dataset_my.py \\   --checkpoint_dir checkpoints\/tiiuae\/falcon-7b\/<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u0432 \u043d\u0435 \u0437\u0430\u0439\u043c\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.\u00a0\u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 51 \u0442\u044b\u0441\u044f\u0447\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0443\u0448\u043b\u043e \u0432\u0441\u0435\u0433\u043e 2 \u043c\u0438\u043d\u0443\u0442\u044b:  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1c0\/200\/7a1\/1c02007a14510948f7155058fb210cc6.gif\" alt=\"loading\" title=\"loading\" width=\"1092\" height=\"156\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1c0\/200\/7a1\/1c02007a14510948f7155058fb210cc6.gif\"\/><\/p>\n<div><figcaption>loading<\/figcaption><\/div>\n<\/figure>\n<h2>\u0422\u043e\u0447\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 Falcon  <\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0441\u0432\u043e\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<p>\u042f \u0438\u0437\u043c\u0435\u043d\u0438\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u00a0fine-tuning script\u00a0\u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0432\u043e\u0442 \u043e\u0431\u0437\u043e\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b:<\/p>\n<p><strong>bfloat16\u00a0precision<\/strong>\u00a0(\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u00a0<em>bfloat16<\/em>\u00a0\u044f \u043f\u0438\u0441\u0430\u043b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435\u00a07 ways to speed up inference of your hosted LLMs) \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0431\u044b\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430\u00a0<strong>51 \u0442\u044b\u0441. \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/strong>\u00a0\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e\u00a0<strong>batch size of 128<\/strong>\u00a0\u0441 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u0435\u043c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u0438 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435\u00a0Finetuning LLMs on a Single GPU Using Gradient Accumulation).<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f LoRa \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u00a0<strong>rank of 16<\/strong>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0430\u0434\u0430\u043f\u0442\u0435\u0440.\u00a0\u0418 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435\u00a0alpha to 32 (alpha\u00a0\u044d\u0442\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u044d\u0442\u043e \u0443\u0440\u0430\u0432\u043d\u043e\u0432\u0435\u0448\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044e \u043a \u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435).<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c finetune\/lora.py\u00a0\u0441\u043a\u0440\u0438\u043f\u0442, \u0443\u043a\u0430\u0437\u0430\u0432 \u0441\u0432\u043e\u0439 \u043f\u0443\u0442\u044c \u043a \u0434\u0430\u043d\u043d\u044b\u043c.<\/p>\n<pre><code class=\"python\">python finetune\/lora_my.py \\   --checkpoint_dir checkpoints\/tiiuae\/falcon-7b\/ \\   --data_dir data\/falcon\/ \\   --out_dir out\/falcon \\   --precision bf16-true<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7fd\/5d6\/e8a\/7fd5d6e8ab17f1ffee330cb27e0ead51.gif\" alt=\"proccess\" title=\"proccess\" width=\"727\" height=\"364\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7fd\/5d6\/e8a\/7fd5d6e8ab17f1ffee330cb27e0ead51.gif\"\/><\/p>\n<div><figcaption>proccess<\/figcaption><\/div>\n<\/figure>\n<h2>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0nvidia-smi\u00a0\u043a\u043e\u043c\u0430\u043d\u0434\u0443 Linux \u0434\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f GPU \u043a\u0430\u0436\u0434\u044b\u0435 \u043f\u043e\u043b\u0441\u0435\u043a\u0443\u043d\u0434\u044b:  <\/p>\n<pre><code class=\"python\">watch -n 0.5 nvidia-smi<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dbc\/e33\/99a\/dbce3399a52f0abbdcf3ce5ecef53091.gif\" alt=\"GPU load.  \" title=\"GPU load.  \" width=\"715\" height=\"418\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dbc\/e33\/99a\/dbce3399a52f0abbdcf3ce5ecef53091.gif\"\/><\/p>\n<div><figcaption>GPU load.  <\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 out\/falcon \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e.  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 A100 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u00a0<strong>10 \u0447\u0430\u0441\u043e\u0432<\/strong>\u00a0\u0438\u00a0<strong>30 \u0413\u0411\u00a0<\/strong>\u043f\u0430\u043c\u044f\u0442\u0438.\u00a0\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0430\u043c \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u043b\u0435\u0433\u043a\u0438\u0439, \u0432\u0435\u0441\u0438\u0442\u00a0<strong>\u0432\u0441\u0435\u0433\u043e 40 \u041c\u0411<\/strong>.\u00a0\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e Falcon, \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 16 \u0413\u0411.  <\/p>\n<h2>\u0418\u043d\u0444\u0435\u0440\u0435\u043d\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>\u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, Lit-GPT \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c (int8, int4), \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c precision \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e GPU:<\/p>\n<pre><code class=\"python\">python generate\/lora.py \\   --checkpoint_dir checkpoints\/tiiuae\/falcon-7b \\   --lora_path out\/falcon\/lit_model_lora_finetuned.pth \\   --prompt \"What happened to you? Tell me\" \\   --max_new_tokens 300   --precision bf16-true<\/code><\/pre>\n<p>\u042f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 1 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 \u0431\u0435\u0437 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u00a0bfloat16\u00a0\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e.\u00a0\u0410 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439\u00a0<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\/blob\/main\/generate\/lora.py\" rel=\"noopener noreferrer nofollow\">\u0441\u043a\u0440\u0438\u043f\u0442 lora<\/a>\u00a0\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u0435\u0433\u043e \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p>\u0412\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c\u00a0<a href=\"https:\/\/streamlit.io\/\" rel=\"noopener noreferrer nofollow\">streamlit<\/a>\u0438\u00a0<a href=\"https:\/\/github.com\/AI-Yash\/st-chat\" rel=\"noopener noreferrer nofollow\">streamlit-chat<\/a>\u00a0\u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438.\u00a0\u041c\u043e\u044f \u0432\u0435\u0440\u0441\u0438\u044f\u00a0<a href=\"https:\/\/gist.github.com\/slgero\/657a26e5d783ee2be114735478707761\" rel=\"noopener noreferrer nofollow\"><strong>\u0437\u0434\u0435\u0441\u044c<\/strong><\/a>.<\/p>\n<\/li>\n<li>\n<p>RestAPI \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u00a0<a href=\"https:\/\/fastapi.tiangolo.com\/\" rel=\"noopener noreferrer nofollow\">FastAPI<\/a>\u00a0\u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043c\u043e\u0434\u0435\u043b\u0438.\u00a0\u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0441\u043d\u043e\u0432\u0430.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0435\u043c\u043e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/53a\/380\/b11\/53a380b1109169c48e9b104734661c59.gif\" alt=\"Demo of the fine-tuned model.  \" title=\"Demo of the fine-tuned model.  \" width=\"725\" height=\"798\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/53a\/380\/b11\/53a380b1109169c48e9b104734661c59.gif\"\/><\/p>\n<div><figcaption>Demo of the fine-tuned model.  <\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p><em>\u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b.\u00a0\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0445\u0443\u0436\u0435.<\/em>  <\/p>\n<\/blockquote>\n<p>\u0412\u0440\u0435\u043c\u044f \u043e\u0442\u043a\u043b\u0438\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438, \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u0430\u043d\u0438\u044f, \u0431\u044b\u043b\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u043c &#8212; 45,51 \u0442\u043e\u043a\u0435\u043d\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.\u00a0\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u043b\u0438 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043c\u043e\u0435\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u201c<a href=\"https:\/\/medium.com\/better-programming\/speed-up-llm-inference-83653aa24c47?source=user_profile---------3----------------------------\" rel=\"noopener noreferrer nofollow\">7 Ways To Speed Up Inference of Your Hosted LLMs<\/a>\u201d.  <\/p>\n<h2>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430  <\/h2>\n<p>\u0425\u043e\u0442\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043c\u043e\u0433\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c\u0438 \u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f fine-tuned \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c, \u0442\u0430\u043a\u0438\u043c \u043a\u0430\u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u0430.<\/p>\n<p>\u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u0423\u043b\u0443\u0447\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u044b \u0441 \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0438\u0430\u043b\u043e\u0433\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u044b\u0441\u044c\u0442\u0435 LoRA rank \u0441 16 \u0434\u043e 32.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0442\u0430\u043a\u0443\u044e \u043a\u0430\u043a Falcon-40B.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u0435 \u0438\u043b\u0438 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u0435 \u0434\u043b\u0438\u043d\u0443 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0423\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u0442\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f  <\/h2>\n<p>\u0425\u043e\u0442\u044f\u00a0<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\" rel=\"noopener noreferrer nofollow\">Lit-GPT<\/a>\u00a0\u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u044f \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0433\u0438\u043f\u043e\u0442\u0435\u0437.\u00a0\u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043e\u043d \u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.\u00a0\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 Lit-GPT\u00a0<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\/issues\/183\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f<\/a>\u00a0\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 HuggingFace.\u00a0\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044d\u0442\u043e \u0432\u0441\u0435 \u0435\u0449\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438 \u0430\u0432\u0442\u043e\u0440\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442\u00a0<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\/issues\/183#issuecomment-1618843317\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0440\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u0439<\/a>:<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e\u00a0<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\/blob\/main\/scripts\/convert_hf_checkpoint.py#L19-L169\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438<\/a>\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 HuggingFace.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 HF Transformer model version of\u00a0<code>lit_gpt.model<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434\u00a0<strong>\u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442<\/strong>\u00a0\u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 LoRa \u0438 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430.<\/p>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f.\u00a0\u0415\u0441\u043b\u0438 \u0432\u044b \u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0435 LLM \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430, \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0447\u0438\u0441\u0442\u043e\u0433\u043e PyTorch.\u00a0\u0412\u00a0<a href=\"https:\/\/aws.amazon.com\/ru\/blogs\/machine-learning\/interactively-fine-tune-falcon-40b-and-other-llms-on-amazon-sagemaker-studio-notebooks-using-qlora\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 Amazon<\/a>\u00a0\u0435\u0441\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435  <\/h2>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 LLM \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0447\u0430\u0441\u043e\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u0435\u0442.\u00a0\u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 LoRa \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447. \u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u044b \u043a \u043e\u0434\u043d\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0437\u0430\u0434\u0435\u043f\u043b\u043e\u0435\u043d\u043d\u043e\u0439 LLM. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u043e\u0432 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u044d\u0442\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c.  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u0441 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u043c\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f\u043c\u0438.\u00a0\u0412\u043f\u043e\u043b\u043d\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438.\u00a0\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0430\u0436\u043d\u044b\u043c\u0438 \u0448\u0430\u0433\u0430\u043c\u0438 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043b\u0443\u0447\u0448\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432.\u00a0\u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u0443\u0447\u0430\u043b\u0430\u0441\u044c LLM, \u0438\u00a0<a href=\"https:\/\/huggingface.co\/spaces\/lmsys\/mt-bench\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438<\/a>\u00a0\u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447, \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043d\u0430 \u0432\u0430\u0448\u0438.<\/p>\n<p>\u042f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e, \u0441\u043b\u0435\u0434\u0443\u044f \u044d\u0442\u0438\u043c \u0448\u0430\u0433\u0430\u043c, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432!<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c, \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a\u043e \u043c\u043d\u0435:<\/p>\n<p><a href=\"https:\/\/www.linkedin.com\/in\/sergey-savvov\/\" rel=\"noopener noreferrer nofollow\">LinkedIn<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/757086\/\"> https:\/\/habr.com\/ru\/articles\/757086\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p> \u041e\u0431\u0440\u0435\u0442\u0438\u0442\u0435 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0430  <\/p>\n<figure class=\"full-width\">\n<div><figcaption>Image generated by Stable Diffusion.  <\/figcaption><\/div>\n<\/figure>\n<p><a href=\"https:\/\/betterprogramming.pub\/unleash-your-digital-twin-how-fine-tuning-llm-can-create-your-perfect-doppelganger-b5913e7dda2e\" rel=\"noopener noreferrer nofollow\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u0421\u0435\u0440\u0433\u0435\u044f \u0421\u0430\u0432\u0432\u043e\u0432\u0430.<\/a><\/p>\n<p><strong>\u0426\u0435\u043b\u044c \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/strong> &#8212; \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0438 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c LLM \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442.\u00a0\u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 Falcon-7B \u0441 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430\u043c\u0438 LoRa, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438\u00a0<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\" rel=\"noopener noreferrer nofollow\">Lit-GPT<\/a>.  <\/p>\n<p>\u0412\u044b \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0438\u0441\u044c, \u043a\u0430\u043a\u043e\u0432\u043e \u044d\u0442\u043e &#8212; \u0438\u043c\u0435\u0442\u044c \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0430?\u00a0\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e \u0441\u0435\u0431\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0441\u0442\u0438 \u0431\u0435\u0441\u0435\u0434\u044b, \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0438 \u0434\u0430\u0436\u0435 \u0432\u044b\u0440\u0430\u0436\u0430\u0442\u044c \u043c\u044b\u0441\u043b\u0438?\u00a0\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0430 (\u0418\u0418) \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u0443 \u043d\u0435\u043a\u043e\u0433\u0434\u0430 \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0438\u0434\u0435\u044e \u0434\u043e\u0441\u0442\u0438\u0436\u0438\u043c\u043e\u0439.  <\/p>\n<p>\u0423\u0441\u0438\u043b\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0430 \u043f\u0440\u0438\u0432\u0435\u043b\u0438 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u044b\u0441\u043e\u043a\u043e\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 open-source LLMs, \u0432\u043a\u043b\u044e\u0447\u0430\u044f LLaMA, Falcon, StableLM \u0438 Pythia. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u044d\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438, \u0447\u0442\u043e\u0431\u044b \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043a \u0432\u0430\u0448\u0435\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u0447\u0430\u0442-\u0431\u043e\u0442\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b. \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0449\u0438\u0442\u0443 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Cloud APIs.  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u044f \u0445\u043e\u0442\u0435\u043b, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0432 \u043c\u043e\u0435\u043c \u0441\u0442\u0438\u043b\u0435, \u043f\u043e\u0434\u0440\u0430\u0436\u0430\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0448\u0443\u0442\u043a\u0438, \u0444\u0440\u0430\u0437\u043e\u0447\u043a\u0438 \u0438 \u0441\u043b\u043e\u0432\u0430.<\/p>\n<h2>\u0421\u0431\u043e\u0440 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445  <\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0443\u0433\u043b\u0443\u0431\u0438\u0442\u044c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438, \u0445\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 GPT-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439.\u00a0\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0448\u0430\u0433 \u0432\u043f\u0435\u0440\u0435\u0434 \u0438 \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0443\u0441\u0441\u043a\u043e\u043c\u0443 \u044f\u0437\u044b\u043a\u0443.<\/p>\n<ul>\n<li>\n<p>\u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0445 \u0442\u0435\u043a\u0441\u0442\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0440\u0443\u0441\u0441\u043a\u0438\u0439 &#8212; \u043c\u043e\u0439 \u0440\u043e\u0434\u043d\u043e\u0439 \u044f\u0437\u044b\u043a, \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0431\u0430\u0437\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0430\u044f \u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0421\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445  <\/h2>\n<p>\u042f \u0432\u044b\u0431\u0440\u0430\u043b Telegram, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 API \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d \u0441\u043b\u0443\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439 \u0434\u043b\u044f \u043c\u043e\u0435\u0433\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0434\u0440\u0443\u0437\u044c\u044f\u043c\u0438.\u00a0\u042d\u0442\u043e\u0442 \u0432\u044b\u0431\u043e\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0433\u043b\u0443\u0431\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u043b\u0443\u0447\u0448\u0435 \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u043d\u044f.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044f\u00a0<a href=\"https:\/\/docs.telethon.dev\/en\/stable\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0432\u0441\u044e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0443 \u0438\u0437 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445 \u0447\u0430\u0442\u043e\u0432 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0445 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<ol>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u043b\u0438\u0435\u043d\u0442 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">from telethon.sync import TelegramClient  client = TelegramClient(PHONE_NUMBER, TELEGRAM_APP_ID, TELEGRAM_APP_HASH) client.start()<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">def get_dialogs(limit: int | None = 100) -> list[Dialog]:     \"\"\"Get all dialogs from the Telegram.\"\"\"     dialogs: list[Dialog] = client.get_dialogs(limit=limit)     dialogs = [dialog for dialog in dialogs if dialog.is_user]  # remove groups or channels     logger.info(f\"Found {len(dialogs)} dialogs\")     return dialogs<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0418 \u043f\u043e\u0434 \u043a\u043e\u043d\u0435\u0446 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043e\u043a:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">def parse_messages(dialog: Dialog, limit: int = 1000) -> list[dict]:     \"\"\"Get all messages from the dialog.\"\"\"     all_messages_list = []     offset_id = 0      while True:         messages: list[Message] = client(             GetHistoryRequest(                 peer=dialog,                 offset_id=offset_id,                 offset_date=None,                 add_offset=0,                 limit=limit,                 max_id=0,                 min_id=0,                 hash=0,             )         ).messages         if not messages:             break          all_messages_list.extend(             {                 \"date\": message.date.isoformat(),                 \"message\": message.message,                 \"out\": message.out,             }             for message in messages             # Filter audio or video content             if message.message and not message.is_bot         )         offset_id = offset_id = messages[-1].id     return all_messages_list<\/code><\/pre>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/gist.github.com\/slgero\/b3b020b60ca92154641f39e5813c98e7\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.  <\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u044f \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u043b \u0430\u0443\u0434\u0438\u043e- \u0438 \u0432\u0438\u0434\u0435\u043e\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043b\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0435.\u00a0\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u0435 \u043c\u043e\u0433\u043b\u0430 \u0431\u044b\u0442\u044c \u0443\u0442\u0435\u0440\u044f\u043d\u0430.\u00a0\u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u043e\u0431\u044a\u0435\u043c\u043d\u0430\u044f \u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.   <\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445  <\/h2>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438. <\/p>\n<p><strong>Fine-tune<\/strong> \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u0435\u0431\u044f \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430\u043d\u0430\u043b\u0438\u0437 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u0430).\u00a0ChatGPT (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0441\u044f \u043a\u0430\u043a fine-tuned \u0432\u0435\u0440\u0441\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 GPT-3) \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c.\u00a0\u041d\u0430\u0431\u043e\u0440\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0442\u0440\u0438 \u043a\u043b\u044e\u0447\u0430:\u00a0<strong>instruction<\/strong>,\u00a0<strong>input <\/strong>(\u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438) \u0438 <strong>response\u00a0<\/strong>\u043e\u0442 LLM.\u00a0\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438:   <\/p>\n<pre><code class=\"python\">[     {         \"instruction\": \"Can cats communicate?\",         \"context\": \"Cats need to communicate with each other for bonding, and relating with each other; they need to collaborate, play, and share resources...\",         \"response\": \"Cat vocalizations have been categorized according to a range of characteristics...\",     } ]<\/code><\/pre>\n<p>\u0421\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u043e\u0447\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<figure class=\"full-width\">\n<div><figcaption><em>Fine-tuning a pretrained LLM to follow instructions.<\/em>  <\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438.\u00a0\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0432\u0435\u0441\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u0432\u0435\u0442\u0430.\u00a0\u041e\u0434\u043d\u0430\u043a\u043e, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043c\u043e\u0435\u0433\u043e \u043e\u043f\u044b\u0442\u0430, \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 (\u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a 7B) \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u0440\u044f\u0434 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439.\u00a0\u0422\u0430\u043a \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043b\u0443\u0447\u0448\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043e\u0435\u0433\u043e \u0447\u0430\u0442\u0430, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0420\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0431\u0435\u0441\u0435\u0434\u044b \u043d\u0430 \u0431\u0430\u0442\u0447\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0440\u044b\u0432 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0434\u0435\u043d\u044c.\u00a0\u0422\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u044d\u0442\u043e \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u043b\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u0430, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0438\u0434\u0443\u0449\u0438\u0445 \u043f\u043e\u0434\u0440\u044f\u0434 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0432 \u043e\u0434\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u043a \u043a \u0441\u0432\u043e\u0438\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0438 \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043d\u0438\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\">\n<div><figcaption>Preprocessing chat messages.  <\/figcaption><\/div>\n<\/figure>\n<p>\u042f \u0442\u0430\u043a\u0436\u0435 \u043e\u0447\u0438\u0441\u0442\u0438\u043b \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0447\u0430\u0442\u043e\u0432 \u043e\u0442 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0442\u0430\u043a\u043e\u0439 \u043a\u0430\u043a \u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0430\u0440\u043e\u043b\u0438 \u0438\u043b\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0438\u0441\u044c\u043c\u0430.<\/p>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c 51\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0447\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u043e \u0441\u00a0<a href=\"https:\/\/www.databricks.com\/blog\/2023\/04\/12\/dolly-first-open-commercially-viable-instruction-tuned-llm\" rel=\"noopener noreferrer nofollow\">Dolly 2.0 instruction dataset<\/a>\u00a0\u043e\u0442 Databricks (~15\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439) \u0438\u00a0<a href=\"https:\/\/github.com\/tatsu-lab\/stanford_alpaca\" rel=\"noopener noreferrer nofollow\">Alpaca dataset<\/a>\u00a0(~52\u041a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439).<\/p>\n<h2>\u041c\u043e\u0434\u0435\u043b\u044c  <\/h2>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u0432\u044b\u0431\u0440\u0430\u0442\u044c open-source large LLM\u00a0<a href=\"https:\/\/falconllm.tii.ae\/\" rel=\"noopener noreferrer nofollow\">Falcon<\/a> \u043e\u0442\u00a0<a href=\"https:\/\/tii.ae\/\" rel=\"noopener noreferrer nofollow\">Technology Innovation Institute<\/a>.\u00a0\u042d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0430\u0432\u0442\u043e\u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u043a\u043e\u0434\u0435\u0440\u0430 \u0441 \u0434\u0432\u0443\u043c\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438: \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441 7 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441 40 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.\u00a0\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 40B \u043e\u0431\u0443\u0447\u0430\u043b\u0441\u044f \u043d\u0430 384 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445 AWS \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 2 \u043c\u0435\u0441\u044f\u0446\u0435\u0432.<\/p>\n<figure class=\"full-width\">\n<div><figcaption><a href=\"https:\/\/huggingface.co\/spaces\/HuggingFaceH4\/open_llm_leaderboard\" rel=\"noopener noreferrer nofollow\"><u>Open LLM Leaderboard.<\/u><\/a>  <\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437\u00a0<a href=\"https:\/\/huggingface.co\/tiiuae\/falcon-40b\" rel=\"noopener noreferrer nofollow\">\u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e<\/a>\u00a0\u043e\u0431 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 Falcon \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 GPT-3 \u0438 LLaMA, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f multi-query attention (<a href=\"https:\/\/arxiv.org\/abs\/1911.02150\" rel=\"noopener noreferrer nofollow\">Shazeer 2019<\/a>) \u0438 \u00a0<a href=\"https:\/\/huggingface.co\/datasets\/tiiuae\/falcon-refinedweb\" rel=\"noopener noreferrer nofollow\">RefinedWeb<\/a> corpus\u00a0\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (<a href=\"https:\/\/arxiv.org\/abs\/2306.01116\" rel=\"noopener noreferrer nofollow\">\u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043b\u044e\u0447\u043e\u043c \u043a \u0443\u0441\u043f\u0435\u0445\u0443<\/a>).  <\/p>\n<h2>\u0422\u043e\u0447\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 LLM \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e LoRa  <\/h2>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f LLM (Large Language Model), \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0446\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u044c\u044f OpenAI\u00a0<a href=\"https:\/\/cdn.openai.com\/palms.pdf\" rel=\"noopener noreferrer nofollow\">PALMS: Pre-training an Autoencoder Latent Model for Sequence Generation<\/a>. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 fine-tuning, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u0445 \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0447\u0442\u043e \u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438, \u043d\u043e \u0441 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f ~\u00a0<em>0,1<\/em>.\u00a0\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0435\u0435 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0432 \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438.<\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e fine-tune \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u043e\u0432.\u00a0\u041e\u043d\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0441\u043b\u043e\u044f\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u043e\u0431\u0443\u0447\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0438.\u00a0\u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u0435\u0441\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0432\u0435\u043b\u0438\u043a\u0438.<\/p>\n<figure class=\"full-width\">\n<div><figcaption><a href=\"https:\/\/arxiv.org\/abs\/2212.08120\" rel=\"noopener noreferrer nofollow\"><u>Architecture of adapter-based knowledge injection into LLMs.<\/u><\/a>  <\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f LoRa \u0447\u0435\u0440\u043f\u0430\u0435\u0442 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0438\u0437 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u0437\u0430 \u0442\u0435\u043c, \u043a\u0430\u043a \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u0435\u0441\u0430 \u043c\u0430\u0442\u0440\u0438\u0446 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u0432 \u0440\u0430\u0431\u043e\u0442\u0435\u00a0<a href=\"https:\/\/arxiv.org\/abs\/2012.13255\" rel=\"noopener noreferrer nofollow\">Aghajanyan et al. (2020)<\/a>.\u00a0\u042d\u0442\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u0447\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u00a0<strong><em>W<\/em><\/strong>\u00a0\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0443\u043c\u043c\u044b\u00a0W + A * B\u00a0\u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.\u00a0\u0418\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u00a0<strong><em>W<\/em><\/strong>\u00a0\u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u0430, \u0438 \u043e\u0431\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u044b\u00a0<strong><em>A<\/em><\/strong>\u00a0\u0438\u00a0<strong><em>B<\/em><\/strong>.\u00a0\u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a\u00a0\u0394W = W + A * B.\u00a0\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u044b\u00a0<strong><em>A<\/em><\/strong>\u00a0\u0438\u00a0<strong><em>B<\/em><\/strong>\u00a0\u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.\u00a0\u0412 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445, \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434 LoRa, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>Forward pass with\u00a0<strong>updated<\/strong>\u00a0model.  <\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u00a0<strong><em>r<\/em><\/strong>\u00a0\u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u0432\u044b\u0448\u0435 &#8212; \u044d\u0442\u043e\u00a0<strong>\u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/strong>\u00a0, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u0440\u0430\u043d\u0433\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0434\u043b\u044f \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438.\u00a0\u041c\u0435\u043d\u044c\u0448\u0438\u0439 r \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435 \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u0440\u0430\u043d\u0433\u0430, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043c\u0435\u043d\u044c\u0448\u0435\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438.\u00a0\u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e r \u0432 LoRa \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441 \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043e\u0434\u0435\u043b\u0438, \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438 \u0440\u0438\u0441\u043a\u043e\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0439 \u0438\u043b\u0438 \u0447\u0440\u0435\u0437\u043c\u0435\u0440\u043d\u043e\u0439 \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/abs\/2303.15647\" rel=\"noopener noreferrer nofollow\">Scaling Down to Scale Up: A Guide to Parameter-Efficient Fine-Tuning<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/lightning.ai\/pages\/community\/article\/understanding-llama-adapters\/\" rel=\"noopener noreferrer nofollow\">Understanding Parameter-Efficient Finetuning of Large Language Models: From Prefix Tuning to LLaMA-Adapters<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/lightning.ai\/pages\/community\/tutorial\/lora-llm\/\" rel=\"noopener noreferrer nofollow\">Parameter-Efficient LLM Finetuning With Low-Rank Adaptation (LoRA)<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/dataman-ai.medium.com\/fine-tune-a-gpt-lora-e9b72ad4ad3\" rel=\"noopener noreferrer nofollow\">Fine-tuning a GPT \u2014 LoRA<\/a><\/p>\n<\/li>\n<\/ul>\n<h2>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442  <\/h2>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u00a0\u00a0<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\" rel=\"noopener noreferrer nofollow\">Lit-GPT library<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e open-source LLM \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0431\u0430\u0437\u0435\u00a0<a href=\"https:\/\/lightning.ai\/docs\/fabric\/stable\/\" rel=\"noopener noreferrer nofollow\">Lightning Fabric<\/a>.\u00a0\u041a\u0430\u0441\u0430\u0435\u043c\u043e \u0436\u0435\u043b\u0435\u0437\u0430 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043e\u0434\u0438\u043d \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 A100 \u0441 \u043e\u0431\u044a\u0435\u043c\u043e\u043c \u043f\u0430\u043c\u044f\u0442\u0438 40 \u0413\u0411.  <\/p>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438  <\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0445 \u0432\u00a0lit-gpt\u00a0\u0444\u043e\u0440\u043c\u0430\u0442.\u00a0\u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c:  <\/p>\n<pre><code class=\"python\"># download the model weights: python scripts\/download.py --repo_id tiiuae\/falcon-7b  # convert the weights into a standardized form: python scripts\/convert_hf_checkpoint.py --checkpoint_dir checkpoints\/tiiuae\/falcon-7b<\/code><\/pre>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 supported weights, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a RedPajama, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00ab<a href=\"https:\/\/github.com\/Lightning-AI\/lit-gpt\/tree\/main\/tutorials\" rel=\"noopener noreferrer nofollow\">howto section<\/a>\u00bb.  <\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u044c\u0442\u0435 \u0434\u0430\u0442\u0430\u0441\u0435\u0442  <\/h2>\n<p>Fine-tuning \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-353235","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353235","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=353235"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353235\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=353235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=353235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=353235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}