{"id":1472,"date":"2025-12-11T23:50:09","date_gmt":"2025-12-11T15:50:09","guid":{"rendered":"https:\/\/lingbo.online\/?p=1472"},"modified":"2025-12-25T23:41:11","modified_gmt":"2025-12-25T15:41:11","slug":"llm%e7%9b%b8%e5%85%b3%e9%9a%8f%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/lingbo.online\/index.php\/uncategorized\/llm%e7%9b%b8%e5%85%b3%e9%9a%8f%e7%ac%94%e8%ae%b0\/","title":{"rendered":"LLM\u76f8\u5173\u968f\u7b14\u8bb0"},"content":{"rendered":"<h3>\u4e3a\u4ec0\u4e48\u8981\u521b\u5efaflash-attention\uff1f<\/h3>\n<p>\u539f\u59cbself-attention\u7684\u65f6\u95f4\u548c\u7a7a\u95f4\u590d\u6742\u5ea6\u662f\u5e8f\u5217\u957f\u5ea6\u7684\u4e8c\u6b21\u65b9\uff0c\u5f53\u5e8f\u5217\u957f\u5ea6\u8fc7\u957f\u65f6\uff0c\u7b97\u6cd5\u901f\u5ea6\u4f1a\u53d8\u6162\uff0c\u5185\u5b58\u6d88\u8017\u53d8\u9ad8\u3002<br \/>\nflash-attention\u4f7f\u7528\u5e73\u94fa\u548c\u91cd\u8ba1\u7b97\u7b49\u6280\u672f\uff0c\u5c06QKV\u5757\u5207\u5206\u540e\u4eceHBM\u52a0\u8f7d\u5230SRAM\u6267\u884c\u6ce8\u610f\u529b\u8ba1\u7b97\uff0c\u6700\u540e\u5c06\u7ed3\u679c\u66f4\u65b0\u4f1aHBM\uff0c\u4ece\u800c\u51cf\u5c11HBM\u8bbf\u95ee\u8017\u65f6\u3002<br \/>\n\u5229\u7528softmax\u51fd\u6570\u7684\u5e73\u79fb\u4e0d\u53d8\u5f62\uff0c\u5c06x\u5411\u91cf\u5206\u4e3aB\u4e2a\u5757\uff0c\u6bcf\u4e2a\u5757K\u4e2a\u5143\u7d20\uff0c\u5148\u5bf9\u6bcf\u4e2a\u5206\u5757\u8fdb\u884c\u8ba1\u7b97\uff0cSRAM\u91cc\u9762\u9700\u8981\u5904\u7406\u7684\u5143\u7d20\u8f83\u5c11\uff0c\u5904\u7406\u5b8c\u540e\uff0c\u518d\u5c06\u6bcf\u4e2a\u5206\u5757\u7684\u7ed3\u679c\u8fdb\u884c\u7ec4\u5408\uff0c\u5f97\u5230\u6700\u7ec8\u7684softmax\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211141508453.png\" alt=\"\" \/><\/p>\n<h3>\u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528Kv-cache<\/h3>\n<p>\u5927\u6a21\u578b\u4e3adecode-only\u6846\u67b6\uff0c\u81ea\u56de\u5f52\u7684\u7279\u70b9\u51b3\u5b9a\u4e86\u6a21\u578b\u5728\u6bcf\u4e2a\u65f6\u523b\u7684\u8f93\u5165\u90fd\u4f1a\u62fc\u63a5\u4e4b\u524d\u6b65\u957f\u7684\u8f93\u51fa\uff0ckv-cache\u4f7f\u7528\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u7684\u8ba1\u7b97\u65b9\u6cd5\uff0c\u6bcf\u4e2a\u65f6\u95f4\u6b65\u957f\u8ba1\u7b97\u65f6\uff0c\u5c06xk\u548cxv\u8fdb\u884c\u7f13\u5b58\uff0c\u4ece\u800c\u51cf\u5c11\u540c\u6b65\u8ba1\u7b97\u3002<br \/>\n\u6bcf\u4e00\u4e2atoken\u5728\u751f\u6210\u7684\u65f6\u5019\uff0c\u53ea\u4f9d\u8d56\u4e0a\u4e00\u4e2a\u65f6\u95f4\u6b65\u7684Q\u548c\u4e4b\u524d\u6240\u6709\u7684KV\uff0c\u6240\u4ee5\u4e0d\u9700\u8981Q-cache\u3002<br \/>\nKV-cache\u663e\u5b58\u5360\u7528\u8ba1\u7b97\u516c\u5f0f\u4e3a\uff1a<br \/>\nSeq_length*batch_size*[d_head*n_head]*layers*2*2<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211141747798.png\" alt=\"\" \/><\/p>\n<p>\u5f53\u6a21\u578b\u8f83\u5927\u5e8f\u5217\u8f83\u957f\u65f6\uff0c\u9700\u8981\u8003\u8651kv-cache\u7684\u7f13\u5b58\u5927\u5c0f\uff0c\u56e0\u6b64\uff0cMQA\u548cGQA\u88ab\u63d0\u51fa\uff0c\u51cf\u5c11kv\u7f13\u5b58\u3002<br \/>\n\u5728MQA\u4e2d\uff0c\u6240\u6709\u7684Q\u5171\u4eab\u4e00\u5957K\u548cV\uff0c\u4ece\u800c\u6781\u5927\u51cf\u5c11\u9700\u8981\u7f13\u5b58\u7684KV\u6570\u91cf\uff0c\u4f46\u9c7c\u523a\u540c\u65f6\u5e26\u6765\u6548\u679c\u635f\u5931<br \/>\nGQA\u8fdb\u884c\u4e86\u8fd9\u79cd\uff0c\u4e0d\u662f\u6240\u6709\u7684Q\u90fd\u5171\u4eab\uff0c\u800c\u662f\u5c06Q\u8fdb\u884c\u5206\u7ec4\uff0c\u6bcf\u7ec4Q\u5171\u4eab\u4e00\u7ec4KV\uff0c\u8fd9\u6837\u65e2\u51cf\u5c11\u4e86\u7f13\u5b58\u5360\u7528\uff0c\u4e5f\u4fdd\u8bc1\u4e86\u4e00\u5b9a\u7684\u6cdb\u5316\u80fd\u529b\uff0c\u5f53\u524d\u4e3b\u6d41\u5927\u6a21\u578b\u90fd\u6709\u4f7f\u7528GQA\u7684\u601d\u60f3\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211142558363.png\" alt=\"\" \/><\/p>\n<h3>\u4e3a\u4ec0\u4e48\u8981\u8fdb\u884c\u91cf\u5316<\/h3>\n<p>\u4e3a\u4e86\u964d\u4f4e\u90e8\u7f72\u6210\u672c\uff0c\u4f46\u53ef\u80fd\u4f1a\u5e26\u6765\u4e00\u5b9a\u7684\u6548\u679c\u635f\u5931\u3002<br \/>\n\u63a8\u7406\u6210\u672c\u2248\u6a21\u578btoken\u7684\u5e73\u5747\u63a8\u7406\u65f6\u95f4\u00d7\u529f\u8017\u00d7\u7535\u8d39\u3002<br \/>\n\u6309\u7167\u91cf\u5316\u7684\u6267\u884c\u9636\u6bb5\u5212\u5206\uff0c\u53ef\u4ee5\u5212\u5206\u4e3a\u8bad\u7ec3\u4e2d\u91cf\u5316\uff08QAT,Quantization-Aware-Training\uff09\u548c\u8bad\u7ec3\u540e\u91cf\u5316\uff08PTQ\uff0cPost-Training-Quantization\uff09,\u5f53\u524d\u4e3b\u6d41\u4e3aPTQ\u7684\u91cf\u5316\u65b9\u6cd5\u3002<\/p>\n<p>\u91cf\u5316\u9488\u5bf9\u7684\u4e3b\u8981\u5bf9\u8c61\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>PTQ\u4e3b\u8981\u9488\u5bf9\u6743\u91cd\u3001\u6fc0\u6d3b\u503c\u548cKV Cache\u8fdb\u884c\u91cf\u5316<\/li>\n<li>\u4ec5\u6743\u91cd\u91cf\u5316\uff0c\u5982AWQ\u548cGPTQ\u4e2d\u7684W4A16\uff0cW8A16\uff08\u6743\u91cd\u91cf\u5316\u4e3a8\u4f4d\uff0c\u6fc0\u6d3b\u503c\u4ecd\u4e3aBF16\u6216FP16\uff09<\/li>\n<li>\u6743\u91cd\u3001\u6fc0\u6d3b\u503c\u90fd\u91cf\u5316\uff0c\u5982smoothQuant\u4e2d\u7684W8A8<\/li>\n<\/ul>\n<p>\u5e38\u89c1\u7684\u53c2\u6570\u7cbe\u5ea6\u5305\u62ec\uff1a<br \/>\nfp32\uff1a\u5355\u7cbe\u5ea6<br \/>\nfp16\uff1a\u534a\u7cbe\u5ea6<br \/>\n\u4e3a\u4e86FP16\u63d0\u9ad8\u8bad\u7ec3\u7684\u6548\u7387\u548c\u6027\u80fd\uff0c\u540c\u65f6\u907f\u514d\u7cbe\u5ea6\u6ea2\u51fa\u548c\u820d\u5165\u8bef\u5dee\u7684\u5f71\u54cd\uff0c\u4e00\u822c\u91c7\u7528fp16\u548cfp32\u6df7\u5408\u7cbe\u5ea6\u8bad\u7ec3\u3002<\/p>\n<h4>\u4e3b\u6d41\u7684\u91cf\u5316\u7b97\u6cd5<\/h4>\n<h5>GPTQ<\/h5>\n<p>\u53d1\u5c55\u5386\u7a0b\u5305\u62ec\uff1aOBD\uff08\u526a\u679d\uff09-&gt;OBS\uff08\u526a\u679d\uff09-&gt;OBQ\uff08\u91cf\u5316\uff09-&gt;GPTQ\uff08\u91cf\u5316\uff09<\/p>\n<h6>OBD<\/h6>\n<ul>\n<li>\u7f51\u7edc\u8bad\u7ec3\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u6cf0\u52d2\u5c55\u5f00\u4e8c\u9636\u4fe1\u606f\u5bf9\u7f51\u7edc\u8fdb\u884c\u526a\u679d\uff0c\u4f7f\u5f97\u5220\u9664\u7684\u53c2\u6570\u5bf9\u4e8e\u7ed3\u679c\u5f71\u54cd\u6700\u5c0f\u3002<\/li>\n<li>\u8ba1\u7b97\u6bcf\u4e00\u4e2a\u53c2\u6570\u7684\u4e8c\u9636\u5bfc\u6570\uff0c\u8fdb\u800c\u8ba1\u7b97\u51fa\u6bcf\u4e2a\u53c2\u6570\u5e26\u6765\u7684\u635f\u5931\u51fd\u6570\u589e\u52a0\u503c\uff08delta E\uff09<\/li>\n<li>\u63d0\u51fadelta E\u8f83\u5c0f\u7684\u53c2\u6570<\/li>\n<li>\u8ba4\u4e3a\u6bcf\u4e2a\u53c2\u6570\u5bf9\u4e8e\u635f\u5931\u51fd\u6570\u5e26\u6765\u7684\u5f71\u54cd\u662f\u72ec\u7acb\u7684<\/li>\n<\/ul>\n<h6>OBS<\/h6>\n<ul>\n<li>\u8ba4\u4e3a\u53c2\u6570\u4e4b\u95f4\u72ec\u7acb\u6027\u4e0d\u6210\u7acb\uff0c\u9700\u8981\u8003\u8651\u4ea4\u53c9\u9879<\/li>\n<li>\u62b9\u53bb\u4e00\u4e2a\u6743\u91cdw\u540e\uff0c\u8ba1\u7b97\u51fa\u8865\u507fq\u5e94\u7528\u4e8e\u5176\u4ed6\u6743\u91cd\u4e0a\uff0c\u5bfb\u627e\u65b9\u6cd5\uff08\u6d77\u68ee\u77e9\u9635\u9006\u77e9\u9635\uff09\u4f7f\u5176\u5bf9\u6574\u4f53\u7684\u8bef\u5dee\u503c\u589e\u52a0\u6700\u5c11<\/li>\n<\/ul>\n<h6>OBQ<\/h6>\n<ul>\n<li>OBS\u53ef\u4ee5\u770b\u505a\u662f\u4e00\u79cd\u6781\u7aef\u7684\u91cf\u5316\u65b9\u6cd5\uff0c\u5373\u53c2\u6570\u53ea\u67090\u548c1\u4e24\u79cd\u72b6\u6001<\/li>\n<li>OBQ\u5f15\u5165\u7f29\u653e\u56e0\u5b50\uff0c\u5728OBS\u7684\u57fa\u7840\u4e0a\u51cf\u5c11\u56e0\u6781\u7aef\u91cf\u5316\u9020\u6210\u7684\u6548\u679c\u635f\u5931<\/li>\n<\/ul>\n<h6>GPTQ<\/h6>\n<ul>\n<li>OBQ\u901f\u5ea6\u592a\u6162\uff0c\u91cf\u5316ResNet 50\u5927\u7ea6\u9700\u89811\u4e2a\u5c0f\u65f6\uff0c\u91cf\u5316\u5927\u6a21\u578b\u53ef\u80fd\u9700\u8981\u6570\u5929<\/li>\n<li>GPTQ\u53ef\u4ee5\u770b\u505a\u662fOBQ\u7684\u52a0\u901f\u7248<\/li>\n<li>OBQ\u72ec\u7acb\u91cf\u5316\u6743\u91cd\u77e9\u9635W\u7684\u6bcf\u4e00\u884c\uff0c\u6bcf\u4e00\u884c\u5185\u90e8\u91cf\u5316\u7684\u65f6\u5019\u6309\u7167delta E\u6700\u5c0f\u7684\u539f\u5219\u6765\u9009\u62e9\u91cf\u5316\u7684\u987a\u5e8f\u3002GPTQ\u8ba4\u4e3a\u5bf9\u4e8e\u53c2\u6570\u91cf\u5f88\u5927\u7684\u5c42\uff0c\u4e25\u683c\u9009\u62e9\u987a\u5e8f\u7684\u91cf\u5316\u7ed3\u679c\u548c\u4efb\u610f\u987a\u5e8f\u7684\u91cf\u5316\u7ed3\u679c\u5dee\u522b\u4e0d\u5927\u3002\u56e0\u6b64\u5bf9\u6240\u6709\u7684\u884c\u90fd\u91c7\u7528\u540c\u6837\u7684\u987a\u5e8f\u8fdb\u884c\u91cf\u5316\uff0c\u4ece\u800c\u52a0\u901f\u6881\u6d77\u8fc7\u7a0b\u3002<\/li>\n<li>\u91c7\u7528int\/fp16(W4A16)\u7684\u6df7\u5408\u91cf\u5316\u65b9\u6848\uff0c\u5176\u4e2d\u6a21\u578b\u6743\u91cd\u88ab\u91cf\u5316\u4e3aint4\u7684\u6570\u503c\u7c7b\u578b\uff0c\u6fc0\u6d3b\u5c42\u5219\u4fdd\u7559\u5728float16\uff0c\u662f\u4e00\u79cd\u4ec5\u91cf\u5316\u6743\u91cd\u7684\u65b9\u6cd5<\/li>\n<\/ul>\n<h5>AWQ<\/h5>\n<p>AWQ\u8ba4\u4e3a\u6743\u91cd\u5e76\u4e0d\u540c\u7b49\u91cd\u8981\uff0c\u4ec5\u6709\u5c0f\u90e8\u5206\u663e\u8457\u6743\u91cd\u5bf9\u4e8e\u7ed3\u679c\u7684\u5f71\u54cd\u8f83\u5927\u3002\u5224\u65ad\u6743\u91cd\u91cd\u8981\u6027\u7684\u65b9\u6cd5\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u968f\u673a\u6311\u9009<\/li>\n<li>\u57fa\u4e8e\u6743\u91cd\u7edd\u5bf9\u503c\u5927\u5c0f\u6392\u5e8f\u540e\uff0c\u7edd\u5bf9\u503c\u8d8a\u5927\u8d8a\u663e\u8457<\/li>\n<li>\u6fc0\u6d3b\u503c\u8d8a\u5927\u8d8a\u663e\u8457\uff08Q=Wq*X\uff0cK=Wk*X\uff0cX\u5373\u4e3a\u6fc0\u6d3b\u503c\uff09<br \/>\nAWQ\u7684\u5b9e\u9a8c\u7ed3\u679c\u53d1\u73b0\uff1a\u968f\u673a\u6311\u9009\u4e0e\u5bf9\u6240\u6709\u6743\u91cd\u8fdb\u884c\u4f4e\u6bd4\u7279\u91cf\u5316\u5dee\u4e0d\u591a\uff1b\u57fa\u4e8e\u6743\u91cd\u503c\u5927\u5c0f\u7684\u6311\u9009\u6548\u679c\u4e0e\u968f\u673a\u6311\u9009\u5dee\u4e0d\u591a\uff1b\u57fa\u4e8e\u6fc0\u6d3b\u503c\u5927\u5c0f\u7684\u6311\u9009\u4e0efp16\u76f8\u6bd4<strong>\u51e0\u4e4e\u6ca1\u6709\u7cbe\u5ea6\u635f\u5931<\/strong>\u3002<\/li>\n<\/ul>\n<p>\u7136\u800c\uff0c\u4ec5\u91cf\u5316\u90e8\u5206\u6743\u91cd\u4f1a\u5e26\u6765\u786c\u4ef6\u5de5\u7a0b\u95ee\u9898\uff0c\u5b58\u50a8\u548c\u53d6\u6570\u7684\u8ba1\u7b97\u6bd4\u8f83\u590d\u6742\u3002\u4e3a\u4e86\u786c\u4ef6\u53cb\u597d\uff0c\u5bf9\u6240\u6709\u6743\u91cd\u8fdb\u884c\u91cf\u5316\uff0c\u4f46\u662f\u5bf9\u663e\u8457\u6743\u91cd\u548c\u975e\u663e\u8457\u6743\u91cd\u8fdb\u884c\u5dee\u5f02\u5316\u7684\u7f29\u653e\uff08scaling\uff09\uff0c\u4ece\u800c\u964d\u4f4e\u91cf\u5316\u8bef\u5dee\u3002\u5bf9\u4e8e\u663e\u8457\u6743\u91cd\uff0c\u4e58\u4ee5\u8f83\u5927\u7684s\uff1b\u5bf9\u4e8e\u975e\u663e\u8457\u6743\u91cd\uff0c\u4e58\u4ee5\u8f83\u5c0f\u7684s\u3002<\/p>\n<h5>QLoRA<\/h5>\n<p>QLoRA\u662f\u4f7f\u7528\u91cf\u5316\u601d\u60f3\u5bf9\u4e8eLoRA\u8fdb\u884c\u4f18\u5316\u7684\u91cf\u5316\u7b97\u6cd5\uff0c\u53ef\u4ee5\u663e\u8457\u964d\u4f4e\u8bad\u7ec3\u6240\u9700\u8981\u7684\u663e\u5b58\u8d44\u6e90\u3002\u4e3b\u8981\u4f18\u70b9\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u5b9a\u4e494\u4f4d\u6807\u51c6\u6d6e\u70b9\u6570\u91cf\u5316\uff08Normal Float 4-bit\uff0cNF4\uff09\uff0c\u7ed3\u5408\u5206\u4f4d\u6570\u91cf\u5316\u548c\u5206\u5757\u91cf\u5316\uff08\u89e3\u51b3\u53c2\u6570\u6781\u5927\u6781\u5c0f\u5f02\u5e38\u503c\uff1b\u63d0\u9ad8\u5e76\u884c\u5316\uff09<\/li>\n<li>\u53cc\u91cd\u91cf\u5316\uff0c\u5305\u542b\u5bf9\u666e\u901a\u53c2\u6570\u7684\u4e00\u6b21\u91cf\u5316\u548c\u5bf9\u91cf\u5316\u5e38\u6570\u7684\u518d\u6b21\u91cf\u5316\uff0c\u8fdb\u4e00\u6b65\u51cf\u5c0f\u7f13\u5b58<\/li>\n<li>\u5206\u9875\u4f18\u5316\u5668\uff08Page Optimizer\uff09\uff0c\u663e\u5b58\u8fc7\u9ad8\u65f6\u7528\u4e00\u90e8\u5206\u5185\u5b58\u4ee3\u66ff\u663e\u5b58<\/li>\n<\/ul>\n<h3>PEFT\u5fae\u8c03<\/h3>\n<h4>\u4e3a\u4ec0\u4e48\u8981\u8fdb\u884cPEFT\u5fae\u8c03<\/h4>\n<p>\u5168\u53c2\u6570\u5fae\u8c03\u7684\u4ee3\u4ef7\u8fc7\u5927\uff0c\u5305\u62ec\u5728\u8ba1\u7b97\u8d44\u6e90\u548c\u5fae\u8c03\u65f6\u95f4\u4e0a\u3002<br \/>\n\u663e\u5b58\u5360\u7528\u7684\u8ba1\u7b97\u5305\u62ec\uff1a\u6a21\u578b\u6743\u91cd\uff08fp16\/\u6df7\u5408\u7cbe\u5ea6\uff0c2x\uff09\u3001\u4f18\u5316\u5668\u72b6\u6001\uff08fp32\uff0c12x\uff09\u3001\u68af\u5ea6\uff082x\uff09\uff0c\u6fc0\u6d3b\u72b6\u6001\uff0c\u5728\u8bad\u7ec3\u65f6\u81f3\u5c11\u9700\u898116x\u7684\u663e\u5b58<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211150953794.png\" alt=\"\" \/><\/p>\n<h4>PEFT\u7684\u51e0\u79cd\u65b9\u5f0f<\/h4>\n<h5>adapter<\/h5>\n<p>Adapter\u9488\u5bf9\u6bcf\u4e2aTransformer\u5c42\uff0c\u589e\u52a0\u4e24\u4e2aAdapter\u7ed3\u6784\uff08\u5206\u522b\u662f\u6ce8\u610f\u529b\u548c\u524d\u9988\u5c42\u4e4b\u540e\uff0c\u4f46\u5728norm\u524d\uff09\u3002\u8bad\u7ec3\u5e08\uff0c\u56fa\u5b9a\u539f\u6765\u9884\u8bad\u7ec3\u6a21\u578b\u91c7\u7eb3\u6570\u4e0d\u53d8\uff0c\u6307\u5bf9\u65b0\u589e\u7684Adapter\u7ed3\u6784\u548cLayer Norm\u5c42\u8fdb\u884c\u5fae\u8c03\u3002<br \/>\n\u8be5\u65b9\u5f0f\u589e\u52a0\u4e86\u6a21\u578b\u7684\u63a8\u7406\u5c42\u6570\uff0c\u53ef\u80fd\u9020\u6210\u63a8\u7406\u5ef6\u8fdf\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211151348188.png\" alt=\"\" \/><\/p>\n<h5>prefix tuning<\/h5>\n<ul>\n<li>\u5728\u8f93\u5165token\u4e4b\u524d\u6784\u9020\u4e00\u6bb5virtual tokens\u4f5c\u4e3aPrefix,\u8bad\u7ec3\u65f6\u53ea\u66f4\u65b0prefix\u90e8\u5206\u7684\u53c2\u6570\uff0c\u5176\u4ed6\u53c2\u6570\u4e0d\u53d8<\/li>\n<li>\u5728\u6bcf\u4e00\u5c42\u524d\u7aef\u90fd\u52a0\u5165virtual tokens<\/li>\n<li>\u4e3a\u4e86\u9632\u6b62\u76f4\u63a5\u66f4\u65b0prefix\u53c2\u6570\u5bfc\u81f4\u8bad\u7ec3\u4e0d\u7a33\u5b9a\u548c\u6027\u80fd\u4e0b\u964d\uff0c\u5728prefix\u5c42\u524d\u9762\u6dfb\u52a0MLP\u7ed3\u6784\uff0c\u8bad\u7ec3\u5b8c\u6210\u540e\uff0c\u53ea\u4fdd\u7559prefix\u53c2\u6570\u3002<\/li>\n<li>\u8be5\u65b9\u5f0f\u4f1a\u9020\u6210\u989d\u5916\u7684token\u5360\u7528\uff0c\u964d\u4f4e\u6709\u6548\u5e8f\u5217\u957f\u5ea6<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211151739630.png\" alt=\"\" \/><\/li>\n<\/ul>\n<h5>prompt tuning<\/h5>\n<p>\u7ed9\u6bcf\u4e2a\u4efb\u52a1\u5b9a\u4e49\u5404\u81ea\u7684Prompt\uff0c\u62fc\u63a5\u5230\u6570\u636e\u4e0a\u4f5c\u4e3a\u8f93\u5165\uff0c\u4f46\u53ea\u5728\u8f93\u5165\u5c42\u52a0\u5165prompt tokens\uff0c\u4e14\u4e0d\u52a0\u5165MLP\uff08\u663e\u793a\u7684\u52a0\u5165token\uff09<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211152046917.png\" alt=\"\" \/><\/p>\n<h5>p-tuning<\/h5>\n<p>prompt tuning\u4e2d\uff0cprompt\u7684\u6784\u9020\u65b9\u6cd5\u5bf9\u7ed3\u679c\u7684\u5f71\u54cd\u8f83\u5927\u3002\u5728p-tuning\u4e2d\uff0c\u5c06prompt\u8f6c\u5316\u4e3a\u53ef\u5b66\u4e60\u7684embedding\u5c42\uff0c\u5e76\u7528MLP+LSTM\u7684\u65b9\u5f0f\u6765\u5bf9Prompt Embedding\u8fdb\u884c\u8868\u5f81\uff08\u53ea\u5728\u8f93\u5165\u5c42\uff09\u3002<br \/>\n\u4e0eprefix tuning\u76f8\u6bd4\uff0cp-tuning\u53ea\u5728\u8f93\u5165\u5c42\u6dfb\u52a0\uff0c\u4e14\u4e0d\u9700\u8981\u4e00\u5b9a\u52a0\u8f7d\u8f93\u5165\u7684\u524d\u9762\uff0c\u53ef\u4ee5\u5728\u4efb\u610f\u4f4d\u7f6e\u6dfb\u52a0\u3002<br \/>\np-tuning\u5728\u5c0f\u6a21\u578b\u4e0a\u8868\u73b0\u8f83\u5dee\uff1b\u5728NLU\u6548\u679c\u8f83\u597d\uff0c\u8bad\u7ec3\u6807\u6ce8\u4efb\u52a1\u6548\u679c\u8f83\u5dee<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211152501731.png\" alt=\"\" \/><\/p>\n<h5>lora<\/h5>\n<ul>\n<li>lora\u5fae\u8c03\u901a\u8fc7\u4f4e\u79e9\u5206\u89e3\u6a21\u62df\u53c2\u6570\u7684\u6539\u53d8\u91cf\uff0c\u4ece\u800c\u4ee5\u6781\u5c0f\u7684\u53c2\u6570\u91cf\u6765\u5b9e\u73b0\u5927\u6a21\u578b\u7684\u95f4\u63a5\u8bad\u7ec3<\/li>\n<li>\u5728\u539f\u59cb\u7684\u6a21\u578b\u65c1\u8fb9\u589e\u52a0\u4e00\u4e2a\u901a\u8def\uff0c\u901a\u8fc7\u4e24\u4e2a\u77e9\u9635A\u3001B\u76f8\u4e58\uff0c\u5148\u964d\u7ef4\u518d\u5347\u7ef4\uff0c\u4e2d\u95f4\u5c42\u7ef4\u5ea6\u7ef4r\uff0c\u6a21\u62df\u672c\u5f81\u79e9<\/li>\n<li>\u5c06\u4e24\u90e8\u5206\u53c2\u6570\u76f8\u52a0<\/li>\n<li>\u77e9\u9635\u7684\u79e9\u4e00\u822c\u53d61\u30012\u30014\u30018<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211152904700.png\" alt=\"\" \/><\/li>\n<\/ul>\n<p>lora\u5fae\u8c03\u7684\u53d8\u79cd\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>lora+\uff1a\u7ed9A\u548cB\u77e9\u9635\u8bbe\u7f6e\u4e0d\u540c\u7684\u5b66\u4e60\u7387<\/li>\n<li>lora-drop\uff1aLora\u77e9\u9635\u53ef\u4ee5\u6dfb\u52a0\u5230\u795e\u7ecf\u7f51\u7edc\u7684\u4efb\u4f55\u4e00\u5c42\u3002LoRA-drop\u53ef\u4ee5\u9009\u62e9\u54ea\u4e9b\u5c42\u7531LoRA\u8fdb\u884c\u5fae\u8c03\uff0c\u54ea\u4e9b\u5c42\u4e0d\u9700\u8981<\/li>\n<li>adalora\uff1aLora-drop\u4e2d\u5404\u5c42\u7684\u9002\u914d\u5668\u8981\u4e48\u5b8c\u5168\u88ab\u8bad\u7ec3\uff0c\u8981\u4e48\u5b8c\u5168\u4e0d\u88ab\u8bad\u7ec3\u3002\u800cAdaLoRA\u53ef\u4ee5\u51b3\u5b9a\u4e0d\u540c\u7684\u9002\u914d\u5668\u5177\u6709\u4e0d\u540c\u7684\u79e9<\/li>\n<\/ul>\n<h3>PEFT\u8bad\u7ec3\u5e38\u7528\u6846\u67b6<\/h3>\n<ul>\n<li>LLaMA-Factory<\/li>\n<li>SWIFT\uff08\u9b54\u642d\u793e\u533a\uff09<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211153242375.png\" alt=\"\" \/><\/li>\n<\/ul>\n<h3>\u5fae\u8c03\u4e3b\u8981\u53c2\u6570\u8bbe\u7f6e<\/h3>\n<h4>learning rate<\/h4>\n<p>\u6839\u636egpt3 paper\uff0c\u4e00\u822c\u6765\u770b\uff0c\u6a21\u578b\u8d8a\u5927\uff0c\u5b66\u4e60\u7387\u8d8a\u4f4e\uff08\u65e0\u4e25\u683c\u5b9a\u4e49\uff0c\u5b9e\u9a8c\u5bfc\u5411\u786e\u5b9a\uff09<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211153456543.png\" alt=\"\" \/><\/p>\n<h4>lr_scheduler_type<\/h4>\n<ul>\n<li>\u5e38\u6570\u5b66\u4e60\u7387\uff08constant\uff09\uff1a\u5b66\u4e60\u7387\u5728\u6574\u4e2a\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u4fdd\u6301\u4e0d\u53d8<\/li>\n<li>\u5e26\u9884\u70ed\u7684\u5e38\u6570\u5b66\u4e60\u7387\uff08constant_with_warmup\uff09\uff1a\u5728\u8bad\u7ec3\u521d\u671f\u6709\u4e00\u4e2a\u9884\u70ed\u9636\u6bb5\uff0c\u5b66\u4e60\u7387\u4e3b\u952e\u589e\u52a0\u5230\u521d\u59cb\u5b66\u4e60\u7387\uff0c\u7136\u540e\u4fdd\u6301\u5e38\u6570<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211154345727.png\" alt=\"\" \/><\/li>\n<li>\u7ebf\u6027\u8870\u51cf\uff08linear\uff09\uff1a\u4ece\u521d\u59cb\u5b66\u4e60\u7387\u7ebf\u6027\u4e0b\u964d\u52300<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211154356151.png\" alt=\"\" \/><\/li>\n<li>\u4f59\u5f26\u9000\u706b\uff08cosine\uff09\uff1a\u5b66\u4e60\u7387\u6309\u7167\u4f59\u5f26\u51fd\u6570\u53d8\u5316\uff0c\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u9010\u6b65\u51cf\u5c0f<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211154405890.png\" alt=\"\" \/><\/li>\n<li>\u4f59\u5f26\u9000\u706b\u4e0e\u91cd\u542f\uff08cosine_with_restarts\uff09\uff1a\u5e26\u91cd\u542f\u7684\u4f59\u5f26\u9000\u706b\u8c03\u5ea6\u5668\uff0c\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u5468\u671f\u6027\u7684\u91cd\u7f6e\u5b66\u4e60\u7387\uff0c\u7136\u540e\u6309\u4f59\u5f26\u51fd\u6570\u8870\u51cf\uff0c\u6bcf\u4e2a\u4e00\u6bb5\u65f6\u95f4\u91cd\u542f\u4f59\u5f26\u66f2\u7ebf\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251211154436812.png\" alt=\"\" \/><\/li>\n<\/ul>\n<h4>warmup_ratio<\/h4>\n<p>\u7531\u4e8e\u6a21\u578b\u6743\u91cd\u662f\u968f\u673a\u521d\u59cb\u5316\u7684\uff0c\u521a\u5f00\u59cb\u8bad\u7ec3\u7684\u65f6\u5019\u5982\u679c\u5b66\u4e60\u7387\u8fc7\u5927\uff0c\u53ef\u80fd\u9020\u6210\u8bad\u7ec3\u4e0d\u7a33\u5b9a\u3002\u9009\u62e9warmup\u9884\u70ed\u5b66\u4e60\u7387\u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u5f97\u5f00\u59cb\u8bad\u7ec3\u7684\u51e0\u4e2aepoch\u6216\u8005\u4e00\u4e9bstep\u5185\u5b66\u4e60\u7387\u8f83\u5c0f\u3002<\/p>\n<h4>gradient_accumlation_steps<\/h4>\n<p>\u68af\u5ea6\u7d2f\u52a0\uff1a\u6bcf\u6b21\u83b7\u53d61\u4e2abatch\u7684\u6570\u636e\uff0c\u8ba1\u7b971\u6b21\u68af\u5ea6\uff0c\u68af\u5ea6\u4e0d\u6e05\u7a7a\uff0c\u7d2f\u79ef\u5230\u9884\u8bbe\u503c\u540e\uff0c\u518d\u66f4\u65b0\u7f51\u7edc\u53c2\u6570\uff0c\u7136\u540e\u6e05\u7a7a\u68af\u5ea6\uff0c\u8fdb\u884c\u4e0b\u4e00\u6b21\u5faa\u73af\u3002<\/p>\n<h3>\u4e3a\u4ec0\u4e48\u9700\u8981\u4f4d\u7f6e\u7f16\u7801<\/h3>\n<p>Transformer\u57fa\u4e8e\u81ea\u6ce8\u610f\u529b\u673a\u5236\uff0c\u65e0\u6cd5\u76f4\u63a5\u7406\u89e3\u5143\u7d20\u987a\u5e8f\u3002<br \/>\n\u4f7f\u7528\u7edd\u5bf9\u7f16\u7801\u65b9\u6cd5\uff0c\u6bcf\u4e2a\u4f4d\u7f6e\u56fa\u5b9a\u7f16\u7801\uff0c\u53ea\u4e8e\u4f4d\u7f6ek\u6709\u5173\uff0c\u9047\u5230\u53d8\u957f\u5e8f\u5217\u6216\u8005\u957f\u8ddd\u79bb\u4f9d\u8d56\u65f6\uff0c\u65e0\u6cd5\u5145\u5206\u8868\u8fbe\u4f4d\u7f6e\u4fe1\u606f\u3002<br \/>\n\u4f7f\u7528\u76f8\u5bf9\u7f16\u7801\u65b9\u6cd5\uff0c\u5e76\u4e0d\u4e3a\u6bcf\u4e2a\u4f4d\u7f6e\u5206\u914d\u552f\u4e00\u7f16\u7801\uff0c\u800c\u662f\u5173\u6ce8\u5e8f\u5217\u4e2d\u5404\u5143\u7d20\u4e4b\u95f4\u7684\u76f8\u5bf9\u4f4d\u7f6e\u3002\u8ba1\u7b97\u5e8f\u5217\u4e2d\u5143\u7d20\u4e4b\u95f4\u7684\u8ddd\u79bb\u6765\u8868\u793a\u4ed6\u4eec\u4e4b\u95f4\u7684\u76f8\u5bf9\u5173\u7cfb\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251212155533397.png\" alt=\"\" \/><\/p>\n<p>\u597d\u7684\u4f4d\u7f6e\u7f16\u7801\uff1a\u6bcf\u4e00\u4e2a\u4f4d\u7f6e\u7f16\u7801\u552f\u4e00\uff1b\u826f\u597d\u7684\u5916\u63a8\u6027\uff1b\u4e0d\u540c\u7684\u53e5\u5b50\u4e2d\uff0ctoken\u7684\u76f8\u5bf9\u4f4d\u7f6e\u76f8\u540c\u65f6\uff0c\u76f8\u5173\u6027\u4e00\u81f4<br \/>\n\u65cb\u8f6c\u4f4d\u7f6e\u7f16\u7801\u7684\u5177\u4f53\u64cd\u4f5c\u6d41\u7a0b\uff1a\u5bf9\u5e8f\u5217\u4e2d\u7684\u6bcf\u4e2atoken\uff0c\u5148\u8ba1\u7b97\u5176\u5bf9\u5e94query\u548ckey\u5411\u91cf\uff0c\u7136\u540e\u5bf9\u6bcf\u4e2atoken\u4f4d\u7f6e\u8ba1\u7b97\u5bf9\u5e94\u7684\u65cb\u8f6c\u4f4d\u7f6e\u7f16\u7801\uff0c\u7136\u540e\u5bf9\u6bcf\u4e2atoken\u7684query\u548ckey\u5411\u91cf\u7684\u5143\u7d20\u5e94\u7528\u65cb\u8f6c\u53d8\u6362\u3002\u6700\u540e\u5c06\u65cb\u8f6c\u540e\u7684query\u548ckey\u5411\u91cf\u76f8\u4e58\uff0c\u7eb3\u5165\u5bf9\u5e94\u7684\u76f8\u5bf9\u4f4d\u7f6e\u4fe1\u606f\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251212161550422.png\" alt=\"\" \/><\/p>\n<h3>Transformer<\/h3>\n<p>\u4f20\u7edf\u5faa\u73af\u795e\u7ecf\u7f51\u7edc\uff08RNN\/LSTM\uff09\u5b58\u5728\u91cf\u5927\u5c40\u9650\uff1a<\/p>\n<ul>\n<li>\u4e32\u884c\u8ba1\u7b97\uff1a\u4f9d\u8d56\u65f6\u5e8f\u9012\u63a8\uff0c\u65e0\u6cd5\u5e76\u884c\u5904\u7406\u957f\u5e8f\u5217\uff0c\u6548\u7387\u4f4e\u4e0b<\/li>\n<li>\u957f\u8ddd\u79bb\u4f9d\u8d56\u8870\u51cf\uff1a\u68af\u5ea6\u968f\u5e8f\u5217\u957f\u5ea6\u6307\u6570\u7ea7\u6d88\u5931\uff0c\u96be\u4ee5\u6355\u6349\u8fdc\u8ddd\u79bb\u8bed\u4e49\u5173\u8054\u3002Transformer\u901a\u8fc7\u81ea\u6ce8\u610f\u529b\u673a\u5236\u548c\u5168\u5e76\u884c\u67b6\u6784\u5f7b\u5e95\u89e3\u51b3\u4e86\u8fd9\u4e9b\u95ee\u9898\uff0c\u6210\u4e3aNLP\u3001CV\u9886\u57df\u7684\u901a\u7528\u6846\u67b6\u3002<\/li>\n<\/ul>\n<h3>Agent\u7684\u6838\u5fc3\u5b9a\u4e49<\/h3>\n<p>AI Agent\u662f\u4e00\u4e2a\u80fd\u591f\u901a\u8fc7\u611f\u77e5\u73af\u5883\u3001\u81ea\u4e3b\u51b3\u7b56\u3001\u8c03\u7528\u5de5\u5177\u5b8c\u6210\u590d\u6742\u4efb\u52a1\u7684\u667a\u80fd\u4f53\uff0c\u5176\u6838\u5fc3\u529f\u80fd\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u4efb\u52a1\u62c6\u89e3\uff1a\u5c06\u7528\u6237\u76ee\u6807\u5206\u89e3\u4e3a\u5b50\u4efb\u52a1<\/li>\n<li>\u5de5\u5177\u8c03\u7528\uff1aAPI\u3001\u641c\u7d22\u3001\u4ee3\u7801\u6267\u884c\u7b49<\/li>\n<li>\u8bb0\u5fc6\u4e0e\u72b6\u6001\u7ba1\u7406\uff1a\u5305\u62ec\u4e0a\u4e0b\u6587\u8bb0\u5fc6\u3001\u957f\u671f\u8bb0\u5fc6\u5b58\u50a8\u7b49<\/li>\n<li>\u81ea\u6211\u8fed\u4ee3\uff1a\u80fd\u591f\u53cd\u601d\u9519\u8bef\u3001\u7ed9\u51fa\u4f18\u5316\u7b56\u7565<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251213085158875.jpg\" alt=\"\" \/><\/p>\n<p><strong>\uff081\uff09\u4efb\u52a1\u5b9a\u4e49\u4e0e\u89c4\u5212<\/strong><\/p>\n<ul>\n<li>\u76ee\u6807\u89e3\u6790\uff1a\u901a\u8fc7\u81ea\u7136\u8bed\u8a00\u7406\u89e3\u7528\u6237\u610f\u56fe\uff08\u5982\u201c\u5e2e\u6211\u5206\u6790\u65b0\u80fd\u6e90\u6c7d\u8f66\u5e02\u573a\u8d8b\u52bf\u201d-&gt;\u62c6\u89e3\u4e3a\u6570\u636e\u722c\u53d6\u3001\u6e05\u6d17\u3001\u5206\u6790\u3001\u53ef\u89c6\u5316\u7b49\u6b65\u9aa4\uff09<\/li>\n<li>\u89c4\u5212\u65b9\u6cd5\uff1a\u94fe\u5f0f\u89c4\u5212\uff08Chain-of-Thought\uff09\u3001\u6811\u72b6\uff08Tree-of-Thought\uff09\u3001\u56fe\u72b6\uff08Graph-of-Thought\uff09\u4efb\u52a1\u5206\u89e3<\/li>\n<li>\u5de5\u5177\u9009\u62e9\uff1a\u6839\u636e\u5b50\u4efb\u52a1\u7c7b\u578b\u9009\u62e9\u5de5\u5177\uff0c\u5982\u722c\u866b\u5de5\u5177\u3001pandas\u3001matplotlib\u7b49<\/li>\n<\/ul>\n<p><strong>\uff082\uff09\u6a21\u578b\u5c42<\/strong><\/p>\n<ul>\n<li>\u6838\u5fc3\u6a21\u578b\uff1a\u9009\u62e9\u57fa\u7840\u5927\u6a21\u578b\uff0c\u5982GPT4\u3001LLAMA2\u7b49\u4f5c\u4e3a\u63a8\u7406\u5f15\u64ce<\/li>\n<li>\u89d2\u8272\u8bbe\u5b9a\uff1a\u901a\u8fc7System Prompt\u5b9a\u4e49Agent\u89d2\u8272<\/li>\n<li>\u5fae\u8c03\u9700\u6c42\uff1a\u662f\u5426\u9700\u8981\u9886\u57df\u5fae\u8c03\uff0c\u5982\u533b\u7597\u3001\u91d1\u878d\u7b49\u573a\u666f<\/li>\n<\/ul>\n<p><strong>\uff083\uff09\u5de5\u5177\u5e93\u96c6\u6210<\/strong><\/p>\n<ul>\n<li>\u5185\u7f6e\u5de5\u5177\uff1a\u4ee3\u7801\u89e3\u91ca\u5668\u3001\u6570\u5b66\u8ba1\u7b97\u3001\u6587\u4ef6\u8bfb\u5199<\/li>\n<li>\u5916\u90e8API\uff1a\u641c\u7d22\u5f15\u64ceSerpAPI\u3001\u6570\u636e\u5e93SQLAlchemy\u3001\u4e91\u670d\u52a1AWS S3\u7b49<\/li>\n<li>\u81ea\u5b9a\u4e49\u5de5\u5177\uff1a\u4e1a\u52a1\u7279\u5b9a\u5de5\u5177\uff0c\u5982\u5185\u90e8CRM\u7cfb\u7edf\u63a5\u53e3\u7b49<\/li>\n<\/ul>\n<p><strong>\uff084\uff09\u8bb0\u5fc6\u7cfb\u7edf<\/strong><\/p>\n<ul>\n<li>\u77ed\u671f\u8bb0\u5fc6\uff1a\u4e0a\u4e0b\u6587\u7a97\u53e3\u7ba1\u7406\uff0c\u5982GPT4\u76848k\/32k Token\u9650\u5236<\/li>\n<li>\u957f\u671f\u8bb0\u5fc6\uff1a\u5411\u91cf\u6570\u636e\u5e93\u5b58\u50a8\u5386\u53f2\u4ea4\u4e92<\/li>\n<li>\u4f18\u5148\u7ea7\u7b56\u7565\uff1a\u5173\u952e\u4fe1\u606f\u7684\u63d0\u53d6\u548c\u7f13\u5b58\uff0c\u5982\u7528\u6237\u504f\u597d\u3001\u4efb\u52a1\u5386\u53f2\u7b49<\/li>\n<\/ul>\n<p><strong> \uff085\uff09\u5b89\u5168\u548c\u53ef\u63a7\u6027<\/strong><\/p>\n<ul>\n<li>\u6743\u9650\u63a7\u5236\uff1a\u9650\u5236\u654f\u611f\u5de5\u5177\u8c03\u7528\uff0c\u5982\u5220\u9664\u6587\u4ef6\u3001\u652f\u4ed8\u63a5\u53e3\u7b49<\/li>\n<li>\u8f93\u51fa\u5ba1\u6838\uff1a\u654f\u611f\u8bcd\u8fc7\u6ee4\u7b49<\/li>\n<\/ul>\n<p>\u5e38\u89c1\u7684Agent\u5f00\u53d1\u6846\u67b6\u5305\u62ec\uff1aLangChain\u3001AutoGPT\u3001Microsoft Guidance\u7b49<\/p>\n<h3>PPO\u548cDPO\u7684\u533a\u522b<\/h3>\n<p>PPO\uff1a\u901a\u8fc7\u9650\u5236\u7b56\u7565\u66f4\u65b0\u5e45\u5ea6\uff08KL\u6563\u5ea6\u7ea6\u675f\uff09\u6700\u5927\u5316\u5956\u52b1\u671f\u671b\uff0c\u9700\u8981\u9884\u8bad\u7ec3\u5956\u52b1\u6a21\u578b\uff08Reward Model\uff09\uff0c\u901a\u8fc7\u7b56\u7565-\u5956\u52b1\u4ea4\u4e92\u8fed\u4ee3\u4f18\u5316<br \/>\nDPO\uff1a\u76f4\u63a5\u5229\u7528\u4eba\u7c7b\u504f\u597d\u6570\u636e\uff0c\u5c06\u7b56\u7565\u5bf9\u5230\u504f\u597d\u5206\u5e03\uff0c\u7ed5\u8fc7\u663e\u5f0f\u5956\u52b1\u5efa\u6a21\uff0c\u76f4\u63a5\u901a\u8fc7\u504f\u597d\u5bf9\uff08\u597d\u7b54\u6848\u3001\u574f\u7b54\u6848\uff09\u6765\u4f18\u5316\u7b56\u7565<\/p>\n<p>\u5728\u8bad\u7ec3\u8303\u5f0f\u4e0a\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u7ef4\u5ea6<\/th>\n<th>PPO<\/th>\n<th>DPO<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u6570\u636e\u9700\u6c42<\/td>\n<td>\u9700\u8981\u5927\u91cf\u65e0\u6807\u6ce8\u6570\u636e+\u5956\u52b1\u6a21\u578b\u8bad\u7ec3\u6570\u636e<\/td>\n<td>\u4ec5\u9700\u504f\u597d\u5bf9\uff08&lt;\u597d\u7b54\u6848\uff0c\u574f\u7b54\u6848&gt;\uff09<\/td>\n<\/tr>\n<tr>\n<td>\u8ba1\u7b97\u590d\u6742\u5ea6<\/td>\n<td>\u9ad8\uff08\u9700\u8981\u591a\u6b21\u7b56\u7565-\u5956\u52b1\u6a21\u578b\u4ea4\u4e92\uff09<\/td>\n<td>\u4f4e\uff08\u5355\u9636\u6bb5\u7aef\u5230\u7aef\u8bad\u7ec3\uff09<\/td>\n<\/tr>\n<tr>\n<td>\u7a33\u5b9a\u6027<\/td>\n<td>\u9700\u8c28\u614e\u8c03\u53c2\uff08KL\u60e9\u7f5a\u7cfb\u6570\u7b49\uff09<\/td>\n<td>\u66f4\u9c81\u68d2\uff08\u9690\u5f0f\u7ea6\u675f\u7b56\u7565\u504f\u79bb\uff09<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>\u590d\u6742\u5956\u52b1\u4fe1\u53f7\uff0c\u5982\u6e38\u620fAI<\/td>\n<td>\u660e\u786e\u504f\u597d\u53cd\u9988\uff08\u5982\u5bf9\u8bdd\u8d28\u91cf\u6392\u5e8f\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>vllm\u7684\u63a8\u7406\u52a0\u901f\u662f\u600e\u4e48\u5b9e\u73b0\u7684<\/h3>\n<p>vllm\u662f\u4e00\u4e2a\u9488\u5bf9\u5927\u8bed\u8a00\u6a21\u578b\u63a8\u7406\u4f18\u5316\u7684\u5e93\uff0c\u4e3b\u8981\u901a\u8fc7PageAttention\u3001\u8fde\u7eed\u6279\u5904\u7406\uff08continous batching\uff09\u548c\u9ad8\u6548\u7684\u5185\u5b58\u7ba1\u7406\u6765\u63d0\u5347\u63a8\u7406\u901f\u5ea6\u3002<br \/>\nPageAttention\uff1a\u4f20\u7edf\u6ce8\u610f\u529b\u8ba1\u7b97\u9700\u8981\u9884\u7559\u6700\u5927\u5e8f\u5217\u957f\u5ea6\u5185\u5b58\uff0c\u5bfc\u81f4\u663e\u5b58\u6d6a\u8d39\uff0c\u5982\u7528\u6237\u8f93\u5165\u77ed\u6587\u672c\u65f6\uff0c80%\u7684\u663e\u5b58\u88ab\u95f2\u7f6e\u3002PageAttention\u901a\u8fc7\u5c06key-value\u7f13\u5b58\u5206\u5272\u6210\u5757\uff0c\u7c7b\u4f3c\u5185\u5b58\u5206\u9875\uff0c\u6309\u9700\u52a8\u6001\u5206\u914d\u5185\u5b58\u3002<\/p>\n<h3>\u5927\u6a21\u578b\u5fae\u8c03\u7684\u6d41\u7a0b\u662f\u4ec0\u4e48\u6837\u7684<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/youpaiyun.lingbo.online\/2025\/12\/20251225152843878.png\" alt=\"\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4ec0\u4e48\u8981\u521b\u5efaflash-attention\uff1f \u539f\u59cbself-attention\u7684\u65f6\u95f4\u548c\u7a7a\u95f4\u590d\u6742\u5ea6\u662f\u5e8f\u5217\u957f\u5ea6\u7684\u4e8c\u6b21\u65b9\uff0c\u5f53\u5e8f\u5217\u957f\u5ea6\u8fc7\u957f &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1472","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/lingbo.online\/index.php\/wp-json\/wp\/v2\/posts\/1472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lingbo.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lingbo.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lingbo.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lingbo.online\/index.php\/wp-json\/wp\/v2\/comments?post=1472"}],"version-history":[{"count":8,"href":"https:\/\/lingbo.online\/index.php\/wp-json\/wp\/v2\/posts\/1472\/revisions"}],"predecessor-version":[{"id":1500,"href":"https:\/\/lingbo.online\/index.php\/wp-json\/wp\/v2\/posts\/1472\/revisions\/1500"}],"wp:attachment":[{"href":"https:\/\/lingbo.online\/index.php\/wp-json\/wp\/v2\/media?parent=1472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lingbo.online\/index.php\/wp-json\/wp\/v2\/categories?post=1472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lingbo.online\/index.php\/wp-json\/wp\/v2\/tags?post=1472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}