{"id":99277,"date":"2024-11-17T12:54:39","date_gmt":"2024-11-17T04:54:39","guid":{"rendered":"\/\/www.viralrail.com\/?p=99277"},"modified":"2024-11-17T12:54:57","modified_gmt":"2024-11-17T04:54:57","slug":"lmxssmys","status":"publish","type":"post","link":"\/\/www.viralrail.com\/blog\/99277.html","title":{"rendered":"LoRA\u6a21\u578b\u662f\u4ec0\u4e48\u610f\u601d"},"content":{"rendered":"\n

\u3000\u3000LoRA\u6a21\u578b<\/strong>\uff0c\u5168\u79f0\u4e3aLow-Rank Adaptation of Large Language Models\uff0c\u4e2d\u6587\u8bd1\u4e3a\u201c\u5927\u8bed\u8a00\u6a21\u578b\u7684\u4f4e\u79e9\u9002\u5e94\u201d\u3002\u8fd9\u662f\u4e00\u79cd\u7531\u5fae\u8f6f\u7814\u7a76\u4eba\u5458\u5f00\u53d1\u7684\u6280\u672f\uff0c\u65e8\u5728\u89e3\u51b3\u5927\u578b\u8bed\u8a00\u6a21\u578b(\u5982GPT\u7cfb\u5217)\u5fae\u8c03\u65f6\u7684\u6210\u672c\u548c\u6548\u7387\u95ee\u9898\u3002<\/p>\n\n\n\n

\u3000\u3000LoRA<\/a>\u7684\u6838\u5fc3\u601d\u60f3\u662f\u5728\u9884\u8bad\u7ec3\u6a21\u578b\u7684\u5173\u952e\u5c42\u4e2d\u6ce8\u5165\u53ef\u8bad\u7ec3\u7684\u4f4e\u79e9\u77e9\u9635\uff0c\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5728\u4e0d\u6539\u53d8\u539f\u6709\u6a21\u578b\u7ed3\u6784\u7684\u60c5\u51b5\u4e0b\uff0c\u5bf9\u6a21\u578b\u8fdb\u884c\u9ad8\u6548\u7684\u5fae\u8c03\u3002\u8fd9\u79cd\u65b9\u6cd5\u663e\u8457\u51cf\u5c11\u4e86\u9700\u8981\u8c03\u6574\u7684\u53c2\u6570\u6570\u91cf\uff0c\u4ece\u800c\u964d\u4f4e\u4e86\u8ba1\u7b97\u8d44\u6e90\u548c\u5185\u5b58\u6d88\u8017\u3002<\/p>\n\n\n\n

\u3000\u3000\u5177\u4f53\u6765\u8bf4\uff0cLoRA\u6a21\u578b\u7684\u5de5\u4f5c\u539f\u7406\u662f\u51bb\u7ed3\u9884\u8bad\u7ec3\u6a21\u578b\u7684\u4e3b\u6743\u91cd\uff0c\u7136\u540e\u5728\u5176\u7279\u5b9a\u5c42\u4e2d\u6ce8\u5165LoRA\u6a21\u5757\u3002\u8fd9\u4e9b\u6a21\u5757\u4e0eCrossAttention\u6a21\u5757\u76f8\u7ed3\u5408\uff0c\u4ec5\u5bf9\u8fd9\u4e9b\u65b0\u589e\u7684\u53c2\u6570\u8fdb\u884c\u5fae\u8c03\u8bad\u7ec3\u3002\u5728\u8bad\u7ec3\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u91cd\u53c2\u7684\u65b9\u5f0f\u5c06\u65b0\u53c2\u6570\u4e0e\u539f\u6a21\u578b\u53c2\u6570\u5408\u5e76\uff0c\u4ece\u800c\u5f97\u5230\u4e00\u4e2a\u53c2\u6570\u91cf\u8fdc\u5c0f\u4e8e\u539f\u6a21\u578b\u7684LoRA\u6a21\u578b\u3002<\/p>\n\n\n\n

\u3000\u3000LoRA\u6280\u672f<\/a>\u4e0d\u4ec5\u5e94\u7528\u4e8e\u8bed\u8a00\u6a21\u578b\u7684\u5fae\u8c03\uff0c\u8fd8\u5e7f\u6cdb\u7528\u4e8e\u751f\u6210\u6a21\u578b(\u5982Stable Diffusion)\u7684\u5fae\u8c03\u4e2d\u3002\u5b83\u5141\u8bb8\u7528\u6237\u4f7f\u7528\u5c11\u91cf\u6570\u636e\u5bf9\u6a21\u578b\u8fdb\u884c\u5feb\u901f\u5fae\u8c03\uff0c\u4ee5\u9002\u5e94\u7279\u5b9a\u7684\u4efb\u52a1\u6216\u98ce\u683c\u3002\u4f8b\u5982\uff0c\u5728\u56fe\u50cf\u751f\u6210\u9886\u57df\uff0cLoRA\u53ef\u4ee5\u7528\u6765\u8c03\u6574\u751f\u6210\u56fe\u50cf\u7684\u98ce\u683c\u6216\u7279\u5b9a\u7279\u5f81\uff0c\u800c\u4e0d\u9700\u8981\u91cd\u65b0\u8bad\u7ec3\u6574\u4e2a\u5927\u6a21\u578b\u3002<\/p>\n\n\n\n

\u3000\u3000\u603b\u4e4b\uff0cLoRA\u901a\u8fc7\u4f4e\u79e9\u77e9\u9635\u7684\u5f15\u5165\u548c\u53c2\u6570\u4f18\u5316\uff0c\u5b9e\u73b0\u4e86\u5728\u4fdd\u6301\u539f\u6709\u6a21\u578b\u6027\u80fd\u7684\u540c\u65f6\uff0c\u5927\u5e45\u964d\u4f4e\u5fae\u8c03\u6210\u672c\u548c\u8ba1\u7b97\u590d\u6742\u5ea6\u7684\u76ee\u6807\u3002<\/p>\n\n\n\n

\u3000\u3000\u4e00\u3001 LoRA\u6a21\u578b\u7684\u5177\u4f53\u5b9e\u73b0\u65b9\u5f0f\u548c\u6b65\u9aa4\u662f\u4ec0\u4e48?<\/h2>\n\n\n\n

\u3000\u3000LoRA(Low-Rank Adaptation)\u6a21\u578b\u7684\u5177\u4f53\u5b9e\u73b0\u65b9\u5f0f\u548c\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n\n\n\n

    \n
  • \u3000\u3000\u51bb\u7ed3\u9884\u8bad\u7ec3\u6a21\u578b\u53c2\u6570<\/strong>\uff1a\u9996\u5148\uff0cLoRA\u65b9\u6cd5\u901a\u8fc7\u51bb\u7ed3\u9884\u5148\u8bad\u7ec3\u597d\u7684\u6a21\u578b\u53c2\u6570\uff0c\u8fd9\u4e9b\u53c2\u6570\u5728\u5fae\u8c03\u8fc7\u7a0b\u4e2d\u4fdd\u6301\u4e0d\u53d8\u3002<\/li>\n\n\n\n
  • \u3000\u3000\u5f15\u5165\u4f4e\u79e9\u5206\u89e3\u77e9\u9635<\/strong>\uff1a\u5728Transformer\u67b6\u6784\u7684\u6bcf\u4e00\u5c42\u4e2d\uff0cLoRA\u6ce8\u5165\u4e24\u4e2a\u53ef\u8bad\u7ec3\u7684\u4f4e\u79e9\u5206\u89e3\u77e9\u9635A\u548cB\u3002\u77e9\u9635A\u4f7f\u7528\u968f\u673a\u9ad8\u65af\u5206\u5e03\u8fdb\u884c\u521d\u59cb\u5316\uff0c\u7ef4\u5ea6\u4e3ar\u00d7k\uff0c\u8d1f\u8d23\u5c06\u8f93\u5165\u6570\u636e\u7ef4\u5ea6\u964d\u81f3r\u7ef4;\u77e9\u9635B\u4f7f\u75280\u8fdb\u884c\u521d\u59cb\u5316\uff0c\u7ef4\u5ea6\u4e3ad\u00d7r\uff0c\u8d1f\u8d23\u5c06\u6570\u636e\u7ef4\u5ea6\u5347\u81f3d\u7ef4\u3002<\/li>\n\n\n\n
  • \u3000\u3000\u4f4e\u79e9\u77e9\u9635\u7684\u521d\u59cb\u5316\u548c\u66f4\u65b0<\/strong>\uff1a\u5728\u5fae\u8c03\u8fc7\u7a0b\u4e2d\uff0c\u4ec5\u8bad\u7ec3\u4f4e\u79e9\u5206\u89e3\u77e9\u9635A\u548cB\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5f85\u66f4\u65b0\u7684\u53c2\u6570\u77e9\u9635\u0394W\u0394W\u8868\u793a\u4e3a\u4f4e\u79e9\u5206\u89e3BABA\u7684\u5f62\u5f0f\uff0c\u5176\u4e2dBB\u548cAA\u662f\u968f\u673a\u521d\u59cb\u5316\u5e76\u5728\u5fae\u8c03\u8fc7\u7a0b\u4e2d\u66f4\u65b0\u7684\u3002<\/li>\n\n\n\n
  • \u3000\u3000\u5408\u5e76\u8bad\u7ec3\u53c2\u6570<\/strong>\uff1a\u6700\u540e\uff0c\u5c06LoRA\u8bad\u7ec3\u5f97\u5230\u7684\u53c2\u6570\u4e0e\u539f\u59cb\u6a21\u578b\u53c2\u6570\u5408\u5e76\uff0c\u5e76\u4fdd\u5b58\u5230\u65b0\u7684\u6a21\u578b\u4e2d\u3002<\/li>\n\n\n\n
  • \u3000\u3000\u4ee3\u7801\u5b9e\u73b0<\/strong>\uff1a\u5728\u4ee3\u7801\u5c42\u9762\uff0c\u53ef\u4ee5\u901a\u8fc7\u6269\u5c55PyTorch\u4e2d\u7684nn.Linear\u6807\u51c6\u7ebf\u6027\u5c42\u6765\u5b9e\u73b0LoRA\u6a21\u5757\u3002\u5b9a\u4e49\u4e00\u4e2a\u540d\u4e3aLoRALinear\u7684\u7c7b\uff0c\u5728\u5176__init__\u51fd\u6570\u4e2d\u521d\u59cb\u5316\u4f4e\u79e9\u5206\u89e3\u77e9\u9635A\u548cB\u4ee5\u53ca\u964d\u4f4e\u7684\u79e9\u6570R\u3002\u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u5305\u62ec\u4e00\u4e2adropout\u5c42\u4ee5\u907f\u514d\u8fc7\u62df\u5408\u3002<\/li>\n\n\n\n
  • \u3000\u3000\u663e\u5b58\u9700\u6c42\u548c\u8d44\u6e90\u6d88\u8017<\/strong>\uff1a\u7531\u4e8eLoRA\u65b9\u6cd5\u663e\u8457\u51cf\u5c11\u4e86\u9700\u8981\u5fae\u8c03\u7684\u53c2\u6570\u6570\u91cf\uff0c\u56e0\u6b64\u663e\u5b58\u9700\u6c42\u4e5f\u5927\u5e45\u964d\u4f4e\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8eLLaMA\u6a21\u578b\uff0c\u4f7f\u7528LoRA\u8fdb\u884c\u53c2\u6570\u5fae\u8c03\u81f3\u5c11\u9700\u89812\u500d\u5927\u5c0f\u7684\u663e\u5b58\uff0c\u800c\u5bf9\u4e8e\u4e0d\u540c\u89c4\u6a21\u7684\u6a21\u578b(\u59827B\u300113B\u548c30B)\uff0c\u4e00\u5f20A800 (80G) \u5373\u53ef\u8fd0\u884c;\u800c\u5bf9\u4e8e65B\u6a21\u578b\uff0c\u5219\u9700\u8981\u4e24\u5f20\u3002<\/li>\n<\/ul>\n\n\n\n

    \u3000\u3000\u4e8c\u3001 LoRA\u6a21\u578b\u5728\u4e0d\u540c\u7c7b\u578b\u7684\u5927\u578b\u8bed\u8a00\u6a21\u578b(\u5982GPT\u7cfb\u5217)\u4e0a\u7684\u5e94\u7528\u6548\u679c\u5982\u4f55?<\/h2>\n\n\n\n

    \u3000\u3000LoRA(Low-Rank Adaptation)\u6a21\u578b\u5728\u4e0d\u540c\u7c7b\u578b\u7684\u5927\u578b\u8bed\u8a00\u6a21\u578b(\u5982GPT\u7cfb\u5217)\u4e0a\u7684\u5e94\u7528\u6548\u679c\u663e\u8457\uff0c\u4e14\u8868\u73b0\u51fa\u8272\u3002<\/p>\n\n\n\n

    \u3000\u3000LoRA\u662f\u4e00\u79cd\u9ad8\u6548\u7684\u5fae\u8c03\u65b9\u6cd5\uff0c\u901a\u8fc7\u52a8\u6001\u8c03\u6574\u6bcf\u4e2a\u53c2\u6570\u77e9\u9635\u9700\u8981\u8bad\u7ec3\u7684\u79e9\u6765\u63a7\u5236\u8bad\u7ec3\u7684\u53c2\u6570\u603b\u91cf\uff0c\u4ece\u800c\u663e\u8457\u964d\u4f4e\u6a21\u578b\u8bad\u7ec3\u6210\u672c\u3002\u8fd9\u79cd\u65b9\u6cd5\u5df2\u88ab\u5e7f\u6cdb\u5e94\u7528\u4e8e\u591a\u4e2a\u5f00\u6e90\u5927\u8bed\u8a00\u6a21\u578b\u7684\u53c2\u6570\u9ad8\u6548\u5fae\u8c03\u4e2d\uff0c\u4f8b\u5982LLaMA\u548cBLOOM\u3002\u5177\u4f53\u6765\u8bf4\uff0cLoRA\u5728\u8fd9\u4e9b\u6a21\u578b\u4e0a\u5b9e\u73b0\u4e86\u663e\u8457\u7684\u6027\u80fd\u63d0\u5347\uff0c\u5e76\u4e14\u5728\u591a\u4e2a\u81ea\u7136\u8bed\u8a00\u5904\u7406\u4efb\u52a1\u4e0a\u8868\u73b0\u4f18\u5f02\u3002<\/p>\n\n\n\n

    \u3000\u3000LoRA\u4e0d\u4ec5\u9002\u7528\u4e8e\u6587\u672c\u6a21\u578b\uff0c\u8fd8\u88ab\u5e94\u7528\u4e8e\u89c6\u89c9\u5927\u6a21\u578b\u5982Stable Diffusion\u3002\u6b64\u5916\uff0cLoRA\u7684\u53d8\u4f53\u65b9\u6cd5\u5982AdaLoRA\u3001QLoRA\u3001IncreLoRA\u548cLoRA-FA\u7b49\u8fdb\u4e00\u6b65\u6269\u5c55\u4e86\u5176\u5e94\u7528\u8303\u56f4\u3002<\/p>\n\n\n\n

    \u3000\u3000\u5728\u5177\u4f53\u7684\u5b9e\u9a8c\u4e2d\uff0c\u4f7f\u7528LoRA\u65b9\u6cd5\u8bad\u7ec3\u7684GPT-2\u548cGPT-3\u6a21\u578b\u5728\u6027\u80fd\u4e0a\u4f18\u4e8e\u6216\u76f8\u5f53\u4e8e\u4f7f\u7528\u5176\u4ed6\u5fae\u8c03\u65b9\u6cd5\u3002\u6b64\u5916\uff0c\u5728\u963f\u62c9\u4f2f\u8bed\u89c4\u8303\u5316\u4efb\u52a1\u4e2d\uff0c\u7ecf\u8fc7LoRA\u8c03\u4f18\u7684\u5f00\u6e90LLM\u4e5f\u8868\u73b0\u51fa\u8272\uff0c\u751a\u81f3\u8d85\u8d8a\u4e86GPT4\u6a21\u578b\u3002<\/p>\n\n\n\n

    \u3000\u3000\u4e09\u3001 LoRA\u6a21\u578b\u4e0e\u5176\u4ed6\u5fae\u8c03\u6280\u672f(\u5982Fine-tuning)\u76f8\u6bd4\u6709\u54ea\u4e9b\u4f18\u52bf\u548c\u4e0d\u8db3?<\/h2>\n\n\n\n

    \u3000\u3000LoRA(Low-Rank Adaptation)\u6a21\u578b\u4f5c\u4e3a\u4e00\u79cd\u65b0\u578b\u7684\u5fae\u8c03\u6280\u672f\uff0c\u76f8\u8f83\u4e8e\u4f20\u7edf\u7684\u5168\u53c2\u6570\u5fae\u8c03(Fine-tuning)\u5177\u6709\u663e\u8457\u7684\u4f18\u52bf\u548c\u4e00\u4e9b\u4e0d\u8db3\u3002<\/p>\n\n\n\n

    \u3000\u30001. \u4f18\u52bf\uff1a<\/p>\n\n\n\n

      \n
    • \u3000\u3000\u51cf\u5c11\u8ba1\u7b97\u548c\u5185\u5b58\u9700\u6c42<\/strong>\uff1aLoRA\u901a\u8fc7\u5c06\u539f\u4efb\u52a1\u8f6c\u4e3a\u5fae\u8c03\u4e00\u4e2a\u5177\u6709\u663e\u8457\u66f4\u5c11\u53c2\u6570\u7684\u4f4e\u79e9\u6a21\u578b\uff0c\u6709\u6548\u964d\u4f4e\u4e86\u5fae\u8c03\u5927\u6a21\u578b\u7684\u95e8\u69db\u548c\u6210\u672c\u6d88\u8017\u3002\u5177\u4f53\u6765\u8bf4\uff0cLoRA\u53ea\u9700\u8981\u5fae\u8c03\u4e00\u5c0f\u90e8\u5206\u989d\u5916\u53c2\u6570(\u4f4e\u79e9\u77e9\u9635\u5206\u89e3\u51fa\u7684\u56e0\u5b50)\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u8c03\u6574\u6574\u4e2a\u6a21\u578b\u7684\u5927\u91cf\u53c2\u6570\u3002\u8fd9\u79cd\u65b9\u6cd5\u53ea\u9700\u5c11\u91cf\u53c2\u6570\u8c03\u6574\uff0c\u5c31\u80fd\u5927\u5e45\u51cf\u5c11\u8bad\u7ec3\u4f18\u5316\u65f6\u95f4\u548c\u8d44\u6e90\u6210\u672c\uff0c\u5e76\u63d0\u5347\u6a21\u578b\u7684\u6027\u80fd\u3002<\/li>\n\n\n\n
    • \u3000\u3000\u9ad8\u6548\u7684\u5b58\u50a8\u548c\u5185\u5b58\u5360\u7528<\/strong>\uff1aLoRA\u5728\u5fae\u8c03\u8fc7\u7a0b\u4e2d\u53ea\u9700\u8981\u589e\u52a00.1%\u52301%\u7684\u6a21\u578b\u6743\u91cd\uff0c\u8fd9\u4f7f\u5f97\u5176\u5728\u5b58\u50a8\u548c\u5185\u5b58\u5360\u7528\u65b9\u9762\u975e\u5e38\u9ad8\u6548\u3002\u4f8b\u5982\uff0c\u4e0e\u5168\u91cf\u5fae\u8c03\u76f8\u6bd4\uff0cLoRA\u5fae\u8c03\u9700\u8981\u7684\u663e\u5b58\u5927\u5c0f\u5927\u5e45\u51cf\u5c11\uff0c\u4ece108GB108GB\u964d\u81f314GB14GB\u3002<\/li>\n\n\n\n
    • \u3000\u3000\u6a21\u5757\u5316\u548c\u53ef\u8fc1\u79fb\u6027<\/strong>\uff1aLoRA\u5177\u6709\u6a21\u5757\u5316\u3001\u53ef\u8fc1\u79fb\u7684\u4f18\u70b9\uff0c\u901a\u8fc7\u66f4\u6362\u5728\u4e0d\u540c\u4e0b\u6e38\u4efb\u52a1\u4e0a\u5fae\u8c03\u5f97\u5230\u7684LoRA\u77e9\u9635\uff0c\u53ef\u4ee5\u5c06\u6a21\u578b\u5e94\u7528\u5230\u4e0d\u540c\u7684\u4e0b\u6e38\u4efb\u52a1\u4e2d\uff0c\u4fbf\u4e8e\u4e0d\u540c\u4e0b\u6e38\u4efb\u52a1\u4e4b\u95f4\u7684\u5207\u6362\u3002<\/li>\n\n\n\n
    • \u3000\u3000\u5feb\u901f\u8bad\u7ec3\u548c\u90e8\u7f72<\/strong>\uff1aLoRA\u6280\u672f\u5f3a\u8c03\u5176\u5728\u5546\u54c1\u786c\u4ef6\u4e0a\u7684\u53ef\u5fae\u8c03\u6027\u3001\u53c2\u6570\u6570\u91cf\u5c11\u3001\u6587\u6863\u8be6\u5c3d\u4ee5\u53ca\u8fd0\u884c\u65f6\u6613\u4e8e\u5207\u6362\u7684\u7279\u70b9\uff0c\u4f7f\u5176\u9002\u7528\u4e8e\u7ecf\u6d4e\u578b\u786c\u4ef6\u4e14\u6613\u4e8e\u90e8\u7f72\u3002<\/li>\n\n\n\n
    • \u3000\u30002. \u4e0d\u8db3\uff1a<\/li>\n\n\n\n
    • \u3000\u3000\u8bad\u7ec3\u6536\u655b\u901f\u5ea6\u8f83\u6162<\/strong>\uff1a\u5c3d\u7ba1LoRA\u663e\u8457\u964d\u4f4e\u4e86\u8ba1\u7b97\u548c\u5185\u5b58\u9700\u6c42\uff0c\u4f46\u76f8\u6bd4\u4e8e\u5168\u91cf\u5fae\u8c03\uff0cLoRA\u7684\u8bad\u7ec3\u6536\u655b\u901f\u5ea6\u901a\u5e38\u66f4\u6162\u3002\u8fd9\u662f\u56e0\u4e3aLoRA\u9700\u8981\u66f4\u591a\u7684\u8fed\u4ee3\u6b21\u6570\u6765\u8fbe\u5230\u76f8\u540c\u7684\u6027\u80fd\u6c34\u5e73\u3002<\/li>\n\n\n\n
    • \u3000\u3000\u6d4b\u8bd5\u6027\u80fd\u901a\u5e38\u8f83\u5dee<\/strong>\uff1a\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0cLoRA\u5fae\u8c03\u7684\u6d4b\u8bd5\u6027\u80fd\u901a\u5e38\u4e5f\u6bd4\u5168\u91cf\u5fae\u8c03\u5dee\u3002\u8fd9\u610f\u5473\u7740\u5728\u7279\u5b9a\u4efb\u52a1\u4e0a\uff0cLoRA\u53ef\u80fd\u65e0\u6cd5\u8fbe\u5230\u6700\u4f73\u7684\u6027\u80fd\u8868\u73b0\u3002<\/li>\n\n\n\n
    • \u3000\u3000\u521d\u59cb\u5316\u65b9\u6cd5\u7684\u5f71\u54cd<\/strong>\uff1aLoRA\u7684\u521d\u59cb\u5316\u65b9\u6cd5\u5bf9\u5176\u6027\u80fd\u6709\u663e\u8457\u5f71\u54cd\u3002\u5982\u679c\u521d\u59cb\u5316\u4e0d\u5f53\uff0cLoRA\u7684\u6548\u679c\u53ef\u80fd\u4e0d\u5982\u9884\u671f\u3002\u56e0\u6b64\uff0c\u7814\u7a76\u8005\u4eec\u63d0\u51fa\u4e86\u6539\u8fdb\u7684\u521d\u59cb\u5316\u65b9\u6cd5\u5982LoRA-GA(\u5e26\u6709\u68af\u5ea6\u8fd1\u4f3c\u7684\u4f4e\u79e9\u9002\u5e94\u65b9\u6cd5)\uff0c\u4ee5\u63d0\u9ad8LoRA\u7684\u6548\u7387\u548c\u6027\u80fd\u3002<\/li>\n<\/ul>\n\n\n\n

      \u3000\u3000LoRA\u4f5c\u4e3a\u4e00\u79cd\u9ad8\u6548\u7684\u5fae\u8c03\u6280\u672f\uff0c\u5728\u51cf\u5c11\u8ba1\u7b97\u8d44\u6e90\u6d88\u8017\u3001\u63d0\u9ad8\u5b58\u50a8\u6548\u7387\u548c\u4fbf\u4e8e\u6a21\u578b\u8fc1\u79fb\u7b49\u65b9\u9762\u8868\u73b0\u51fa\u8272\uff0c\u4f46\u5728\u8bad\u7ec3\u901f\u5ea6\u548c\u6d4b\u8bd5\u6027\u80fd\u65b9\u9762\u4ecd\u5b58\u5728\u4e00\u5b9a\u7684\u4e0d\u8db3\u3002<\/p>\n\n\n\n

      \u3000\u3000\u56db\u3001 LoRA\u6a21\u578b\u5728\u56fe\u50cf\u751f\u6210\u9886\u57df\u7684\u5e94\u7528\u6848\u4f8b\u6709\u54ea\u4e9b?<\/h2>\n\n\n\n

      \u3000\u3000LoRA(\u4f4e\u79e9\u81ea\u9002\u5e94)\u6a21\u578b\u5728\u56fe\u50cf\u751f\u6210\u9886\u57df\u6709\u591a\u4e2a\u5e94\u7528\u6848\u4f8b\uff0c\u4ee5\u4e0b\u662f\u51e0\u4e2a\u5177\u4f53\u7684\u4f8b\u5b50\uff1a<\/p>\n\n\n\n

      \u3000\u3000\u5728\u533b\u7597\u6210\u50cf\u9886\u57df\uff0c\u7814\u7a76\u4eba\u5458\u5229\u7528LoRA\u6280\u672f\u5bf9Stable Diffusion\u548cDreamBooth\u6a21\u578b\u8fdb\u884c\u5fae\u8c03\uff0c\u4ee5\u751f\u6210\u9ad8\u4fdd\u771f\u533b\u7597\u56fe\u50cf\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u63d0\u9ad8\u4e86\u8bca\u65ad\u7684\u51c6\u786e\u6027\u548c\u53ef\u9760\u6027\uff0c\u8fd8\u901a\u8fc7\u5bf9\u6bd4\u8bed\u8a00-\u56fe\u50cf\u9884\u8bad\u7ec3(CLIP)\u6a21\u578b\u6539\u5584\u4e86\u56fe\u50cf\u751f\u4ea7\u7684\u4e0a\u4e0b\u6587\u7406\u89e3\u548c\u51c6\u786e\u6027\u3002\u6b64\u5916\uff0cDreamBooth + LoRA\u5728\u4e0d\u540c\u6570\u636e\u96c6\u4e0a\u5747\u53d6\u5f97\u4e86\u8f83\u9ad8\u7684Inception\u5206\u6570\uff0c\u8868\u660e\u5176\u751f\u6210\u7684\u56fe\u50cf\u5177\u6709\u8f83\u9ad8\u7684\u591a\u6837\u6027\u548c\u8d28\u91cf\u3002<\/p>\n\n\n\n

      \u3000\u3000LoRA\u6a21\u578b\u88ab\u7528\u4e8e\u751f\u6210\u5177\u6709\u7279\u5b9a\u5386\u53f2\u98ce\u683c\u7684\u5efa\u7b51\u7acb\u9762\u56fe\u50cf\u3002\u4f8b\u5982\uff0c\u5728\u7814\u7a76\u95fd\u5357\u4f20\u7edf\u4f4f\u5b85\u7acb\u9762\u65f6\uff0c\u7814\u7a76\u4eba\u5458\u7ed3\u5408\u4e86\u57fa\u4e8e\u56fe\u50cf\u548c\u7ebf\u7a3f\u8bad\u7ec3\u7684LoRA\u6a21\u578b\uff0c\u901a\u8fc7\u5408\u7406\u5206\u914d\u6743\u91cd\uff0c\u751f\u6210\u4e86\u89c6\u89c9\u771f\u5b9e\u6027\u548c\u6587\u5316\u51c6\u786e\u6027\u66f4\u9ad8\u7684\u5efa\u7b51\u7acb\u9762\u56fe\u50cf\u3002\u8fd9\u79cd\u7ed3\u5408\u4e0d\u540c\u6570\u636e\u96c6\u7684\u65b9\u6cd5\u663e\u8457\u63d0\u9ad8\u4e86\u751f\u6210\u7ed3\u679c\u7684\u8d28\u91cf\uff0c\u5e76\u6709\u6548\u5bf9\u9f50\u4e86\u56fe\u50cf\u548c\u6587\u672c\u7684\u8bed\u4e49\u3002<\/p>\n\n\n\n

      \u3000\u3000LoRA\u6280\u672f\u4e5f\u88ab\u5e94\u7528\u4e8e\u4ece\u9762\u90e8\u7167\u7247\u751f\u6210\u827a\u672f\u8096\u50cf\u3002\u901a\u8fc7\u7279\u5f81\u89e3\u8026\u548cLoRA\u6a21\u578b\u7684\u7ed3\u5408\uff0c\u7814\u7a76\u4eba\u5458\u80fd\u591f\u9ad8\u6548\u5730\u9002\u5e94\u5927\u578b\u9884\u8bad\u7ec3\u6a21\u578b\uff0c\u751f\u6210\u9ad8\u8d28\u91cf\u7684\u827a\u672f\u548c\u7167\u7247\u7ea7\u771f\u5b9e\u56fe\u50cf\u3002<\/p>\n\n\n\n

      \u3000\u3000\u5728AI\u56fe\u50cf\u751f\u6210\u7684\u7814\u7a76\u4e2d\uff0cLoRA\u6a21\u578b\u88ab\u7528\u4e8e\u751f\u6210\u7528\u4e8e\u5047\u56fe\u50cf\u68c0\u6d4b\u7684\u6570\u636e\u96c6\u3002\u4f8b\u5982\uff0c\u7814\u7a76\u4eba\u5458\u4f7f\u7528LoRA\u6280\u672f\u751f\u6210\u4e86\u5927\u91cf\u56fe\u50cf\uff0c\u5e76\u5c06\u5176\u4e0eImageNet\u6d4b\u8bd5\u6570\u636e\u96c6\u7ed3\u5408\uff0c\u7528\u4e8e\u8bad\u7ec3\u548c\u9a8c\u8bc1\u4e0d\u540c\u7684\u6a21\u578b\u3002<\/p>\n\n\n\n

      \u3000\u3000\u57fa\u4e8eLoRA\u7684LCM-LoRA\u6a21\u578b\u53ef\u4ee5\u5728\u4e0d\u9700\u8981\u9886\u57df\u6570\u636e\u5fae\u8c03\u7684\u60c5\u51b5\u4e0b\uff0c\u901a\u8fc7\u6a21\u578b\u53c2\u6570\u53e0\u52a0\u7684\u65b9\u5f0f\u52a0\u901f\u5404\u79cd\u98ce\u683c\u6570\u636e\u7684LoRA\u6a21\u578b\uff0c\u5927\u5e45\u6269\u5c55\u4e86LCM\u7684\u4f7f\u7528\u8303\u56f4\u3002<\/p>\n\n\n\n

      \u3000\u3000\u4e94\u3001 LoRA\u6a21\u578b\u7684\u6700\u65b0\u7814\u7a76\u8fdb\u5c55\u548c\u672a\u6765\u53d1\u5c55\u65b9\u5411\u662f\u4ec0\u4e48?<\/h2>\n\n\n\n

      \u3000\u3000LoRA(Low-Rank Adaptation)\u6a21\u578b\u4f5c\u4e3a\u4e00\u79cd\u9ad8\u6548\u7684\u5fae\u8c03\u65b9\u6cd5\uff0c\u8fd1\u5e74\u6765\u5728\u5927\u578b\u8bed\u8a00\u6a21\u578b(LLM)\u9886\u57df\u53d6\u5f97\u4e86\u663e\u8457\u8fdb\u5c55\u3002\u4ee5\u4e0b\u662fLoRA\u6a21\u578b\u7684\u6700\u65b0\u7814\u7a76\u8fdb\u5c55\u548c\u672a\u6765\u53d1\u5c55\u65b9\u5411\u7684\u8be6\u7ec6\u5206\u6790\uff1a<\/p>\n\n\n\n

      \u3000\u30001. \u6700\u65b0\u7814\u7a76\u8fdb\u5c55<\/h3>\n\n\n\n

      \u3000\u3000LoRA\u901a\u8fc7\u4f4e\u79e9\u5206\u89e3\u6280\u672f\u663e\u8457\u51cf\u5c11\u4e86\u6a21\u578b\u8bad\u7ec3\u6240\u9700\u7684\u53c2\u6570\u6570\u91cf\uff0c\u4ece\u800c\u63d0\u9ad8\u4e86\u8ba1\u7b97\u6548\u7387\u548c\u6a21\u578b\u6027\u80fd\u3002\u4f8b\u5982\uff0cQLoRA\u63d0\u51fa\u4e86\u4e00\u79cd\u65b0\u7684\u91cf\u5316\u65b9\u6cd5\u6765\u51cf\u5c11LLM\u5728LoRA fine-tuning\u671f\u95f4\u7684\u5185\u5b58\u6d88\u8017\u3002\u6b64\u5916\uff0cLoRA-Fine-Tuning-Aware Quantization(LoftQ)\u8fdb\u4e00\u6b65\u4f18\u5316\u4e86\u5185\u5b58\u5360\u7528\uff0c\u5b9e\u73b0\u4e86\u66f4\u9ad8\u6548\u7684\u53c2\u6570\u7ba1\u7406\u3002<\/p>\n\n\n\n

      \u3000\u3000\u7814\u7a76\u4eba\u5458\u6b63\u5728\u63a2\u7d22\u5c06LoRA\u4e0e\u5176\u4ed6\u6a21\u578b\u538b\u7f29\u6280\u672f\u76f8\u7ed3\u5408\uff0c\u4ee5\u5b9e\u73b0\u66f4\u9ad8\u6548\u7684\u6a21\u578b\u538b\u7f29\u3002\u4f8b\u5982\uff0cLoRA\u53ef\u4ee5\u4e0e\u77e5\u8bc6\u84b8\u998f\u6280\u672f\u7ed3\u5408\uff0c\u901a\u8fc7\u751f\u6210\u66f4\u5c0f\u4f46\u529f\u80fd\u76f8\u4f3c\u7684\u6a21\u578b\u6765\u51cf\u5c11\u8ba1\u7b97\u8d44\u6e90\u9700\u6c42\u3002<\/p>\n\n\n\n

      \u3000\u3000LoRA\u7684\u5e94\u7528\u4e0d\u4ec5\u9650\u4e8e\u6587\u672c\u5904\u7406\uff0c\u8fd8\u6269\u5c55\u5230\u4e86\u56fe\u50cf\u3001\u8bed\u97f3\u7b49\u591a\u6a21\u6001\u5b66\u4e60\u9886\u57df\u3002\u8fd9\u6709\u52a9\u4e8e\u63d0\u9ad8\u6a21\u578b\u5728\u4e0d\u540c\u9886\u57df\u7684\u8868\u73b0\u548c\u9002\u5e94\u6027\u3002<\/p>\n\n\n\n

      \u3000\u3000\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0cLoRA\u6210\u4e3a\u4f4e\u6210\u672c\u7cbe\u8c03\u7684\u4e3b\u6d41\u65b9\u6848\u4e4b\u4e00\u3002\u7814\u7a76\u4eba\u5458\u6b63\u5728\u7814\u7a76\u5982\u4f55\u5b9e\u73b0LoRA\u7684\u96c6\u7ea6\u5316\u9ad8\u6027\u80fd\u63a8\u7406\u90e8\u7f72\uff0c\u7ed3\u5408\u7ec6\u7c92\u5ea6\u7b97\u5b50\u878d\u5408\u4f18\u5316\u3001\u5206\u6bb5LoRAGEMM\u8ba1\u7b97\u3001\u591a\u6d41\u5f02\u6b65\u63a8\u7406\u3001\u91cf\u5316\u63a8\u7406\u7b49\u65b9\u5f0f\uff0c\u4ee5\u5b9e\u73b0\u6700\u4f18\u7684\u6027\u80fd\u548c\u663e\u5b58\u5360\u7528\u3002<\/p>\n\n\n\n

      \u3000\u30002. \u672a\u6765\u53d1\u5c55\u65b9\u5411<\/h3>\n\n\n\n

      \u3000\u3000\u76ee\u524dLoRA\u4e3b\u8981\u5e94\u7528\u4e8eTransformer\u67b6\u6784\uff0c\u672a\u6765\u7684\u7814\u7a76\u5c06\u63a2\u7d22\u5982\u4f55\u5c06\u5176\u5e94\u7528\u4e8e\u5176\u4ed6\u7c7b\u578b\u7684\u795e\u7ecf\u7f51\u7edc\uff0c\u4ee5\u8fdb\u4e00\u6b65\u63d0\u5347\u6a21\u578b\u7684\u9002\u7528\u6027\u548c\u7075\u6d3b\u6027\u3002<\/p>\n\n\n\n

      \u3000\u3000\u5f00\u53d1\u7b97\u6cd5\u81ea\u52a8\u786e\u5b9a\u6700\u4f18\u7684\u4f4e\u79e9\u77e9\u9635\u5927\u5c0f\u662f\u672a\u6765\u7684\u4e00\u4e2a\u91cd\u8981\u65b9\u5411\u3002\u8fd9\u5c06\u6709\u52a9\u4e8e\u7b80\u5316\u6a21\u578b\u8bbe\u8ba1\u6d41\u7a0b\uff0c\u5e76\u63d0\u9ad8\u6a21\u578b\u7684\u9002\u5e94\u6027\u548c\u9c81\u68d2\u6027\u3002<\/p>\n\n\n\n

      \u3000\u3000\u5229\u7528LoRA\u5b9e\u73b0\u9ad8\u6548\u7684\u591a\u4efb\u52a1\u5b66\u4e60\u662f\u4e00\u4e2a\u503c\u5f97\u6df1\u5165\u7814\u7a76\u7684\u65b9\u5411\u3002\u901a\u8fc7\u5728\u9884\u8bad\u7ec3\u9636\u6bb5\u5c31\u8003\u8651\u5230\u540e\u7eed\u7684\u9ad8\u6548\u9002\u5e94\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u5347\u6a21\u578b\u5728\u591a\u79cd\u4efb\u52a1\u4e0a\u7684\u8868\u73b0\u3002<\/p>\n\n\n\n

      \u3000\u3000\u7814\u7a76LoRA\u4e0e\u5176\u4ed6\u9ad8\u6548\u5fae\u8c03\u6280\u672f(\u5982Prompt-tuning)\u7684\u7ed3\u5408\uff0c\u4ee5\u53ca\u4e0e\u5176\u4ed6\u6a21\u578b\u538b\u7f29\u3001\u77e5\u8bc6\u84b8\u998f\u6280\u672f\u7684\u7ed3\u5408\uff0c\u5c06\u662f\u672a\u6765\u7684\u91cd\u8981\u7814\u7a76\u65b9\u5411\u3002\u8fd9\u4e9b\u7ed3\u5408\u6709\u671b\u8fdb\u4e00\u6b65\u63d0\u5347\u6a21\u578b\u7684\u6548\u7387\u548c\u6027\u80fd\u3002<\/p>\n\n\n\n

      \u3000\u3000LoRA\u7684\u601d\u60f3\u4e5f\u53ef\u80fd\u542f\u53d1\u65b0\u7684\u6a21\u578b\u8bbe\u8ba1\u8303\u5f0f\u3002\u7814\u7a76\u4eba\u5458\u6b63\u5728\u63a2\u7d22\u5982\u4f55\u5728\u9884\u8bad\u7ec3\u9636\u6bb5\u5c31\u8003\u8651\u5230\u540e\u7eed\u7684\u9ad8\u6548\u9002\u5e94\uff0c\u4ece\u800c\u8bbe\u8ba1\u51fa\u66f4\u5177\u5f39\u6027\u548c\u9002\u5e94\u6027\u7684\u6a21\u578b\u3002<\/p>\n\n\n\n

      \u3000\u30003. \u9762\u4e34\u7684\u6311\u6218<\/p>\n\n\n\n

      \u3000\u3000\u5c3d\u7ba1LoRA\u5c55\u73b0\u51fa\u5de8\u5927\u7684\u6f5c\u529b\uff0c\u4f46\u5728\u53d1\u5c55\u8fc7\u7a0b\u4e2d\u4e5f\u9762\u4e34\u4e00\u4e9b\u6311\u6218\uff1a<\/p>\n\n\n\n

      \u3000\u3000\u4f4e\u79e9\u5206\u89e3\u9700\u8981\u8f83\u5927\u7684\u8ba1\u7b97\u8d44\u6e90\uff0c\u5bf9\u786c\u4ef6\u8981\u6c42\u8f83\u9ad8\u3002\u8fd9\u53ef\u80fd\u9650\u5236\u4e86LoRA\u5728\u67d0\u4e9b\u8d44\u6e90\u53d7\u9650\u73af\u5883\u4e2d\u7684\u5e94\u7528\u3002<\/p>\n\n\n\n

      \u3000\u3000\u4f4e\u79e9\u5206\u89e3\u53ef\u80fd\u5bfc\u81f4\u6a21\u578b\u7684\u53ef\u89e3\u91ca\u6027\u964d\u4f4e\uff0c\u8fd9\u5bf9\u4e8e\u9700\u8981\u9ad8\u5ea6\u900f\u660e\u5ea6\u7684\u5e94\u7528\u573a\u666f\u53ef\u80fd\u662f\u4e00\u4e2a\u95ee\u9898\u3002<\/p>\n\n\n\n

      \u3000\u3000\u4f4e\u79e9\u5206\u89e3\u53ef\u80fd\u5bfc\u81f4\u6a21\u578b\u7684\u5b89\u5168\u6027\u964d\u4f4e\uff0c\u7279\u522b\u662f\u5728\u5bf9\u6297\u653b\u51fb\u65b9\u9762\u53ef\u80fd\u66f4\u5bb9\u6613\u53d7\u5230\u5a01\u80c1\u3002<\/p>\n\n\n\n

      <\/p>\n","protected":false},"excerpt":{"rendered":"

      LoRA\u6a21\u578b\uff0c\u5168\u79f0\u4e3aLow-Rank Adaptation of Large Language Models\uff0c\u4e2d\u6587\u8bd1\u4e3a\u201c\u5927\u8bed\u8a00\u6a21\u578b\u7684\u4f4e\u79e9\u9002\u5e94\u201d\u3002\u8fd9\u662f\u4e00\u79cd\u7531\u5fae\u8f6f\u7814\u7a76\u4eba\u5458\u5f00\u53d1\u7684\u6280\u672f<\/p>\n","protected":false},"author":1,"featured_media":98952,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[54],"class_list":["post-99277","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-l-2"],"_links":{"self":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/posts\/99277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/comments?post=99277"}],"version-history":[{"count":0,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/posts\/99277\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/media\/98952"}],"wp:attachment":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/media?parent=99277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/categories?post=99277"},{"taxonomy":"post_tag","embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/tags?post=99277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}