{"id":123688,"date":"2026-11-08T02:00:55","date_gmt":"2026-11-07T18:00:55","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/123688.html"},"modified":"2026-11-08T02:00:55","modified_gmt":"2026-11-07T18:00:55","slug":"%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a019%ef%bc%9a%e5%a4%a7%e6%a8%a1%e5%9e%8b%e5%be%ae%e8%b0%83%e5%85%a8%e6%94%bb%e7%95%a5-lora-qlora-%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/123688.html","title":{"rendered":"\u6df1\u5ea6\u5b66\u4e6019\uff1a\u5927\u6a21\u578b\u5fae\u8c03\u5168\u653b\u7565\u2014\u2014LoRA\/QLoRA \u5b9e\u6218"},"content":{"rendered":"<p>        \/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/<br \/>\n        #content_views .toc,<br \/>\n        \/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/<br \/>\n        #content_views.markdown_views &gt; p:empty:has(+ .toc),<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty,<br \/>\n        \/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/<br \/>\n        #content_views.htmledit_views #main-toc,<br \/>\n        #content_views.htmledit_views #hr-toc,<br \/>\n        #content_views.htmledit_views p[id*=\\&#8221;-toc\\&#8221;] {<br \/>\n          display: none !important;<br \/>\n        }<br \/>\n        \/* \u76ee\u5f55\u53bb\u6389\u540e\uff0c\u7d27\u8ddf\u7684\u9996\u4e2a\u6807\u9898\u4e0d\u518d\u591a\u51fa\u4e00\u5757\u4e0a\u8fb9\u8ddd *\/<br \/>\n        #content_views.markdown_views &gt; .toc + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + h4,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h4 {<br \/>\n          margin-top: 0 !important;<br \/>\n        }<\/p>\n<p>\u4e0a\u7bc7\u7528 DQN \u8ba9\u667a\u80fd\u4f53\u5b66\u4f1a\u51b3\u7b56&#xff0c;\u800c\u5927\u6a21\u578b\u65f6\u4ee3\u300c\u8ba9\u6a21\u578b\u5feb\u901f\u5b66\u4f1a\u65b0\u4efb\u52a1\u300d\u6700\u9ad8\u6548\u7684\u65b9\u5f0f&#xff0c;\u662f LoRA \u8fd9\u7c7b\u53c2\u6570\u9ad8\u6548\u5fae\u8c03\u3002<\/p>\n<h3>\u5f15\u8a00<\/h3>\n<p>\u60f3\u8ba9 LLaMA-7B \u8bf4&#034;\u4eba\u8bdd&#034;\u3001\u61c2\u4f60\u7684\u4e1a\u52a1&#xff0c;\u4f20\u7edf\u505a\u6cd5\u662f\u5168\u53c2\u6570\u5fae\u8c03\u2014\u2014\u4f46 7B \u6a21\u578b\u5168\u91cf\u5fae\u8c03\u8981\u5403 ~80GB \u663e\u5b58&#xff0c;\u7b49\u4e8e\u56db\u5f20 A100\u3002\u8fd9\u5bf9\u4e2a\u4eba\u548c\u4e2d\u5c0f\u56e2\u961f\u662f\u5929\u6587\u6570\u5b57\u3002\u597d\u6d88\u606f\u662f&#xff1a;95% \u7684\u6743\u91cd\u5176\u5b9e\u4e0d\u7528\u52a8\u3002\u53c2\u6570\u9ad8\u6548\u5fae\u8c03&#xff08;PEFT&#xff09;\u53ea\u8bad\u7ec3\u6781\u5c11\u53c2\u6570\u5c31\u80fd\u63a5\u8fd1\u5168\u91cf\u6548\u679c&#xff0c;\u5176\u4e2d LoRA \u548c QLoRA \u628a\u95e8\u69db\u538b\u5230\u4e86&#034;\u4e00\u5f20 24G \u6d88\u8d39\u5361\u4e5f\u80fd\u73a9&#034;\u3002\u672c\u7bc7\u624b\u628a\u624b\u5e26\u4f60\u8dd1\u901a\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u5168\u53c2\u6570\u5fae\u8c03\u7684\u663e\u5b58\u74f6\u9888<\/h3>\n<p>\u8bad\u7ec3\u663e\u5b58 \u2248 \u6a21\u578b\u53c2\u6570 \u00d7&#xff08;\u6bcf\u53c2\u6570\u5b57\u8282 &#043; \u4f18\u5316\u5668\u72b6\u6001 &#043; \u68af\u5ea6&#xff09;\u3002FP16 \u4e0b&#xff1a;\u53c2\u6570 2 \u5b57\u8282\u3001\u68af\u5ea6 2 \u5b57\u8282\u3001Adam \u72b6\u6001&#xff08;m,v&#xff09;4 \u5b57\u8282 \u2192 \u6bcf\u4e2a\u53c2\u6570\u7ea6 8 \u5b57\u8282\u3002<\/p>\n<table>\n<tr>\u6a21\u578b\u53c2\u6570\u91cf\u5168\u91cf\u5fae\u8c03\u663e\u5b58&#xff08;\u7ea6&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>7B<\/td>\n<td>70 \u4ebf<\/td>\n<td>~56 GB&#xff08;FP16&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>13B<\/td>\n<td>130 \u4ebf<\/td>\n<td>~100 GB&#043;<\/td>\n<\/tr>\n<tr>\n<td>70B<\/td>\n<td>700 \u4ebf<\/td>\n<td>\u591a\u5f20 A100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u663e\u7136\u4e0d\u73b0\u5b9e\u3002PEFT \u7684\u601d\u8def&#xff1a;\u51bb\u7ed3\u57fa\u5ea7&#xff0c;\u53ea\u8bad\u7ec3\u65c1\u8def\u7684\u5c0f\u53c2\u6570&#xff0c;\u663e\u5b58\u968f\u53ef\u8bad\u7ec3\u53c2\u6570\u9aa4\u964d\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001LoRA \u4f4e\u79e9\u5206\u89e3\u539f\u7406<\/h3>\n<p>\u6838\u5fc3\u6d1e\u5bdf&#xff1a;\u6743\u91cd\u66f4\u65b0 \u0394W \u5728\u5fae\u8c03\u65f6\u5f80\u5f80\u662f\u4f4e\u79e9\u7684\u3002\u4e8e\u662f\u628a \u0394W \u62c6\u6210\u4e24\u4e2a\u5c0f\u77e9\u9635&#xff1a;<\/p>\n<p>h &#061; W\u2080 x &#043; \u0394W x &#061; W\u2080 x &#043; B A x<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 (d\u00d7k) \u00a0 \u00a0  (d\u00d7r)(r\u00d7k) \u00a0 \u00a0  r \u226a d,k <\/p>\n<ul>\n<li>\n<p>W\u2080 \u51bb\u7ed3\u4e0d\u52a8&#xff08;\u4e0d\u5360\u68af\u5ea6\/\u4f18\u5316\u5668\u72b6\u6001&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u53ea\u8bad\u7ec3 A (r\u00d7k) \u548c B (d\u00d7r)&#xff0c;\u53ef\u8bad\u7ec3\u53c2\u6570\u91cf\u4ece d\u00d7k \u964d\u5230 r\u00d7(d&#043;k)\u3002<\/p>\n<\/li>\n<li>\n<p>\u63a8\u7406\u65f6\u53ef\u4ee5\u628a BA \u52a0\u56de W\u2080 \u5408\u5e76\u90e8\u7f72&#xff0c;\u96f6\u989d\u5916\u5ef6\u8fdf\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u53c2\u6570\u91cf\u5bf9\u6bd4&#xff1a;\u4ee5 d&#061;k&#061;4096\u3001\u79e9 r&#061;8 \u4e3a\u4f8b&#xff0c;\u539f\u6743\u91cd 1677 \u4e07&#xff0c;LoRA \u4ec5 8\u00d7(4096&#043;4096)&#061;6.5\u4e07&#xff0c;\u7ea6 0.4%\u3002\u5178\u578b\u914d\u7f6e r&#061;8~64 \u5373\u53ef&#xff0c;\u53c2\u6570\u91cf\u5e38\u80fd\u538b\u5230\u539f\u6a21\u578b\u7684 0.1%~1%&#xff0c;\u6548\u679c\u5374\u63a5\u8fd1\u5168\u91cf\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001QLoRA&#xff1a;4-bit \u91cf\u5316\u5fae\u8c03<\/h3>\n<p>QLoRA \u5728 LoRA \u57fa\u7840\u4e0a\u518d\u780d\u4e00\u5200\u2014\u2014\u628a\u51bb\u7ed3\u7684\u57fa\u5ea7\u7528 4-bit NF4 \u91cf\u5316\u5b58\u4e0b\u6765&#xff0c;\u914d\u5408 \u5206\u9875\u4f18\u5316\u5668&#xff08;Paged Optimizers&#xff09; \u5728\u663e\u5b58\u5cf0\u503c\u65f6\u628a\u4f18\u5316\u5668\u72b6\u6001\u6362\u9875\u5230 CPU&#xff0c;\u8fdb\u4e00\u6b65\u7701\u663e\u5b58\u3002<\/p>\n<p>\u6548\u679c\u60ca\u4eba&#xff1a;\u628a 65B \u6a21\u578b\u7684\u5fae\u8c03\u538b\u8fdb\u5355\u5f20 48G \u5361&#xff0c;7B \u6a21\u578b\u751a\u81f3\u80fd\u5728 24G \u6d88\u8d39\u5361&#xff08;\u5982 RTX 4090&#xff09; \u4e0a\u8dd1\u3002\u4ee3\u4ef7\u662f 4-bit \u5f15\u5165\u6781\u5c0f\u7cbe\u5ea6\u635f\u5931&#xff0c;\u4f46\u914d\u5408 LoRA \u5f80\u5f80\u53ef\u5ffd\u7565\u3002<\/p>\n<p>import torch<br \/>\nfrom transformers import AutoModelForCausalLM, BitsAndBytesConfig<br \/>\n\u200b<br \/>\nbnb_config &#061; BitsAndBytesConfig(<br \/>\n \u00a0 \u00a0load_in_4bit&#061;True,<br \/>\n \u00a0 \u00a0bnb_4bit_quant_type&#061;&#034;nf4&#034;,<br \/>\n \u00a0 \u00a0bnb_4bit_compute_dtype&#061;torch.bfloat16,<br \/>\n \u00a0 \u00a0bnb_4bit_use_double_quant&#061;True, \u00a0 # \u5bf9\u91cf\u5316\u5e38\u6570\u518d\u91cf\u5316&#xff0c;\u66f4\u7701<br \/>\n)<br \/>\nmodel &#061; AutoModelForCausalLM.from_pretrained(<br \/>\n \u00a0 \u00a0&#034;meta-llama\/Llama-2-7b-hf&#034;,<br \/>\n \u00a0 \u00a0quantization_config&#061;bnb_config,<br \/>\n \u00a0 \u00a0device_map&#061;&#034;auto&#034;,<br \/>\n) <\/p>\n<hr \/>\n<h3>\u56db\u3001\u4e2d\u6587\u6307\u4ee4\u6570\u636e\u6784\u9020<\/h3>\n<p>LoRA \u53ea\u6539&#034;\u884c\u4e3a&#034;&#xff0c;\u4e0d\u6539&#034;\u77e5\u8bc6&#034;&#xff0c;\u6240\u4ee5\u6570\u636e\u8d28\u91cf &gt; \u6570\u636e\u91cf\u3002\u6307\u4ee4\u6570\u636e\u7edf\u4e00\u6210 alpaca \u683c\u5f0f&#xff1a;<\/p>\n<p>{<br \/>\n \u00a0&#034;instruction&#034;: &#034;\u628a\u4e0b\u9762\u7684\u53e5\u5b50\u7ffb\u8bd1\u6210\u82f1\u6587&#034;,<br \/>\n \u00a0&#034;input&#034;: &#034;\u4eca\u5929\u5929\u6c14\u771f\u597d\u3002&#034;,<br \/>\n \u00a0&#034;output&#034;: &#034;The weather is really nice today.&#034;<br \/>\n} <\/p>\n<p>\u5efa\u8bae&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7528\u4f60\u4e1a\u52a1\u91cc\u7684\u771f\u5b9e\u95ee\u7b54\/\u6307\u4ee4&#xff0c;1000~5000 \u6761\u9ad8\u8d28\u91cf\u6837\u672c\u5e38\u591f\u89c1\u6548\u3002<\/p>\n<\/li>\n<li>\n<p>\u6df7\u5165\u5c11\u91cf\u901a\u7528\u6307\u4ee4\u6570\u636e\u9632\u9057\u5fd8\u3002<\/p>\n<\/li>\n<li>\n<p>\u53bb\u91cd\u3001\u6e05\u6d17\u683c\u5f0f&#xff0c;\u907f\u514d\u566a\u58f0\u4e3b\u5bfc\u4f4e\u79e9\u66f4\u65b0\u3002<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e94\u3001\u8bad\u7ec3\u4e0e\u6743\u91cd\u5408\u5e76\u90e8\u7f72<\/h3>\n<p>\u7528 Hugging Face peft \u51e0\u884c\u63a5\u5165&#xff1a;<\/p>\n<p>from peft import LoraConfig, get_peft_model<br \/>\n\u200b<br \/>\nlora_config &#061; LoraConfig(<br \/>\n \u00a0 \u00a0r&#061;8, \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # \u79e9<br \/>\n \u00a0 \u00a0lora_alpha&#061;16, \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # \u7f29\u653e&#xff0c;\u5e38\u53d6 2*r<br \/>\n \u00a0 \u00a0target_modules&#061;[&#034;q_proj&#034;,&#034;v_proj&#034;], \u00a0# \u6ce8\u5165\u6ce8\u610f\u529b\u7684 Q\/V<br \/>\n \u00a0 \u00a0lora_dropout&#061;0.05,<br \/>\n \u00a0 \u00a0bias&#061;&#034;none&#034;,<br \/>\n \u00a0 \u00a0task_type&#061;&#034;CAUSAL_LM&#034;,<br \/>\n)<br \/>\nmodel &#061; get_peft_model(model, lora_config)<br \/>\nmodel.print_trainable_parameters() \u00a0 # \u4f1a\u663e\u793a\u53ef\u8bad\u7ec3\u53c2\u6570\u5360\u6bd4 ~0.1%<br \/>\n\u200b<br \/>\n# \u4e4b\u540e\u7528 Trainer \/ SFTTrainer \u6b63\u5e38\u8bad\u7ec3\u5373\u53ef <\/p>\n<p>\u8bad\u7ec3\u5b8c\u6210\u540e\u5408\u5e76\u90e8\u7f72&#xff08;\u6d88\u9664\u65c1\u8def\u5f00\u9500&#xff09;&#xff1a;<\/p>\n<p>merged &#061; model.merge_and_unload() \u00a0 \u00a0# BA \u5408\u5e76\u56de W\u2080<br \/>\nmerged.save_pretrained(&#034;.\/llama2-7b-lora-merged&#034;) <\/p>\n<p>\u5178\u578b\u663e\u5b58\u4e0e\u6548\u679c&#xff08;\u516c\u5f00\u57fa\u51c6\u533a\u95f4&#xff0c;\u968f\u914d\u7f6e\u6d6e\u52a8&#xff0c;\u975e\u672c\u673a\u5b9e\u6d4b&#xff09;&#xff1a;<\/p>\n<table>\n<tr>\u65b9\u68487B \u5fae\u8c03\u663e\u5b58\u6548\u679c&#xff08;\u76f8\u5bf9\u5168\u91cf&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>\u5168\u53c2\u6570\u5fae\u8c03<\/td>\n<td>~56 GB<\/td>\n<td>100% \u57fa\u7ebf<\/td>\n<\/tr>\n<tr>\n<td>LoRA (r&#061;8, FP16)<\/td>\n<td>~16 GB<\/td>\n<td>~98%<\/td>\n<\/tr>\n<tr>\n<td>QLoRA (4-bit)<\/td>\n<td>~6~8 GB<\/td>\n<td>~97%<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fd9\u6b63\u662f&#034;\u6d88\u8d39\u7ea7\u663e\u5361\u5b9a\u5236\u5927\u6a21\u578b&#034;\u6210\u4e3a\u73b0\u5b9e\u7684\u539f\u56e0\u3002<\/p>\n<hr \/>\n<h3>\u516d\u3001\u7ecf\u9a8c\u53c2\u6570\u4e0e\u907f\u5751<\/h3>\n<li>\n<p>\u79e9 r \u4e0d\u662f\u8d8a\u5927\u8d8a\u597d&#xff1a;r&#061;8 \u5e38\u591f&#xff0c;r&#061;64 \u672a\u5fc5\u66f4\u597d\u8fd8\u66f4\u5360\u663e\u5b58&#xff1b;\u5148\u5c0f\u540e\u5927\u3002<\/p>\n<\/li>\n<li>\n<p>\u5b66\u4e60\u7387\u8981\u653e\u5927&#xff1a;LoRA \u53c2\u6570\u5c11&#xff0c;\u5e38\u7528 1e-4 ~ 3e-4&#xff0c;\u6bd4\u5168\u91cf\u5fae\u8c03&#xff08;~2e-5&#xff09;\u5927\u4e00\u4e2a\u91cf\u7ea7\u3002<\/p>\n<\/li>\n<li>\n<p>target_modules \u9009\u5bf9&#xff1a;\u901a\u5e38\u6ce8\u5165 q_proj,v_proj&#xff08;\u6216\u5168\u6ce8\u610f\u529b&#xff09;&#xff0c;\u522b\u6f0f\u4e86\u3002<\/p>\n<\/li>\n<li>\n<p>lora_alpha \/ r \u6bd4\u503c&#xff1a;\u63a7\u5236\u66f4\u65b0\u5e45\u5ea6&#xff0c;\u5e38\u8bbe alpha &#061; 2r\u3002<\/p>\n<\/li>\n<li>\n<p>\u907f\u514d\u707e\u96be\u6027\u9057\u5fd8&#xff1a;\u6570\u636e\u91cc\u4fdd\u7559\u5c11\u91cf\u901a\u7528\u6837\u672c&#xff1b;LoRA \u672c\u8eab\u56e0\u51bb\u7ed3\u57fa\u5ea7&#xff0c;\u9057\u5fd8\u98ce\u9669\u5df2\u8f83\u4f4e\u3002<\/p>\n<\/li>\n<li>\n<p>\u90e8\u7f72\u5408\u5e76&#xff1a;\u4e0a\u7ebf\u524d merge_and_unload&#xff0c;\u5426\u5219\u6bcf\u6b21\u63a8\u7406\u591a\u4e00\u6b21\u65c1\u8def\u8ba1\u7b97\u3002<\/p>\n<\/li>\n<hr \/>\n<h3>\u603b\u7ed3<\/h3>\n<p>LoRA \u7528\u4f4e\u79e9\u5206\u89e3\u628a&#034;\u5fae\u8c03\u5927\u6a21\u578b&#034;\u4ece A100 \u96c6\u7fa4\u964d\u7ef4\u5230\u5355\u5f20\u6d88\u8d39\u5361&#xff0c;QLoRA \u518d\u501f 4-bit \u91cf\u5316\u628a\u95e8\u69db\u780d\u5230 24G \u663e\u5b58\u3002\u672c\u6587\u7684 PEFT \u4ee3\u7801\u53ef\u76f4\u63a5\u5957\u4f60\u7684 7B\/13B \u6a21\u578b\u2014\u2014\u8bb0\u4f4f\u94c1\u5f8b&#xff1a;\u6570\u636e\u8d28\u91cf\u5148\u4e8e\u53c2\u6570\u91cf&#xff0c;r \u5148\u5c0f\u540e\u5927&#xff0c;\u5b66\u4e60\u7387\u653e\u5927\u4e00\u6863\u3002\u8fd9\u662f 2026 \u5e74\u6bcf\u4e2a\u60f3\u62e5\u6709&#034;\u4e13\u5c5e\u5927\u6a21\u578b&#034;\u7684\u5f00\u53d1\u8005\u90fd\u8be5\u638c\u63e1\u7684\u6280\u80fd\u3002<\/p>\n<h3>\u53c2\u8003\u8d44\u6599<\/h3>\n<li>\n<p>Hu, E., et al. (2021). LoRA: Low-Rank Adaptation of Large Language Models.<\/p>\n<\/li>\n<li>\n<p>Dettmers, T., et al. (2023). QLoRA: Efficient Finetuning of Quantized LLMs.<\/p>\n<\/li>\n<li>\n<p>Hugging Face PEFT \u6587\u6863&#xff1a;https:\/\/huggingface.co\/docs\/peft<\/p>\n<\/li>\n<li>\n<p>bitsandbytes 4-bit \u91cf\u5316\u6307\u5357\u3002<\/p>\n<\/li>\n<h3>\u5f80\u671f\u56de\u987e<\/h3>\n<ul>\n<li>\n<p>\u7b2c7\u7bc7&#xff1a;BERT \u6a21\u578b\u539f\u7406\u89e3\u6790\u4e0e\u5fae\u8c03\u5b9e\u6218<\/p>\n<\/li>\n<li>\u7b2c8\u7bc7&#xff1a;GPT \u7cfb\u5217\u5927\u6a21\u578b\u67b6\u6784\u6f14\u8fdb\u4e0e\u63d0\u793a\u5de5\u7a0b\u5165\u95e8<\/li>\n<li>\n<p>\u591a\u6a21\u6001\u5b66\u4e60\u2014\u2014\u56fe\u6587\u8054\u5408\u8868\u5f81\u524d\u6cbf\u8fdb\u5c55<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4da; \u672c\u7bc7\u51fa\u81ea\u4e13\u680f\u300a\u6df1\u5b66\u4e4b\u8def&#xff1a;\u4ece\u611f\u77e5\u673a\u5230\u667a\u80fd\u4f53\u300b \u2014\u2014 \u4ece\u611f\u77e5\u673a\u5230\u5927\u6a21\u578b\u667a\u80fd\u4f53\u7684\u5b8c\u6574\u6df1\u5ea6\u5b66\u4e60\u8fde\u8f7d&#xff08;\u57fa\u7840&#043;\u5de5\u7a0b\u5316 &#043;\u6269\u6563\u6a21\u578b \/ RAG \/ Agent \u7b49&#xff09;\u3002\u6bcf\u7bc7\u9644\u53ef\u8fd0\u884c\u4ee3\u7801\u4e0e\u539f\u521b\u5b9e\u9a8c&#xff0c;\u6536\u85cf\u4e13\u680f\u4e0d\u8ff7\u8def\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[14189,12955,12956,2067,132],"topic":[],"class_list":["post-123688","post","type-post","status-publish","format-standard","hentry","category-server","tag-pef","tag-qlora","tag-12956","tag-lora","tag-132"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6df1\u5ea6\u5b66\u4e6019\uff1a\u5927\u6a21\u578b\u5fae\u8c03\u5168\u653b\u7565\u2014\u2014LoRA\/QLoRA \u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/123688.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6df1\u5ea6\u5b66\u4e6019\uff1a\u5927\u6a21\u578b\u5fae\u8c03\u5168\u653b\u7565\u2014\u2014LoRA\/QLoRA \u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/123688.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-07T18:00:55+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/123688.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/123688.html\",\"name\":\"\u6df1\u5ea6\u5b66\u4e6019\uff1a\u5927\u6a21\u578b\u5fae\u8c03\u5168\u653b\u7565\u2014\u2014LoRA\/QLoRA \u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-07T18:00:55+00:00\",\"dateModified\":\"2026-11-07T18:00:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/123688.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/123688.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/123688.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6df1\u5ea6\u5b66\u4e6019\uff1a\u5927\u6a21\u578b\u5fae\u8c03\u5168\u653b\u7565\u2014\u2014LoRA\/QLoRA \u5b9e\u6218\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6df1\u5ea6\u5b66\u4e6019\uff1a\u5927\u6a21\u578b\u5fae\u8c03\u5168\u653b\u7565\u2014\u2014LoRA\/QLoRA \u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/123688.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6df1\u5ea6\u5b66\u4e6019\uff1a\u5927\u6a21\u578b\u5fae\u8c03\u5168\u653b\u7565\u2014\u2014LoRA\/QLoRA \u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content","og_url":"https:\/\/www.wsisp.com\/helps\/123688.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-07T18:00:55+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/123688.html","url":"https:\/\/www.wsisp.com\/helps\/123688.html","name":"\u6df1\u5ea6\u5b66\u4e6019\uff1a\u5927\u6a21\u578b\u5fae\u8c03\u5168\u653b\u7565\u2014\u2014LoRA\/QLoRA \u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-07T18:00:55+00:00","dateModified":"2026-11-07T18:00:55+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/123688.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/123688.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/123688.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6df1\u5ea6\u5b66\u4e6019\uff1a\u5927\u6a21\u578b\u5fae\u8c03\u5168\u653b\u7565\u2014\u2014LoRA\/QLoRA \u5b9e\u6218"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/123688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=123688"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/123688\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=123688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=123688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=123688"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=123688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}