{"id":24667,"date":"2025-02-20T10:17:07","date_gmt":"2025-02-20T02:17:07","guid":{"rendered":"https:\/\/aif.amtbbs.org\/?p=24667"},"modified":"2025-02-20T10:17:07","modified_gmt":"2025-02-20T02:17:07","slug":"%e4%bb%8e%e5%a4%a7%e6%a8%a1%e5%9e%8b%e6%80%a7%e8%83%bd%e4%bc%98%e5%8c%96%e5%88%b0deepseek%e9%83%a8%e7%bd%b2","status":"publish","type":"post","link":"https:\/\/aif.amtbbs.org\/index.php\/2025\/02\/20\/24667\/","title":{"rendered":"\u4ece\u5927\u6a21\u578b\u6027\u80fd\u4f18\u5316\u5230DeepSeek\u90e8\u7f72"},"content":{"rendered":"<div><img data-dominant-color=\"6f6067\" data-has-transparency=\"false\" style=\"--dominant-color: #6f6067;\" loading=\"lazy\" decoding=\"async\" class=\"not-transparent alignnone size-full wp-image-24669\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/05cdb5b35cbd6ed342751821141401792594c3-300x167-1.jpg\" width=\"300\" height=\"167\" alt=\"\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/05cdb5b35cbd6ed342751821141401792594c3-300x167-1.jpg 300w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/05cdb5b35cbd6ed342751821141401792594c3-300x167-1-150x84.jpg 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/div>\n<div><\/div>\n<div class=\"article-desc\">Deepseek-r1\u6a21\u578b\u7684\u7206\u706b\u6807\u5fd7\u7740\u672c\u5730\u90e8\u7f72\u5927\u6a21\u578b\u7684\u9700\u6c42\u65e5\u76ca\u589e\u957f\u3002\u672c\u6587\u4e3b\u8981\u63a2\u8ba8\u5982\u4f55\u4f18\u5316\u672c\u5730\u90e8\u7f72\u5927\u6a21\u578b\u7684\u6027\u80fd\uff0c\u5e76\u7ed3\u5408\u6211\u4eec\u7684\u5b9e\u8df5\u8fdb\u884c\u8bc4\u6d4b\u5206\u6790\uff0c\u6587\u7ae0\u6700\u540e\u6211\u4eec\u5c06\u5206\u4eab\u5982\u4f55\u5728\u672c\u5730\u9ad8\u6548\u90e8\u7f72\u6ee1\u8840\u7248Deepseek-r1\u5927\u6a21\u578b\u3002<\/div>\n<div id=\"postspictures\" class=\"article-content\">\n<div id=\"container\" class=\"container am-engine\" data-v-1d7a5742=\"\" data-element=\"root\">\n<p><img data-dominant-color=\"6f6067\" data-has-transparency=\"false\" style=\"--dominant-color: #6f6067;\" loading=\"lazy\" decoding=\"async\" class=\"not-transparent alignnone size-full wp-image-24670\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/05cdb5b35cbd6ed342751821141401792594c3-1.jpg\" width=\"800\" height=\"444\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/05cdb5b35cbd6ed342751821141401792594c3-1.jpg 800w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/05cdb5b35cbd6ed342751821141401792594c3-1-300x167.jpg 300w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/05cdb5b35cbd6ed342751821141401792594c3-1-150x83.jpg 150w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/05cdb5b35cbd6ed342751821141401792594c3-1-768x426.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<h2>\u4e00\u3001\u80cc\u666f<\/h2>\n<p>Deepseek-r1\u6a21\u578b\u7684\u7206\u706b\u6807\u5fd7\u7740\u672c\u5730\u90e8\u7f72\u5927\u6a21\u578b\u7684\u9700\u6c42\u65e5\u76ca\u589e\u957f\u3002\u672c\u6587\u4e3b\u8981\u63a2\u8ba8\u5982\u4f55\u4f18\u5316\u672c\u5730\u90e8\u7f72\u5927\u6a21\u578b\u7684\u6027\u80fd\uff0c\u5e76\u7ed3\u5408\u6211\u4eec\u7684\u5b9e\u8df5\u8fdb\u884c\u8bc4\u6d4b\u5206\u6790\uff0c<strong>\u6587\u7ae0\u6700\u540e\u6211\u4eec\u5c06\u5206\u4eab\u5982\u4f55\u5728\u672c\u5730\u9ad8\u6548\u90e8\u7f72\u6ee1\u8840\u7248Deepseek-r1\u5927\u6a21\u578b<\/strong>\u3002<\/p>\n<p>\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u6211\u4eec\u5df2\u90e8\u7f72\u4e13\u7528\u7684\u5927\u6a21\u578b\u63a8\u7406\u96c6\u7fa4\uff0c\u5e76\u5bf9\u5176\u6027\u80fd\u8fdb\u884c\u4e86\u5168\u9762\u4f18\u5316\u3002\u5bf9\u4e8e\u5927\u6a21\u578b\u63a8\u7406\u6765\u8bf4\uff0c\u6027\u80fd\u4f18\u5316\u4e3b\u8981\u805a\u7126\u4e8e\u4e24\u4e2a\u5173\u952e\u6307\u6807\uff1a<strong>\u541e\u5410\u91cf\u4e0e\u54cd\u5e94\u65f6\u95f4(RT)\u3002<\/strong><\/p>\n<ol class=\"list-paddingleft-1\" data-id=\"od678705-7CCWU1YN\">\n<li data-id=\"ld70c578-nNH7uhrT\"><strong>\u541e\u5410\u91cf<\/strong><br \/>\n\u4f20\u7edf\u4e0a\uff0c\u6211\u4eec\u7528\u6bcf\u79d2\u8bf7\u6c42\u6570\uff08QPS\uff09\u6765\u8861\u91cf\u541e\u5410\u91cf\uff0c\u5373\u7cfb\u7edf\u6bcf\u79d2\u80fd\u591f\u5904\u7406\u591a\u5c11\u8bf7\u6c42\u3002\u4f46\u5bf9\u4e8e\u5927\u6a21\u578b\u800c\u8a00\uff0c\u8fd8\u6709\u4e00\u4e2a\u91cd\u8981\u6307\u6807\u2014\u2014\u6bcf\u79d2Token\u6570\uff08token\/s\uff09\uff0c\u5b83\u53cd\u6620\u4e86\u7cfb\u7edf\u6bcf\u79d2\u80fd\u5904\u7406\u7684\u8f93\u5165\u6216\u8f93\u51faToken\u6570\u91cf\u3002<\/li>\n<li data-id=\"ld70c578-DcIz4nfI\"><strong>\u54cd\u5e94\u65f6\u95f4\uff08RT\uff09<\/strong><br \/>\n\u8fd9\u662f\u6307\u7cfb\u7edf\u5904\u7406\u6bcf\u4e2a\u8bf7\u6c42\u6240\u9700\u7684\u65f6\u95f4\u3002\u5bf9\u4e8e\u652f\u6301\u6d41\u5f0f\u8f93\u51fa\u7684\u5927\u6a21\u578b\uff0c\u8fd8\u9700\u8981\u5173\u6ce8\u53e6\u5916\u4e00\u4e2a\u6307\u6807\u2014\u2014\u9996\u4e2aToken\u5230\u8fbe\u65f6\u95f4\uff08TTFT: Time To First Token\uff09\uff0c\u5373\u4ece\u5f00\u59cb\u5904\u7406\u8bf7\u6c42\u5230\u8f93\u51fa\u7b2c\u4e00\u4e2aToken\u6240\u9700\u7684\u65f6\u95f4<\/li>\n<\/ol>\n<p>\u63a5\u4e0b\u6765\u6587\u7ae0\u5c06\u4ecb\u7ecd\u90e8\u7f72\u9ad8\u6027\u80fd\u5927\u6a21\u578b\u63a8\u7406\u670d\u52a1\u7684\u65b9\u6cd5\u4e0e\u601d\u8def\uff0c\u8fd9\u4e9b\u65b9\u6cd5\u4e3b\u8981\u56f4\u7ed5\u63d0\u5347\u541e\u5410\u91cf\u4e0e\u54cd\u5e94\u65f6\u95f4\u8fd9\u4e24\u4e2a\u5173\u952e\u6307\u6807\u5c55\u5f00\u3002<\/p>\n<h2>\u4e8c\u3001\u9ad8\u6027\u80fd\u3001\u6613\u6269\u5c55\u7684\u5927\u6a21\u578b\u63a8\u7406\u6846\u67b6\u662f\u4ec0\u4e48\u6837\u7684<\/h2>\n<p>\u5c3d\u7ba1\u4e1a\u754c\u5df2\u6709\u8bb8\u591a\u7ecf\u5178\u7684\u5927\u6a21\u578b\u63a8\u7406\u6846\u67b6\uff0c\u4f46\u5728\u6df1\u5165\u4e86\u89e3\u8fd9\u4e9b\u6846\u67b6\u4e4b\u524d\uff0c\u6211\u4eec\u4e0d\u59a8\u5148\u601d\u8003\u4e00\u4e0b\uff0c\u5982\u4f55\u8bbe\u8ba1\u4e00\u4e2a\u65e2\u9ad8\u6027\u80fd\u53c8\u6613\u4e8e\u6269\u5c55\u7684\u5927\u6a21\u578b\u63a8\u7406\u6846\u67b6\u3002<\/p>\n<h3>\u5927\u6a21\u578b\u63a8\u7406\u6846\u67b6\u9700\u8981\u6ee1\u8db3\u7684\u57fa\u672c\u6761\u4ef6<\/h3>\n<h4>\u6027\u80fd\u8db3\u591f\u9ad8\u2014\u2014CPU\u4e0eGPU\u5206\u79bb\u8bbe\u8ba1<\/h4>\n<p>\u5bf9\u4e8e\u4e00\u6b3e\u4ee5Python\u4e3a\u4e3b\u7684\u5927\u6a21\u578bGPU\u63a8\u7406\u5f15\u64ce\uff0c\u8981\u5b9e\u73b0\u8f83\u9ad8\u7684\u6027\u80fd\uff0c\u5173\u952e\u5728\u4e8eCPU\u4e0eGPU\u7684\u5206\u79bb\u8bbe\u8ba1\u3002\u81f3\u5c11\u9700\u8981\u5c06\u7cfb\u7edf\u62c6\u5206\u4e3a\u4e24\u4e2a\u8fdb\u7a0b\uff1aCPU\u8fdb\u7a0b\u548cGPU\u8fdb\u7a0b\u3002CPU\u8fdb\u7a0b\u4e3b\u8981\u8d1f\u8d23\u4e0eCPU\u76f8\u5173\u7684\u903b\u8f91\uff0c\u4f8b\u5982\u5e8f\u5217\u5316\u3001\u8c03\u5ea6\u3001\u5206\u53d1\u548cResize\u7b49\uff1b\u800cGPU\u8fdb\u7a0b\u5219\u4e13\u6ce8\u4e8eGPU\u63a8\u7406\u903b\u8f91\uff0c\u5176\u5e95\u5c42\u901a\u8fc7\u76f4\u63a5\u8c03\u7528CUDA\u7b49\u5e93\u6765\u8fdb\u884cGPU\u8fd0\u7b97\u3002<\/p>\n<p>\u76ee\u524d\uff0c\u4e3b\u6d41\u7684\u5927\u6a21\u578b\u63a8\u7406\u6846\u67b6\uff0c\u5982vllm\u4e0esglang\uff0c\u5df2\u7ecf\u5b9e\u73b0\u6216\u6b63\u5728\u5b9e\u65bdCPU\u4e0eGPU\u5206\u79bb\u67b6\u6784\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s2.51cto.com\/oss\/202502\/20\/f4340ae607531cd09ae0773688146aa726e25d.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u90a3\u4e48\uff0cCPU\u4e0eGPU\u5206\u79bb\u7a76\u7adf\u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898\u5462\uff1f<\/p>\n<p>\u4e00\u76f4\u4ee5\u6765\uff0cPython \u5728\u8fd0\u884c\u65f6\u91c7\u7528\u5168\u5c40\u89e3\u91ca\u5668\u9501\uff08GIL\uff09\u673a\u5236\uff0c\u8fd9\u610f\u5473\u7740\u5728\u4efb\u610f\u65f6\u523b\u53ea\u6709\u4e00\u4e2a\u7ebf\u7a0b\u80fd\u591f\u6267\u884c Python \u5b57\u8282\u7801\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u5373\u4f7f\u5728\u591a\u7ebf\u7a0b\u7a0b\u5e8f\u4e2d\uff0c\u5404\u7ebf\u7a0b\u4e5f\u65e0\u6cd5\u5728 Python \u5c42\u9762\u5b9e\u73b0\u771f\u6b63\u7684\u5e76\u884c\u6267\u884c\u3002\u8fd9\u4e2a\u8bbe\u8ba1\u4e3b\u8981\u662f\u4e3a\u4e86\u7b80\u5316\u5185\u5b58\u7ba1\u7406\u548c\u5bf9\u8c61\u5f15\u7528\u8ba1\u6570\uff0c\u4ece\u800c\u4fdd\u8bc1\u7ebf\u7a0b\u5b89\u5168\uff0c\u4f46\u4e5f\u5e26\u6765\u4e86\u4e00\u4e9b\u9650\u5236\uff0c\u7279\u522b\u662f\u5728\u4ee5GPU\u8ba1\u7b97\u4e3a\u4e3b\u7684\u63a8\u7406\u670d\u52a1\u4e2d\u66f4\u4e3a\u660e\u663e\u3002<\/p>\n<p>\u5728\u5355\u4e00\u7684 Python \u8fdb\u7a0b\u4e2d\uff0c\u5982\u679c\u540c\u65f6\u5b58\u5728\u591a\u4e2a CPU \u5bc6\u96c6\u578b\u4efb\u52a1\uff08\u6bd4\u5982\u7f51\u7edc\u8bf7\u6c42\u5904\u7406\u3001\u6570\u636e\u9884\u5904\u7406\u3001\u8bf7\u6c42\u9a8c\u8bc1\u7b49\uff09\u548c GPU \u4efb\u52a1\uff0c\u5b83\u4eec\u90fd\u5fc5\u987b\u5728\u540c\u4e00\u4e2a GIL \u4e0b\u8fd0\u884c\u3002\u8fd9\u6837\uff0cCPU\u5bc6\u96c6\u578b\u4efb\u52a1\u5c31\u4f1a\u4e0eGPU\u4efb\u52a1\u7ade\u4e89 GIL\uff0c\u5bfc\u81f4 GPU kernel \u542f\u52a8\u8c03\u5ea6\u4e0d\u8db3\uff0c\u4ece\u800c\u5f62\u6210\u6027\u80fd\u74f6\u9888\u3002\u8fd9\u79cd\u74f6\u9888\u8868\u73b0\u4e3aGPU\u5229\u7528\u7387\u4e0d\u9ad8\uff0c\u5728\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\uff0cGIL \u7684\u7ade\u4e89\u4f1a\u6781\u5927\u5730\u5f71\u54cd\u7cfb\u7edf\u7684\u54cd\u5e94\u901f\u5ea6\u548c\u541e\u5410\u91cf\u3002<\/p>\n<p>\u4e0b\u8868\u4e3a\u6211\u4eec\u66fe\u7ecf\u9488\u5bf9Python GIL\u9501\u505a\u8fc7\u7684\u4e13\u9879\u5bf9\u6bd4\u6d4b\u8bd5\uff0c\u5728\u505a\u4e86CPU\u4e0eGPU\u5206\u79bb\u8bbe\u8ba1\u540e\uff0cGPU\u5229\u7528\u7387\u5927\u5e45\u63d0\u9ad8\uff0cQPS\u63d0\u5347\u4e867\u500d\uff0cRT\u7f29\u51cf\u4e8650%\u3002<\/p>\n<table class=\"data-table\" data-transient-attributes=\"class\" data-width=\"677px\">\n<colgroup data-id=\"c7104f7d-NYB1W264\">\n<col span=\"1\" width=\"169.25\" data-id=\"cd89ecb0-ZV3ID0aH\" \/>\n<col span=\"1\" width=\"169.25\" data-id=\"cd89ecb0-aj93VCNh\" \/>\n<col span=\"1\" width=\"169.25\" data-id=\"cd89ecb0-EANIBeGT\" \/>\n<col span=\"1\" width=\"169.25\" data-id=\"cd89ecb0-04ockHgH\" \/><\/colgroup>\n<tbody data-id=\"t6d5e859-0Kkai4D4\">\n<tr data-id=\"t31e458f-PUHdMSH9\">\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-FAiCdPHR\" data-transient-attributes=\"table-cell-selection\">\u63a8\u7406\u670d\u52a1\u6846\u67b6\u7c7b\u578b<\/td>\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-CPYIk4bH\" data-transient-attributes=\"table-cell-selection\">QPS<\/td>\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-e7CgO8dm\" data-transient-attributes=\"table-cell-selection\">\u8017\u65f6<\/td>\n<td class=\"table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-IQCMe6Fk\" data-transient-attributes=\"table-cell-selection\">GPU\u4f7f\u7528\u7387<\/td>\n<\/tr>\n<tr data-id=\"t31e458f-WMnCklHM\">\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-7eB7QOM6\" data-transient-attributes=\"table-cell-selection\">\u5355\u8fdb\u7a0b\u8bbe\u8ba1(GPU\u4e0eGPU\u4efb\u52a1\u5206\u5e03\u591a\u4e2a\u7ebf\u7a0b)<\/td>\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-LbpoON8l\" data-transient-attributes=\"table-cell-selection\">4.5<\/td>\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-rs5Hnd6s\" data-transient-attributes=\"table-cell-selection\">1.05s<\/td>\n<td class=\"table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-ae3HDrnl\" data-transient-attributes=\"table-cell-selection\">2%<\/td>\n<\/tr>\n<tr data-id=\"t31e458f-boTcN5dZ\">\n<td class=\"table-last-column\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-E4HPPStY\" data-transient-attributes=\"table-cell-selection\">CPU\u4e0eGPU\u591a\u8fdb\u7a0b\u5206\u79bb\u8bbe\u8ba1<\/td>\n<td class=\"table-last-column\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-ZQT3g6pC\" data-transient-attributes=\"table-cell-selection\">27.43<\/td>\n<td class=\"table-last-column\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-rjCONf6g\" data-transient-attributes=\"table-cell-selection\">437ms<\/td>\n<td class=\"table-last-column table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-UOsxAvrD\" data-transient-attributes=\"table-cell-selection\">12%<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0b\u9762\u662fVLLM\u57280.6\u7248\u672c\u505a\u7684\u6700\u5927\u53d8\u66f4\uff0c\u5373\u505aCPU\u4e0eGPU\u8fdb\u7a0b\u5206\u79bb\u8bbe\u8ba1\uff0c\u5e26\u6765\u4e86\u6027\u80fd\u7684\u5927\u5e45\u63d0\u5347\uff0c\u541e\u5410\u63d0\u5347\u4e862.7\u500d\u3002\u5177\u4f53\u53ef\u4ee5\u53c2\u8003\u6587\u7ae0[1]vLLM v0.6.0: 2.7x Throughput Improvement and 5x Latency Reduction\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s5.51cto.com\/oss\/202502\/20\/5560aca29b5fce1393139670fd12c87502eded.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<h4>\u53ef\u6269\u5c55\u6027\u8db3\u591f\u597d\u2014\u2014\u5404\u6a21\u5757\u9ad8\u5185\u805a\u4f4e\u8026\u5408<\/h4>\n<p>\u4e3a\u4e86\u5b9e\u73b0\u9ad8\u6548\u4e14\u6613\u4e8e\u6269\u5c55\u7684\u8bbe\u8ba1\uff0c\u6211\u4eec\u5e94\u5c06\u7cfb\u7edf\u6309\u7167\u529f\u80fd\u62c6\u5206\u4e3a\u591a\u4e2a\u6a21\u5757\uff0c\u6bcf\u4e2a\u6a21\u5757\u53ea\u8d1f\u8d23\u5176\u7279\u5b9a\u529f\u80fd\uff0c\u786e\u4fdd\u6a21\u5757\u5185\u90e8\u7684\u9ad8\u5185\u805a\u548c\u6a21\u5757\u95f4\u7684\u4f4e\u8026\u5408\u3002\u4e00\u4e2a\u5b8c\u6574\u7684\u5927\u6a21\u578b\u63a8\u7406\u6846\u67b6\u81f3\u5c11\u9700\u8981\u5305\u542b\u4ee5\u4e0b\u56db\u4e2a\u6a21\u5757\uff1a<\/p>\n<ul data-id=\"ueafa794-UOBIFWk8\">\n<li data-id=\"ld70c578-x2O3jO2Q\"><strong>\u63a5\u5165\u5c42<\/strong>\uff1a\u63a5\u5165\u5c42\u8d1f\u8d23\u5904\u7406\u5404\u79cd\u8bf7\u6c42\u3002\u6bd4\u5982\u5f53\u6536\u5230OpenAI\u683c\u5f0f\u7684\u8bf7\u6c42\u65f6\uff0c\u63a5\u5165\u5c42\u5c06\u5176\u8f6c\u5316\u4e3a\u5185\u90e8\u53ef\u8bc6\u522b\u7684\u539f\u59cb\u8bf7\u6c42\uff08raw request\uff09\uff0c\u4ee5\u4fbf\u540e\u7eed\u5176\u4ed6\u6a21\u5757\u7ee7\u7eed\u5904\u7406\u3002<\/li>\n<li data-id=\"ld70c578-tz7SpSzo\"><strong>\u8c03\u5ea6\u5668<\/strong>\uff1a\u8c03\u5ea6\u5668\u8d1f\u8d23\u7ba1\u7406\u548c\u8c03\u5ea6\u5404\u4e2a\u8bf7\u6c42\uff08Request\uff09\u3002\u5f53\u6709\u591a\u4e2a\u5e76\u53d1\u8bf7\u6c42\u65f6\uff0c\u8c03\u5ea6\u5668\u52a8\u6001\u8c03\u6574\u6a21\u578b\u7684\u8f93\u5165\u548c\u8f93\u51fa\uff0c\u4ee5\u786e\u4fdd\u8ba1\u7b97\u8d44\u6e90\u5f97\u5230\u9ad8\u6548\u5229\u7528\uff0c\u540c\u65f6\u6ee1\u8db3\u8c03\u5ea6\u9650\u5236\uff0c\u5982GPU\u7f13\u5b58\u3001\u6700\u5927\u8bf7\u6c42\u6570\u548c\u6700\u5927\u5904\u7406\u957f\u5ea6\u7b49\u3002\u8c03\u5ea6\u5668\u901a\u8fc7\u7ba1\u7406\u8bf7\u6c42\u7684\u72b6\u6001\u3001\u7f13\u5b58\u3001\u4f18\u5148\u7ea7\u548c\u8d44\u6e90\u4f7f\u7528\uff0c\u786e\u4fdd\u63a8\u7406\u8fc7\u7a0b\u6d41\u7545\u8fdb\u884c\u3002<\/li>\n<li data-id=\"ld70c578-fXAKx987\"><strong>\u6a21\u578b\u63a8\u7406<\/strong>\uff1a\u5728\u63a5\u6536\u5230\u8bf7\u6c42\u540e\uff0c\u6a21\u578b\u63a8\u7406\u5c42\u8c03\u7528\u76f8\u5e94\u6a21\u578b\u7684forward\u65b9\u6cd5\u8fdb\u884c\u63a8\u7406\u8ba1\u7b97\u3002\u5176\u5e95\u5c42\u5b9e\u9645\u4e0a\u8c03\u7528CUDA\u7b49\u8fdb\u884cGPU\u63a8\u7406\u3002<\/li>\n<li data-id=\"ld70c578-ADJabp36\"><strong>\u663e\u5b58\u7ba1\u7406<\/strong>\uff1a\u64cd\u4f5c\u7cfb\u7edf\u6709\u7269\u7406\u5185\u5b58\u7ba1\u7406\u673a\u5236\uff0c\u907f\u514d\u4e86\u9891\u7e41\u7533\u8bf7\u548c\u91ca\u653e\u5185\u5b58\u5e26\u6765\u7684\u788e\u7247\u95ee\u9898\u3002\u7136\u800c\uff0cCUDA\u8ba1\u7b97\u4e2d\u5e76\u6ca1\u6709\u663e\u5b58\u7ba1\u7406\u673a\u5236\uff0c\u9891\u7e41\u7684\u663e\u5b58\u7533\u8bf7\u4e0e\u91ca\u653e\u540c\u6837\u4f1a\u5bfc\u81f4\u663e\u5b58\u788e\u7247\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u663e\u5b58\u7ba1\u7406\u6210\u4e3a\u63a8\u7406\u5f15\u64ce\u4e2d\u4e0d\u53ef\u6216\u7f3a\u7684\u6a21\u5757\uff0c\u7528\u4e8e\u89e3\u51b3\u663e\u5b58\u788e\u7247\u95ee\u9898\u3002<\/li>\n<\/ul>\n<h3>\u5927\u6a21\u578b\u63a8\u7406\u6846\u67b6\u8bbe\u8ba1<\/h3>\n<p>\u7efc\u5408\u4e0a\u8ff0\u5185\u5bb9\uff0c\u6211\u4eec\u53ef\u4ee5\u8bbe\u8ba1\u51fa\u4e00\u4e2a\u9ad8\u6027\u80fd\u3001\u53ef\u6269\u5c55\u7684\u5927\u6a21\u578b\u63a8\u7406\u6846\u67b6\u3002\u6846\u67b6\u56fe\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s5.51cto.com\/oss\/202502\/20\/b7a1f976380d7a111e38825f47ea08d0819ed1.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u4ece\u6846\u67b6\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0c\u7cfb\u7edf\u9996\u5148\u88ab\u62c6\u5206\u4e3a\u591a\u4e2a\u8fdb\u7a0b(\u591a\u4e2aCPU\u8fdb\u7a0b\u4e0eGPU\u8fdb\u7a0b)\uff0c\u8fdb\u7a0b\u95f4\u53ef\u901a\u8fc7\u7ba1\u9053\u7b49\u65b9\u5f0f\u8fdb\u884c\u901a\u4fe1\u3002\u6b64\u5916\uff0c\u7cfb\u7edf\u5728\u903b\u8f91\u4e0a\u53c8\u88ab\u62c6\u5206\u4e3a\u591a\u4e2a\u6a21\u5757\uff0c\u5176\u4e2d\u63a5\u5165\u5c42\u3001\u8c03\u5ea6\u5668\u3001\u6a21\u578b\u63a8\u7406\u548c\u663e\u5b58\u7ba1\u7406\u56db\u4e2a\u6a21\u5757\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002<\/p>\n<p>\u8be5\u67b6\u6784\u4e5f\u662f\u5f53\u524dvllm 1.0\u4e0esglang\u7b49\u7ecf\u5178\u63a8\u7406\u6846\u67b6\u7684\u57fa\u7840\u67b6\u6784\u3002\u611f\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u76f8\u5173\u4ee3\u7801\uff0c\u4f60\u4f1a\u53d1\u73b0\u5b83\u4eec\u7684\u8bbe\u8ba1\u601d\u8def\u5927\u81f4\u4e0e\u4e0a\u9762\u76f8\u540c\u3002\u6bd4\u5982\u4e0b\u9762\u7684sglang\u63a8\u7406\u5f15\u64ce\u7684\u4ee3\u7801\uff0c\u53c2\u8003\uff1a[2]sglang \u4ee3\u7801<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s2.51cto.com\/oss\/202502\/20\/08de81e654e609c47a22532cda62a2c7a21c72.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<h2>\u4e09\u3001\u89e3\u51b3\u663e\u5b58\u788e\u7247\u95ee\u9898\uff0c\u5927\u5e45\u63d0\u5347\u541e\u5410\u2014Paged Attention<\/h2>\n<p>\u5728 Linux \u7b49\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\u901a\u5e38\u4e0d\u4f1a\u51fa\u73b0\u5185\u5b58\u788e\u7247\u95ee\u9898\uff0c\u8fd9\u662f\u56e0\u4e3a Linux \u5185\u6838\u62e5\u6709\u5f3a\u5927\u7684\u5185\u5b58\u7ba1\u7406\u673a\u5236\uff0c\u4e13\u95e8\u7528\u4e8e\u89e3\u51b3\u5185\u5b58\u788e\u7247\u95ee\u9898\u3002\u7136\u800c\uff0c\u8fd9\u4e00\u4f18\u52bf\u4ec5\u9002\u7528\u4e8e\u7cfb\u7edf\u5185\u5b58\uff1b\u5982\u679c\u5728 GPU \u4e0a\u9891\u7e41\u7533\u8bf7\u548c\u91ca\u653e\u4e0d\u89c4\u5219\u5927\u5c0f\u7684\u663e\u5b58\uff0c\u5c31\u53ef\u80fd\u5bfc\u81f4\u663e\u5b58\u788e\u7247\u7684\u4ea7\u751f\u3002<\/p>\n<p>\u5728\u5927\u6a21\u578b\u63a8\u7406\u573a\u666f\u4e2d\uff0c\u663e\u5b58\u788e\u7247\u95ee\u9898\u5c24\u4e3a\u4e25\u91cd\u3002\u5927\u90e8\u5206\u63a8\u7406\u8fc7\u7a0b\u90fd\u6d89\u53ca\u6ce8\u610f\u529b\u8ba1\u7b97\uff08Attention\uff09\uff0c\u800c\u6bcf\u6b21\u8ba1\u7b97\u90fd\u9700\u8981\u7533\u8bf7\u5e76\u4f7f\u7528\u4e00\u4e2a\u540d\u4e3a kvcache \u7684\u7f13\u5b58\u3002\u968f\u7740\u8bf7\u6c42\u7684\u4e0d\u65ad\u589e\u52a0\uff0ckvcache \u7684\u5927\u5c0f\u4e0e\u6570\u91cf\u4f1a\u9010\u6b65\u4e0a\u5347\uff0c\u901a\u5e38\u5360\u636e\u603b\u603b\u663e\u5b58\u7684\u7ea6\u4e09\u5206\u4e4b\u4e00\uff0c\u800c\u4e14\u5b83\u4f1a\u88ab\u9891\u7e41\u5730\u88ab\u7533\u8bf7\u548c\u91ca\u653e\u3002\u5982\u679c\u4e0d\u5bf9 kvcache \u4f7f\u7528\u7684 GPU \u663e\u5b58\u8fdb\u884c\u6709\u6548\u7ba1\u7406\uff0c\u663e\u5b58\u788e\u7247\u5c06\u5927\u91cf\u7d2f\u79ef\uff0c\u6700\u7ec8\u53ef\u80fd\u5bfc\u81f4\u7cfb\u7edf\u6027\u80fd\u4e0b\u964d\u751a\u81f3\u5d29\u6e83\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s6.51cto.com\/oss\/202502\/20\/c3bf6a400bceb3c98228828df8661bc49eedce.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e00\u95ee\u9898\uff0cvllm \u63d0\u51fa\u4e86 Paged Attention \u7684\u6982\u5ff5[3]\uff0c\u5176\u8bbe\u8ba1\u601d\u8def\u6b63\u662f\u501f\u9274\u4e86\u64cd\u4f5c\u7cfb\u7edf\u7684\u5185\u5b58\u7ba1\u7406\u673a\u5236\uff0c\u5bf9 kvcache \u7684\u663e\u5b58\u8fdb\u884c\u7edf\u4e00\u7ba1\u7406\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u56de\u987e\u4e00\u4e0b\u64cd\u4f5c\u7cfb\u7edf\u662f\u5982\u4f55\u907f\u514d\u5185\u5b58\u788e\u7247\u7684\u3002\u64cd\u4f5c\u7cfb\u7edf\u901a\u5e38\u5c06\u7269\u7406\u5185\u5b58\u5212\u5206\u4e3a\u82e5\u5e72\u56fa\u5b9a\u5927\u5c0f\u7684\u5757\uff0c\u5e76\u5229\u7528\u9875\u8868\u5c06\u5e94\u7528\u7a0b\u5e8f\u7684\u865a\u62df\u5730\u5740\u6620\u5c04\u5230\u76f8\u5e94\u7684\u7269\u7406\u5185\u5b58\u5757\u3002\u5f53\u5e94\u7528\u7a0b\u5e8f\u7533\u8bf7\u5185\u5b58\u65f6\uff0c\u7cfb\u7edf\u5148\u5206\u914d\u865a\u62df\u5730\u5740\uff0c\u7136\u540e\u5728\u5b9e\u9645\u4f7f\u7528\u65f6\uff0c\u4ece\u56fa\u5b9a\u5927\u5c0f\u7684\u7269\u7406\u5185\u5b58\u5757\u4e2d\u5206\u914d\u7a7a\u95f4\uff0c\u5e76\u5efa\u7acb\u865a\u62df\u5730\u5740\u4e0e\u7269\u7406\u5730\u5740\u4e4b\u95f4\u7684\u6620\u5c04\u3002\u8fd9\u6837\uff0c\u5c31\u80fd\u6709\u6548\u907f\u514d\u5185\u5b58\u788e\u7247\u95ee\u9898\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s5.51cto.com\/oss\/202502\/20\/e325792698dd78705e8910dd0a51afffb271a8.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>Paged Attention \u6b63\u662f\u57fa\u4e8e\u8fd9\u4e00\u539f\u7406\u800c\u63d0\u51fa\u7684\u2014\u2014\u201cPaged\u201d\u4f53\u73b0\u4e86\u7c7b\u4f3c\u9875\u8868\u7684\u6620\u5c04\u65b9\u5f0f\uff0c\u800c\u201cAttention\u201d\u5219\u8868\u793a\u8fd9\u79cd\u6620\u5c04\u673a\u5236\u88ab\u5e94\u7528\u5728\u5927\u6a21\u578b\u6ce8\u610f\u529b\u8ba1\u7b97\u4e2d\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s4.51cto.com\/oss\/202502\/20\/03f529505038c1514e8237028a6eecbcd50443.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>PagedAttention \u5de5\u4f5c\u539f\u7406\uff0c\u56fe\u7247\u6765\u81ea[3] Efficient Memory Management for Large Language Model Serving with PagedAttention\u3002<\/p>\n<p>vllm \u7684 Paged Attention \u662f\u4e00\u79cd\u53d7\u64cd\u4f5c\u7cfb\u7edf\u865a\u62df\u5185\u5b58\u548c\u5206\u9875\u673a\u5236\u542f\u53d1\u7684\u6ce8\u610f\u529b\u7b97\u6cd5\u3002\u5b83\u5c06\u5927\u578b\u8bed\u8a00\u6a21\u578b\u4e2d\u7684 KV Cache \u7f13\u5b58\u5212\u5206\u4e3a\u56fa\u5b9a\u5927\u5c0f\u7684\u5757\uff0c\u8fd9\u4e9b\u5757\u53ef\u4ee5\u5728\u5185\u5b58\u4e2d\u975e\u8fde\u7eed\u5b58\u50a8\u3002\u7136\u540e\u901a\u8fc7Block table(\u7c7b\u4f3cLinux\u9875\u8868)\u628a\u6bcf\u4e2a\u8bf7\u6c42\u7684\u903b\u8f91KV \u5757(\u7c7b\u4f3cLinux\u865a\u62df\u5730\u5740)\u6620\u5c04\u5230\u7269\u7406KV \u5757(\u7c7b\u4f3c\u7269\u7406\u5185\u5b58)\u4e2d\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u6cd5\uff0cPagedAttention \u80fd\u6709\u6548\u7ba1\u7406\u5185\u5b58\uff0c\u51cf\u5c11\u788e\u7247\u548c\u6d6a\u8d39\uff0c\u5927\u5e45\u63d0\u5347\u7cfb\u7edf\u7684\u541e\u5410\u91cf\u3002<\/p>\n<p>Paged Attention\u8bc4\u6d4b\u6548\u679c<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s3.51cto.com\/oss\/202502\/20\/f6351f96609a0d10bf9089e625a3639ec18c3d.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u56fe\u7247\u6765\u81ea[4] vLLM: Easy, Fast, and Cheap LLM Serving with PagedAttention<\/p>\n<p>\u901a\u8fc7\u9ad8\u6548\u7684\u5185\u5b58\u7ba1\u7406\uff0cPaged Attention\u51cf\u5c11\u4e86\u5185\u5b58\u6d6a\u8d39\uff0c\u63d0\u9ad8\u4e86 GPU \u7684\u5229\u7528\u7387\uff0c\u4f7f\u6a21\u578b\u7684\u63a8\u7406\u541e\u5410\u91cf\u6bd4\u4f20\u7edf\u65b9\u6cd5\u63d0\u5347\u4e86\u6570\u500d\u3002\u4f8b\u5982\uff0c\u4e0e HuggingFace Transformers \u76f8\u6bd4\uff0c\u541e\u5410\u91cf\u53ef\u63d0\u5347\u81f3 24 \u500d\uff1b\u4e0e HuggingFace TGI \u76f8\u6bd4\uff0c\u63d0\u5347\u53ef\u8fbe 3.5 \u500d\u3002\u6b64\u5916\uff0c\u5b83\u8fd8\u964d\u4f4e\u4e86\u5185\u5b58\u5f00\u9500\uff0c\u652f\u6301\u66f4\u590d\u6742\u7684\u91c7\u6837\u65b9\u6cd5\uff0c\u4f7f LLM \u670d\u52a1\u53d8\u5f97\u66f4\u5feb\u3001\u66f4\u7ecf\u6d4e\u3002<\/p>\n<p>\u76ee\u524dVLLM\u4e0eSGLang\u7b49\u63a8\u7406\u5f15\u64ce\u9ed8\u8ba4\u652f\u6301Paged Attention\u5f00\u542f\uff0c\u6240\u4ee5\u4f60\u4f7f\u7528\u8fd9\u4e9b\u63a8\u7406\u5f15\u64ce\u90e8\u7f72\u5927\u6a21\u578b\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u652f\u6301\u3002<\/p>\n<h2>\u56db\u3001\u7f13\u5b58\u4e4b\u524d\u8bf7\u6c42\u7684\u8ba1\u7b97\u7ed3\u679c\uff0c\u51cf\u5c11\u91cd\u590d\u8ba1\u7b97\u2014Radix Attention<\/h2>\n<p>\u867d\u7136 Paged Attention \u6210\u529f\u89e3\u51b3\u4e86\u663e\u5b58\u788e\u7247\u95ee\u9898\uff0c\u5e76\u663e\u8457\u63d0\u5347\u4e86\u7cfb\u7edf\u541e\u5410\u91cf\uff0c\u4f46\u5728\u5927\u6a21\u578b\u63a8\u7406\u4e2d\uff0c\u8fd8\u6709\u4e00\u4e2a\u5e38\u89c1\u573a\u666f\u5177\u5907\u8f83\u5927\u6027\u80fd\u4f18\u5316\u7a7a\u95f4\u3002<\/p>\n<p>\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u5f80\u5f80\u9700\u8981\u591a\u6b21\u7ed9\u5927\u6a21\u578b\u53d1\u9001\u8bf7\u6c42\uff0c\u800c\u8fd9\u4e9b\u8bf7\u6c42\u7684Prompt\u4e2d\u6709\u5f88\u5927\u4e00\u90e8\u5206\u7684\u5185\u5bb9\u662f\u5b8c\u5168\u76f8\u540c\u7684\u3002\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s7.51cto.com\/oss\/202502\/20\/c25d05403411fa55a1b082a2bff53d8f0e90f1.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u56fe\u7247\u6765\u81ea[5] Fast and Expressive LLM Inference with RadixAttention and SGLang<\/p>\n<p>\u4e0a\u56fe\u4e2d\u84dd\u8272\u6846\u8868\u793a\u53ef\u5171\u4eab\u7684Prompt\u90e8\u5206\uff0c\u7eff\u8272\u6846\u8868\u793a\u4e0d\u53ef\u5171\u4eab\u7684Prompt\u90e8\u5206\uff0c\u9ec4\u8272\u6846\u8868\u793a\u6a21\u578b\u7684\u8f93\u51fa\u3002<\/p>\n<p>\u4e0a\u56fe\u4e2d\u53ef\u5171\u4eab\u90e8\u5206\u573a\u666f\u5305\u62ec\u5c11\u91cf\u793a\u4f8b\u5b66\u4e60\u3001\u81ea\u6211\u4e00\u81f4\u6027\u4e2d\u7684\u95ee\u9898\u3001\u591a\u8f6e\u5bf9\u8bdd\u4e2d\u7684\u804a\u5929\u5386\u53f2\uff0c\u4ee5\u53ca\u601d\u7ef4\u6811\u4e2d\u7684\u641c\u7d22\u5386\u53f2\u3002\u5728\u8fd9\u4e9b\u573a\u666f\u4e2d\uff0c\u6bcf\u6b21\u8bf7\u6c42\u90fd\u4f1a\u91cd\u590d\u8ba1\u7b97\u8fd9\u4e9bPrompt\u4e2d\u53ef\u5171\u4eab\u7684\u90e8\u5206\uff0c\u8fd9\u4e9b\u4f1a\u9020\u6210\u5927\u91cf\u7684\u8ba1\u7b97\u8d44\u6e90\u6d6a\u8d39\u3002<\/p>\n<p>\u90a3\u4e48\uff0c\u6709\u6ca1\u6709\u529e\u6cd5\u5c06\u8fd9\u4e9b\u91cd\u590d\u90e8\u5206\u7684\u8ba1\u7b97\u7ed3\u679c(KV Cache)\u7f13\u5b58\u8d77\u6765\uff0c\u4e0b\u6b21\u8bf7\u6c42\u65f6\u76f4\u63a5\u4f7f\u7528\u5462\uff1f\u4e3a\u6b64\uff0cSGLang \u63d0\u51fa\u4e86\u4e00\u79cd\u4f18\u79c0\u7684\u7b97\u6cd5\u2014\u2014 Radix Attention\u3002<\/p>\n<p>RadixAttention \u662f\u4e00\u79cd\u65b0\u6280\u672f\uff0c\u7528\u4e8e\u5728\u5927\u8bed\u8a00\u6a21\u578b\u7684\u63a8\u7406\u8fc7\u7a0b\u4e2d\u4f18\u5316 KV \u7f13\u5b58\u7684\u91cd\u7528\u3002\u5176\u6838\u5fc3\u5728\u4e8e\u5229\u7528\u57fa\u6570\u6811\uff08Radix Tree\uff09\u6765\u9ad8\u6548\u7ba1\u7406\u548c\u91cd\u7528\u4e0d\u540c\u8bf7\u6c42\u4e4b\u95f4\u5171\u4eab\u7684\u524d\u7f00\uff0c\u4ece\u800c\u51cf\u5c11\u91cd\u590d\u8ba1\u7b97\u548c\u5185\u5b58\u5360\u7528\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u5f53\u591a\u4e2a\u8bf7\u6c42\u5171\u4eab\u76f8\u540c\u7684\u524d\u7f00\uff08\u4f8b\u5982\u7cfb\u7edf\u63d0\u793a &#8220;You are a helpful assistant&#8221;\uff09\u65f6\uff0cRadixAttention \u53ef\u4ee5\u91cd\u7528\u8be5\u524d\u7f00\u5bf9\u5e94\u7684 KV \u7f13\u5b58\uff0c\u907f\u514d\u91cd\u590d\u8ba1\u7b97\u3002<\/p>\n<p>\u4e0b\u56fe\u4e2d\u7684\u4f8b\u5b50\u5c55\u793a\u4e86 RadixAttention \u5728\u4e5d\u4e2a\u65f6\u95f4\u70b9\u4e0a\u7684\u57fa\u6570\u6811\u52a8\u6001\u6f14\u53d8\u8fc7\u7a0b\uff0c\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\u7684\u89e3\u91ca\uff1a<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s8.51cto.com\/oss\/202502\/20\/d6d61a589d4cf013f84916c69a44f3b74e4ffb.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u56fe\u7247\u6765\u81ea[5] Fast and Expressive LLM Inference with RadixAttention and SGLang<\/p>\n<ol class=\"list-paddingleft-1\" data-id=\"od678705-VIbAdoAH\">\n<li data-id=\"ld70c578-ajjhSsLK\"><strong>\u521d\u59cb\u72b6\u6001\uff1a<\/strong>\u57fa\u6570\u6811\u6700\u521d\u4e3a\u7a7a\u3002<\/li>\n<li data-id=\"ld70c578-HxqQyCyw\"><strong>\u7b2c\u4e00\u573a\u804a\u5929\u5f00\u59cb\uff1a<\/strong>\u7528\u6237\u53d1\u9001\u201c\u4f60\u597d\uff01\u201d\uff0c\u52a9\u624b\u56de\u590d\u201c\u4f60\u597d\uff01\u201d\uff0c\u7cfb\u7edf\u63d0\u793a\u3001\u7528\u6237\u6d88\u606f\u548c\u52a9\u624b\u56de\u590d\u88ab\u5408\u5e76\u4e3a\u57fa\u6570\u6811\u4e2d\u7684\u4e00\u6761\u8fb9\uff0c\u8fde\u63a5\u5230\u65b0\u8282\u70b9\u3002<\/li>\n<li data-id=\"ld70c578-A5EhAMT1\"><strong>\u7b2c\u4e00\u573a\u804a\u5929\u7ee7\u7eed\uff1a<\/strong>\u540c\u4e00\u4f1a\u8bdd\u4e2d\u6536\u5230\u65b0\u6d88\u606f\uff0c\u670d\u52a1\u5668\u5728\u57fa\u6570\u6811\u4e2d\u627e\u5230\u5df2\u6709\u524d\u7f00\u5e76\u91cd\u7528\u5176KV\u7f13\u5b58\uff0c\u65b0\u6d88\u606f\u4f5c\u4e3a\u65b0\u8282\u70b9\u9644\u52a0\u5230\u6811\u4e0a\u3002<\/li>\n<li data-id=\"ld70c578-a9mYzAWq\"><strong>\u7b2c\u4e8c\u573a\u804a\u5929\u5f00\u59cb\uff1a<\/strong>\u53e6\u4e00\u4e2a\u7528\u6237\u5f00\u59cb\u65b0\u7684\u804a\u5929\u4f1a\u8bdd\uff0c\u670d\u52a1\u5668\u5206\u5272\u73b0\u6709\u8282\u70b9\uff0c\u4f7f\u4e24\u4e2a\u4f1a\u8bdd\u5171\u4eab\u516c\u5171\u524d\u7f00\u548cKV\u7f13\u5b58\u3002<\/li>\n<li data-id=\"ld70c578-lGJw9ors\"><strong>\u7b2c\u4e8c\u573a\u804a\u5929\u7ee7\u7eed\u5e76\u8fdb\u884c\u6dd8\u6c70\uff1a<\/strong>\u7b2c\u4e8c\u573a\u804a\u5929\u7ee7\u7eed\uff0c\u56e0\u5185\u5b58\u9650\u5236\uff0c\u7b2c\u4e00\u573a\u804a\u5929\u4e2d\u6700\u5c11\u8fd1\u671f\u4f7f\u7528\u7684\u8282\u70b9\u88ab\u6dd8\u6c70\u91ca\u653e\u7a7a\u95f4\uff0c\u65b0\u6d88\u606f\u5728\u5171\u4eab\u8282\u70b9\u540e\u6dfb\u52a0\u5230\u6811\u4e0a\u3002<\/li>\n<li data-id=\"ld70c578-0xuBmVAX\"><strong>\u5904\u7406\u5c11\u6837\u672c\u5b66\u4e60\u67e5\u8be2\uff1a<\/strong>\u670d\u52a1\u5668\u6536\u5230\u4e0d\u4e0e\u73b0\u6709\u8282\u70b9\u5171\u4eab\u524d\u7f00\u7684\u5c11\u6837\u672c\u5b66\u4e60\u8bf7\u6c42\uff0c\u6839\u8282\u70b9\u88ab\u5206\u5272\u4ee5\u5bb9\u7eb3\u65b0\u5e8f\u5217\uff0c\u8bf7\u6c42\u4f5c\u4e3a\u5355\u72ec\u5206\u652f\u63d2\u5165\u6811\u4e2d\u3002<\/li>\n<li data-id=\"ld70c578-51rmwPGX\"><strong>\u5904\u7406\u4e00\u6279\u5c11\u6837\u672c\u5b66\u4e60\u67e5\u8be2\uff1a<\/strong>\u6536\u5230\u4e00\u6279\u5171\u4eab\u76f8\u540c\u5c11\u6837\u672c\u793a\u4f8b\u7684\u67e5\u8be2\uff0c\u5206\u5272\u7b2c\u516d\u6b65\u7684\u8282\u70b9\u4ee5\u5728\u8fd9\u4e9b\u67e5\u8be2\u95f4\u5b9e\u73b0KV\u7f13\u5b58\u5171\u4eab\uff0c\u6700\u5927\u5316\u91cd\u7528\u5e76\u51cf\u5c11\u5197\u4f59\u8ba1\u7b97\u3002<\/li>\n<li data-id=\"ld70c578-ShLXEL0K\"><strong>\u7b2c\u4e00\u573a\u804a\u5929\u7ee7\u7eed\u5e76\u8fdb\u884c\u6dd8\u6c70\uff1a<\/strong>\u7b2c\u4e00\u573a\u804a\u5929\u7ee7\u7eed\uff0c\u57fa\u4e8e\u6700\u8fd1\u6700\u5c11\u4f7f\u7528\uff08LRU\uff09\u7b56\u7565\uff0c\u6dd8\u6c70\u7b2c\u4e8c\u573a\u804a\u5929\u7684\u8282\u70b9\u4ee5\u9ad8\u6548\u7ba1\u7406\u5185\u5b58\u3002<\/li>\n<li data-id=\"ld70c578-PvewCaT8\"><strong>\u81ea\u4e00\u81f4\u6027\u91c7\u6837\u5e76\u8fdb\u884c\u6dd8\u6c70\uff1a<\/strong>\u670d\u52a1\u5668\u6536\u5230\u751f\u6210\u591a\u4e2a\u7b54\u6848\u7684\u8bf7\u6c42\uff0c\u4e3a\u81ea\u4e00\u81f4\u6027\u76ee\u7684\uff0c\u6309\u7167LRU\u7b56\u7565\u6dd8\u6c70\u8f83\u4e0d\u91cd\u8981\u7684\u8282\u70b9\u4ee5\u4e3a\u65b0\u8bf7\u6c42\u5206\u914d\u5185\u5b58\u3002<\/li>\n<\/ol>\n<p>\u90a3Radix Attention\u5e26\u6765\u7684\u6027\u80fd\u63d0\u5347\u5982\u4f55\u5462\uff1f\u6211\u4eec\u9488\u5bf9SGLang\u63a8\u51fa\u7684Radix Attention\u4e0eVLLM (v0.5.0)\u8fdb\u884c\u4e86\u5bf9\u6bd4\u8bc4\u6d4b\u3002\u540c\u65f6\u7531\u4e8eRadix Attention\u53ef\u4ee5\u590d\u7528\u4e0d\u540c\u8bf7\u6c42\u7684\u4e0a\u4e0b\u6587\uff0c\u8fd9\u4e0e\u6211\u4eec\u7684\u65e5\u5e38\u4e1a\u52a1\u4f7f\u7528\u6bd4\u8f83\u543b\u5408\uff0c\u53d6\u5f97\u4e86\u4e0d\u9519\u7684\u8bc4\u6d4b\u7ed3\u679c\uff0cRadix Attention\u5145\u5206\u5229\u7528\u4e0d\u540c\u8bf7\u6c42\u4e4b\u95f4\u7684\u5171\u4eab\u524d\u7f00\uff0c\u5176\u8017\u65f6\u6bd4VLLM(v0.5.0)\u5feb30%\uff0c\u541e\u5410\u662fVLLM(v0.5.0)\u76841.5\u500d\u3002<\/p>\n<p>\u4e0b\u9762\u4e3aSGLang\u7ed9\u51fa\u7684Radix Attention\u6027\u80fd\u5bf9\u6bd4\u6548\u679c\uff0c\u4e0e\u5f53\u524d\u7cfb\u7edf\u76f8\u6bd4\uff0cSGLang\u541e\u5410\u63d0\u5347\u4e865\u500d\u4ee5\u4e0a\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s3.51cto.com\/oss\/202502\/20\/c24f0cd51946a4130d460286916946b30041aa.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u56fe\u7247\u6765\u81ea[5] Fast and Expressive LLM Inference with RadixAttention and SGLang<\/p>\n<p>\u5982\u679c\u4f60\u4e5f\u60f3\u5c1d\u8bd5\u4e0bRadix Attention\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528SGLang\u7684\u63a8\u7406\u5f15\u64ce\u53bb\u542f\u52a8\u5927\u6a21\u578b\u5c1d\u8bd5\u4e0b\u3002<\/p>\n<h2>\u4e94\u3001\u8bf7\u6c42\u5206\u5757\u5904\u7406\uff0c\u907f\u514d\u5355\u4e2a\u8bf7\u6c42\u5361\u987f \u2014\u2014 Chunked Prefill<\/h2>\n<p>\u5728\u5c06\u5927\u6a21\u578b\u5e94\u7528\u4e8e\u751f\u4ea7\u73af\u5883\u65f6\uff0c\u6211\u4eec\u6709\u65f6\u4f1a\u9047\u5230\u4e00\u79cd\u5947\u602a\u7684\u73b0\u8c61\uff1a\u67d0\u4e2a\u8bf7\u6c42\u7684\u54cd\u5e94\u65f6\u95f4\uff08RT\uff09\u5f02\u5e38\u957f\uff0c\u751a\u81f3\u51fa\u73b0\u5361\u987f\uff0c\u800c\u7cfb\u7edf\u7684\u5e73\u5747\u54cd\u5e94\u65f6\u95f4\u5374\u4f9d\u7136\u6b63\u5e38\u3002\u8fd9\u662f\u4ec0\u4e48\u539f\u56e0\u5bfc\u81f4\u7684\u5462\uff1f\u53c8\u5982\u4f55\u89e3\u51b3\u5462\uff1f<\/p>\n<p>\u5927\u6a21\u578b\u7684\u63a8\u7406\u8fc7\u7a0b\u5b9e\u9645\u4e0a\u53ef\u4ee5\u5206\u4e3a\u4e24\u4e2a\u9636\u6bb5\uff1aprefill \u9636\u6bb5\u548c decode \u9636\u6bb5\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff1a\u5047\u8bbe\u6211\u4eec\u8f93\u5165\u4e86\u4e00\u4e2a\u5305\u542b 1000 \u4e2a token \u7684 prompt\uff0c\u5e76\u5e0c\u671b\u6a21\u578b\u751f\u6210 100 \u4e2a token \u7684\u54cd\u5e94\u3002<\/p>\n<ol class=\"list-paddingleft-1\" data-id=\"od678705-NKJFEOR3\">\n<li data-id=\"ld70c578-JJMqmQzn\"><strong>Prefill \u9636\u6bb5<\/strong>\uff1a\u7cfb\u7edf\u9996\u5148\u5bf9\u8fd9 1000 \u4e2a token \u8fdb\u884c\u5e76\u884c\u63a8\u7406\uff0c\u8fd9\u4e00\u6b65\u9aa4\u53ef\u4ee5\u5145\u5206\u5229\u7528 GPU \u7684\u5e76\u884c\u8ba1\u7b97\u80fd\u529b\u3002<\/li>\n<li data-id=\"ld70c578-0TX6vsD9\"><strong>Decode \u9636\u6bb5<\/strong>\uff1a\u968f\u540e\uff0c\u7cfb\u7edf\u4f1a\u9010\u4e2a\u751f\u6210\u540e\u7eed\u7684 100 \u4e2a token\u3002\u7531\u4e8e\u6bcf\u4e2a\u65b0\u751f\u6210\u7684 token \u90fd\u4f9d\u8d56\u4e8e\u4e4b\u524d\u7684\u8f93\u51fa\uff0c\u56e0\u6b64\u8fd9\u4e00\u9636\u6bb5\u5fc5\u987b\u6309\u987a\u5e8f\u9010\u4e2a\u751f\u6210\u3002<\/li>\n<\/ol>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s5.51cto.com\/oss\/202502\/20\/39d32b010b1833afbb87821db9cdf876a52afe.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u591a\u4e2a\u8bf7\u6c42\u5f80\u5f80\u4f1a\u540c\u65f6\u8fdb\u884c\u63a8\u7406\uff0c\u56e0\u6b64\u53ef\u80fd\u51fa\u73b0\u4e0d\u540c\u8bf7\u6c42\u7684\u9636\u6bb5\u4ea4\u53c9\u8fd0\u884c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8bf7\u6c42 req3 \u7684 prefill \u9636\u6bb5\u5904\u7406\u4e86\u4e00\u4e2a\u975e\u5e38\u957f\u7684 prompt\uff0c\u90a3\u4e48\u5b83\u5c31\u4f1a\u5360\u7528\u5927\u91cf\u7684 GPU \u8d44\u6e90\uff1b\u800c\u5982\u679c\u6b64\u65f6 req13\u7684 prefill \u9636\u6bb5\u4e0e\u8bf7\u6c42 req1\u7684 decode \u9636\u6bb5\u5e76\u884c\u8fd0\u884c\uff0c\u5c31\u4f1a\u5bfc\u81f4 req1\u7684 decode \u9636\u6bb5\u54cd\u5e94\u901f\u5ea6\u660e\u663e\u53d8\u6162\uff0c\u751a\u81f3\u51fa\u73b0\u5361\u987f\u73b0\u8c61\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s3.51cto.com\/oss\/202502\/20\/655fd0f24fbb195ee8a5926af0e22d63f3c913.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u56fe\u7247\u6765\u81ea Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve vLLM @ Fourth Meetup (Public) \uff0c\u8f83\u5927\u7684prompt\u8bf7\u6c42\u4e0edecode\u9636\u6bb5\u8bf7\u6c42\u5e76\u884c\u8c03\u5ea6\uff0c\u7b97\u529b\u8d44\u6e90\u4e89\u62a2\uff0c\u4f1a\u663e\u8457\u5f71\u54cddecode\u9636\u6bb5\u3002<\/p>\n<p>\u95ee\u9898\u539f\u56e0\u660e\u786e\u4e86\uff0c\u89e3\u51b3\u65b9\u6cd5\u4e5f\u5341\u5206\u7b80\u5355\uff1a<strong>\u7f29\u77ed\u6bcf\u6b21\u63d0\u4ea4\u7ed9 GPU \u5e76\u884c\u8ba1\u7b97\u7684 prompt \u957f\u5ea6<\/strong>\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u6574\u4e2a prompt \u6309\u7167\u56fa\u5b9a\u957f\u5ea6\uff08\u4f8b\u5982 512 \u4e2a token\uff09\u8fdb\u884c\u5206\u5757\uff0c\u6bcf\u6b21\u5728 prefill \u9636\u6bb5\u53ea\u5904\u7406\u4e00\u5757\u3002\u8fd9\u6837\u4e00\u6765\uff0c\u6bcf\u6b21\u5e76\u884c\u8ba1\u7b97\u7684\u5185\u5bb9\u5c31\u53d8\u5f97\u66f4\u77ed\uff0c\u4e0d\u4ec5\u80fd\u51cf\u8f7b\u5355\u4e2a\u8bf7\u6c42\u5bf9 GPU \u8d44\u6e90\u7684\u5360\u7528\uff0c\u8fd8\u80fd\u907f\u514d\u5bf9\u540c\u65f6\u8fd0\u884c\u7684 decode \u8bf7\u6c42\u4ea7\u751f\u5f71\u54cd\u3002\u8fd9\u4e2a\u65b9\u6cd5\u4fbf\u88ab\u79f0\u4e3a<strong>\u00a0chunked prefill<\/strong>\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s7.51cto.com\/oss\/202502\/20\/67725a6973aad2d8f25845db552527950d5b47.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s6.51cto.com\/oss\/202502\/20\/f279320588b83ec3db8124992bc46ca1b8f989.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u56fe\u7247\u6765\u81ea Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve vLLM @ Fourth Meetup (Public) \u5f00\u542fchunked prefill\u540e\uff0cprefill\u4e0edecode\u5e76\u884c\u4e92\u4e0d\u5f71\u54cd\u3002<\/p>\n<p>\u5982\u4e0b\u56fe\u6240\u793a\uff0cvllm \u901a\u8fc7\u542f\u7528 chunked prefill \u529f\u80fd\uff0c\u663e\u8457\u964d\u4f4e\u4e86\u7cfb\u7edf\u7684\u6700\u5927\u54cd\u5e94\u65f6\u95f4\uff08max RT\uff09\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s5.51cto.com\/oss\/202502\/20\/321999b202e960c3ed68781f4d5c2c09737211.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u56fe\u7247\u6765\u81ea Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve vLLM @ Fourth Meetup (Public)\uff0c\u5f00\u542fchunked prefill\u540e\uff0c\u5728\u9ad8\u5e76\u53d1QPS\u4e0b\uff0c\u5e73\u5747RT\u63d0\u5347\u4e862\u500d\u3002<\/p>\n<p>\u5728 vllm \u7684\u6700\u65b0\u7248\u672c\u4e2d\uff0cchunked prefill \u5df2\u9ed8\u8ba4\u5f00\u542f\u3002<\/p>\n<h2>\u516d\u3001\u7f29\u77ed\u8f93\u51fa\u957f\u5ea6\uff0c\u663e\u8457\u63d0\u5347\u6027\u80fd<\/h2>\n<p>\u5728\u524d\u6587\u4e2d\uff0c\u6211\u4eec\u63d0\u5230\u8fc7\u5927\u6a21\u578b\u7684\u63a8\u7406\u8fc7\u7a0b\u5206\u4e3a\u00a0<strong>prefill\u00a0<\/strong>\u9636\u6bb5\u548c\u00a0<strong>decode\u00a0<\/strong>\u9636\u6bb5\u3002<strong>Prefill \u9636\u6bb5<\/strong>\u4e3b\u8981\u5bf9 prompt \u8fdb\u884c\u6ce8\u610f\u529b\u8ba1\u7b97\uff0c\u5e76\u53ef\u4ee5\u5e76\u884c\u8fdb\u884c\uff1b\u800c\u00a0<strong>decode \u9636\u6bb5<\/strong>\u5219\u7528\u4e8e\u751f\u6210\u65b0\u8f93\u51fa\u7684 token\uff0c\u8fd9\u4e00\u9636\u6bb5\u5fc5\u987b\u6309\u987a\u5e8f\u9010\u4e2a\u751f\u6210\uff0c\u65e0\u6cd5\u5e76\u884c\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5982\u679c\u6211\u4eec\u80fd\u591f\u5728\u00a0<strong>decode \u9636\u6bb5<\/strong>\u5c3d\u91cf\u51cf\u5c11\u751f\u6210\u7684 token \u603b\u957f\u5ea6\uff0c\u5c31\u80fd\u663e\u8457\u63d0\u9ad8\u6574\u4f53\u7684\u54cd\u5e94\u65f6\u95f4\uff08RT\uff09\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u6bcf\u751f\u6210\u4e00\u4e2a token \u8017\u65f6 5 \u6beb\u79d2\uff0c\u51cf\u5c11 5 \u4e2a token \u7684\u8f93\u51fa\uff0c\u5c31\u80fd\u51cf\u5c11 25 \u6beb\u79d2\u7684\u603b\u54cd\u5e94\u65f6\u95f4\u3002\u5bf9\u4e8e\u975e\u6d41\u5f0f\u8c03\u7528\u7684\u5927\u6a21\u578b\u6765\u8bf4\uff0c\u8fd9\u79cd\u6539\u8fdb\u4f1a\u5e26\u6765\u663e\u8457\u6548\u679c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5927\u6a21\u578b\u53ea\u9700\u8fdb\u884c\u7b80\u5355\u7684\u5206\u7c7b\u6216\u8bc6\u522b\u4efb\u52a1\uff0c\u90a3\u4e48\u4ec5\u9700\u8f93\u51fa\u7ed3\u679c\u5373\u53ef\uff0c\u5176\u4ed6\u65e0\u5173\u4fe1\u606f\u5b8c\u5168\u4e0d\u9700\u8981\u751f\u6210\u3002<\/p>\n<p>\u90a3\u4e48\u5982\u4f55\u7f29\u77ed\u5927\u6a21\u578b\u7684\u8f93\u51fa\u957f\u5ea6\u5462\uff1f<\/p>\n<p>a.\u9650\u5236\u6700\u5927\u8f93\u51fa\u957f\u5ea6<\/p>\n<p>\u9996\u5148\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u7cfb\u7edf\u53c2\u6570\u6765\u9650\u5236\u5927\u6a21\u578b\u7684\u6700\u5927\u8f93\u51fa\u957f\u5ea6\u3002\u5982\u679c\u4f60\u901a\u8fc7 OpenAI \u63a5\u53e3\u8c03\u7528\u5927\u6a21\u578b\uff0c\u5728\u8f93\u5165\u53c2\u6570\u4e2d\u6709\u4e00\u4e2a\u53eb\u505a max tokens \u7684\u8bbe\u7f6e\u9879\u3002\u4f60\u53ef\u4ee5\u8c03\u6574\u8be5\u53c2\u6570\uff0c\u9650\u5236\u5927\u6a21\u578b\u7684\u6700\u5927\u8f93\u51fa\u957f\u5ea6\u3002\u8fd9\u6837\u4e00\u6765\uff0c\u53ef\u4ee5\u907f\u514d\u5927\u6a21\u578b\u4ea7\u751f\u8fc7\u957f\u7684\u8f93\u51fa\uff0c\u751a\u81f3\u9632\u6b62\u65e0\u9650\u5faa\u73af\u7684\u60c5\u51b5\u3002\u4e00\u4e2a\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s4.51cto.com\/oss\/202502\/20\/255a3a187ca0d8b725c3606d0143c032fe0392.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>b.\u901a\u8fc7 Prompt \u9650\u5236\u8f93\u51fa<\/p>\n<p>\u53e6\u5916\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f18\u5316 prompt \u6765\u5f15\u5bfc\u5927\u6a21\u578b\u4ea7\u751f\u66f4\u77ed\u7684\u8f93\u51fa\u3002\u4f8b\u5982\uff0c\u5728 prompt \u4e2d\u52a0\u4e0a\u7c7b\u4f3c\u201c\u8bf7\u76f4\u63a5\u8f93\u51fa\u7ed3\u679c\u201d\u6216\u201c\u8bf7\u5c3d\u53ef\u80fd\u7b80\u77ed\u8f93\u51fa\u7ed3\u679c\u201d\u7684\u63d0\u793a\u8bed\uff0c\u53ef\u4ee5\u6709\u6548\u51cf\u5c11\u65e0\u5173\u5185\u5bb9\u7684\u8f93\u51fa\u3002<\/p>\n<p>c.\u5fae\u8c03\u5927\u6a21\u578b<\/p>\n<p>\u5982\u679c\u6761\u4ef6\u5141\u8bb8\uff0c\u5fae\u8c03\u5927\u6a21\u578b\u4e5f\u662f\u4e00\u79cd\u6709\u6548\u7684\u65b9\u6cd5\u3002\u901a\u8fc7\u5fae\u8c03\uff0c\u53ef\u4ee5\u8ba9\u5927\u6a21\u578b\u5728\u6ee1\u8db3\u9700\u6c42\u7684\u524d\u63d0\u4e0b\u5c3d\u91cf\u7f29\u77ed\u8f93\u51fa\u3002\u5fae\u8c03\u7684\u8fc7\u7a0b\u4e2d\uff0c\u9996\u5148\u53ef\u4ee5\u901a\u8fc7 prompt \u8c03\u6574\u8f93\u51fa\u957f\u5ea6\uff0c\u5236\u9020\u5927\u91cf\u6570\u636e\u540e\uff0c\u518d\u5bf9\u5927\u6a21\u578b\u8fdb\u884c\u8bad\u7ec3\u3002\u8fd9\u6837\u4e00\u6765\uff0c\u4e0d\u4ec5\u8f93\u5165\u7684\u5185\u5bb9\u88ab\u4f18\u5316\uff0c\u8f93\u51fa\u7684\u957f\u5ea6\u4e5f\u80fd\u6709\u6548\u7f29\u77ed\uff0c\u8fbe\u5230\u66f4\u597d\u7684\u6548\u679c\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s5.51cto.com\/oss\/202502\/20\/e4743e908fd149f5aa5749e3bbe9a5dfd44ad1.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p><strong>\u4e03\u3001<\/strong><strong>\u4f7f\u7528\u591a\u5361\u63a8\u7406\uff0c\u63a8\u7406\u901f\u5ea6\u7ffb\u500d<\/strong><\/p>\n<p>\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0c\u51fa\u4e8e\u6a21\u578b\u6548\u679c\u8003\u8651\u65e0\u6cd5\u5bf9\u5927\u6a21\u578b\u8fdb\u884c\u91cf\u5316\uff0c\u4f46\u5bf9\u54cd\u5e94\u65f6\u95f4\uff08RT\uff09\u6709\u975e\u5e38\u9ad8\u7684\u8981\u6c42\u3002\u8fd9\u65f6\uff0c\u5c1d\u8bd5\u00a0<strong>\u591a\u5361\u63a8\u7406\u00a0<\/strong>\u53ef\u4ee5\u5e26\u6765\u7acb\u7aff\u89c1\u5f71\u7684\u6548\u679c\uff0c\u901a\u5e38\u80fd\u591f\u5c06 RT \u7f29\u77ed\u81f3\u539f\u6765\u7684 1\/3 \u6216 1\/2\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u6211\u4eec\u9488\u5bf9<strong>\u00a0\u5355\u5361<\/strong>\u00a0\u4e0e<strong>\u00a0\u53cc\u5361<\/strong>\u00a0\u63a8\u7406\u6027\u80fd\u7684\u5bf9\u6bd4\u6d4b\u8bd5\u7ed3\u679c\uff1a<\/p>\n<table class=\"data-table\" data-transient-attributes=\"class\" data-width=\"677px\">\n<colgroup data-id=\"c7104f7d-I9kQa1iZ\">\n<col span=\"1\" width=\"225.656\" data-id=\"cd89ecb0-Bc9ZRoID\" \/>\n<col span=\"1\" width=\"225.656\" data-id=\"cd89ecb0-f5LGU6Jo\" \/>\n<col span=\"1\" width=\"225.688\" data-id=\"cd89ecb0-jZKqGk4N\" \/><\/colgroup>\n<tbody data-id=\"t6d5e859-eQj57SgL\">\n<tr data-id=\"t31e458f-S3Q7GTRB\">\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-pdw12EF6\" data-transient-attributes=\"table-cell-selection\">\u573a\u666f<\/td>\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-qjs5Kyno\" data-transient-attributes=\"table-cell-selection\">RT<\/td>\n<td class=\"table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-Gk3WZvch\" data-transient-attributes=\"table-cell-selection\">QPS<\/td>\n<\/tr>\n<tr data-id=\"t31e458f-JqkhPLLc\">\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-N4AYic1N\" data-transient-attributes=\"table-cell-selection\">\u5355\u5361\u5927\u6a21\u578b\u63a8\u7406<\/td>\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-iATKDidy\" data-transient-attributes=\"table-cell-selection\">3s<\/td>\n<td class=\"table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-0WIZRfET\" data-transient-attributes=\"table-cell-selection\">1.2<\/td>\n<\/tr>\n<tr data-id=\"t31e458f-DjD7fMiq\">\n<td class=\"table-last-column\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-oBvmpdzU\" data-transient-attributes=\"table-cell-selection\">\u53cc\u5361\u5927\u6a21\u578b\u63a8\u7406<\/td>\n<td class=\"table-last-column\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-sGl3vcHB\" data-transient-attributes=\"table-cell-selection\">1.7s<\/td>\n<td class=\"table-last-column table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-1nuo3Kgk\" data-transient-attributes=\"table-cell-selection\">2.4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53ef\u89c1\u63a8\u7406\u4e2d\u5355\u5361\u53d8\u53cc\u5361\u53ef\u4ee5\u663e\u8457\u63d0\u5347\u5927\u6a21\u578b\u63a8\u7406\u901f\u5ea6\u4e0eQPS\u3002<\/p>\n<p>\u90a3\u4e3a\u4ec0\u4e48\u591a\u5361\u53ef\u4ee5\u63d0\u5347\u5927\u6a21\u578b\u7684\u63a8\u7406\u901f\u5ea6\u5462\uff1f\u4e3b\u8981\u539f\u56e0\u591a\u5361\u63a8\u7406\u7684\u4f18\u5316\u662f\u901a\u8fc7\u00a0<strong>tensor parallelism<\/strong>\uff08\u5f20\u91cf\u5e76\u884c\uff09\u5b9e\u73b0\u7684\u3002<\/p>\n<p>\u5047\u8bbe\u4f60\u5c06<strong>\u00a0tensor parallel\u00a0<\/strong>\u8bbe\u7f6e\u4e3a 2\uff0c\u610f\u5473\u7740\u4f7f\u7528\u4e24\u5f20 GPU \u6765\u52a0\u901f\u63a8\u7406\u3002\u5728\u6a21\u578b\u52a0\u8f7d\u65f6\uff0c\u63a8\u7406\u5f15\u64ce\u4f1a\u5c06\u5927\u6a21\u578b\u7684 attention \u53c2\u6570\u7684\u6570\u91cf\u5206\u4e3a\u4e24\u7ec4\uff0c\u5206\u522b\u52a0\u8f7d\u5230\u6bcf\u5f20 GPU \u4e0a\u3002\u7136\u540e\uff0c\u5728\u63a8\u7406\u8fc7\u7a0b\u4e2d\uff0c\u4e24\u4e2a GPU \u4f1a\u5e76\u884c\u8ba1\u7b97\u6ce8\u610f\u529b\uff0c\u6700\u540e\u518d\u5c06\u7ed3\u679c\u805a\u5408\u5408\u5e76\u3002<\/p>\n<p>\u60f3\u8c61\u4e00\u4e0b\uff0c\u4f60\u6709\u4e00\u672c\u975e\u5e38\u539a\u7684\u4e66\uff0c\u4f60\u60f3\u4e00\u6b21\u6027\u590d\u5370\u6574\u672c\u4e66\uff0c\u4f46\u662f\u4f60\u7684\u590d\u5370\u673a\u4e00\u6b21\u53ea\u80fd\u590d\u5370\u51e0\u9875\u3002\u8fd9\u65f6\uff0c\u4f60\u53ef\u4ee5\u628a\u8fd9\u672c\u4e66\u5206\u6210\u51e0\u4e2a\u90e8\u5206\uff0c\u6bcf\u4e2a\u90e8\u5206\u5206\u522b\u590d\u5370\uff0c\u6700\u540e\u518d\u628a\u6240\u6709\u590d\u5370\u597d\u7684\u90e8\u5206\u6309\u987a\u5e8f\u62fc\u63a5\u8d77\u6765\uff0c\u8fd9\u6837\u5c31\u5b8c\u6210\u4e86\u6574\u672c\u4e66\u7684\u590d\u5370\u3002<\/p>\n<p>\u5728\u5f20\u91cf\u5e76\u884c\u4e2d\uff0c\u6211\u4eec\u8981\u5904\u7406\u7684\u5927\u6a21\u578b\u5c31\u50cf\u662f\u90a3\u672c\u539a\u4e66\uff0c\u800cGPU\u5219\u50cf\u662f\u590d\u5370\u673a\u3002\u56e0\u4e3a\u5355\u4e2aGPU\u65e0\u6cd5\u4e00\u6b21\u5904\u7406\u6574\u4e2a\u5927\u6a21\u578b\uff0c\u6211\u4eec\u5c31\u9700\u8981\u628a\u6a21\u578b\uff08\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\u662f\u6743\u91cd\u5f20\u91cf\uff09\u5206\u6210\u51e0\u4e2a\u90e8\u5206\uff0c\u8ba9\u4e0d\u540c\u7684GPU\u5206\u522b\u5904\u7406\uff08\u76f8\u5f53\u4e8e\u590d\u5370\u4e66\u7684\u4e0d\u540c\u90e8\u5206\uff09\u3002\u5728\u5904\u7406\u8f93\u5165\u6570\u636e\u65f6\uff0c\u5c31\u50cf\u662f\u628a\u4e66\u7684\u6bcf\u4e00\u9875\u5206\u522b\u590d\u5370\uff0c\u7136\u540e\u518d\u628a\u590d\u5370\u597d\u7684\u5404\u4e2a\u90e8\u5206\u62fc\u63a5\u8d77\u6765\uff0c\u5f62\u6210\u5b8c\u6574\u7684\u8f93\u51fa\u7ed3\u679c\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s2.51cto.com\/oss\/202502\/20\/a70fcae2965ee0ed5e49888a7e8cd6b91c1487.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u5982\u4f55\u914d\u7f6etensor parell\u5e76\u884c\u5462\uff1f\u4e0b\u9762\u6211\u4eec\u5206\u522b\u7ed9\u51favllm \u4e0esglang\u4e24\u6b3e\u5927\u6a21\u578b\u7684\u914d\u7f6e\u65b9\u5f0f\u3002<\/p>\n<p><strong>1.vllm\u914d\u7f6e\u591a\u5361\u63a8\u7406<\/strong><\/p>\n<p>\u4ee5\u4e0b\u547d\u4ee4\u4e3avllm\u5982\u4f55\u914d\u7f6e\u591a\u5361\u63a8\u7406\u7684\u65b9\u5f0f\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s7.51cto.com\/oss\/202502\/20\/533e58d736b575f5e6d095fdf174ace5a9cf31.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u56fe\u7247\u6765\u81ea[6] vllm Documentation<\/p>\n<p><strong>2.SGLang\u914d\u7f6e\u591a\u5361\u63a8\u7406<\/strong><\/p>\n<p>\u4ee5\u4e3a\u547d\u4ee4\u4e3aSGLang\u63a8\u7406\u670d\u52a1\u5982\u4f55\u914d\u7f6e\u591a\u5361\u63a8\u7406\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s4.51cto.com\/oss\/202502\/20\/46fcb8611039f37050c768454cc579644714a9.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<h2>\u516b\u3001\u5c0f\u6a21\u578b\u63a8\u7406+\u5927\u6a21\u578b\u9a8c\u8bc1 \u2014\u2014 \u9884\u6d4b\u89e3\u7801 (Speculative Decoding)<\/h2>\n<p>\u6700\u8fd1\uff0c\u4e00\u79cd\u540d\u4e3a<strong>\u9884\u6d4b\u89e3\u7801<\/strong>\u7684\u52a0\u901f\u6280\u672f\u5907\u53d7\u5173\u6ce8\uff0c\u5b83\u80fd\u591f\u5728\u7279\u5b9a\u6761\u4ef6\u4e0b\u663e\u8457\u63d0\u5347\u5927\u578b\u6a21\u578b\uff08\u598272B\u5927\u6a21\u578b\uff09\u7684\u63a8\u7406\u901f\u5ea6\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s7.51cto.com\/oss\/202502\/20\/c7344dd7021c399fd3f6755d2a0f98266f2f83.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u9884\u6d4b\u89e3\u7801\u5de5\u4f5c\u539f\u7406\u6bd4\u8f83\u7b80\u5355\uff0c\u5047\u5982\u4f60\u60f3\u52a0\u901f\u4e00\u4e2a70b\u5927\u6a21\u578b\u3002\u4f60\u53ef\u4ee5\u8bad\u7ec3\u4e00\u4e2a\u540c\u7c7b\u578b\u76847b\u5c0f\u6a21\u578b\uff0c\u7136\u540e\u5f00\u542f\u9884\u6d4b\u89e3\u7801\u3002\u7cfb\u7edf\u540c\u65f6\u52a0\u8f7d7b\u5c0f\u6a21\u578b\u4e0e70b\u5927\u6a21\u578b\uff0c\u5728\u63a8\u7406\u7684\u65f6\u5019\u5148\u8ba97b\u5c0f\u6a21\u578b\u505a\u8f93\u51fa\uff0c\u6bd4\u5982\u8f93\u51fa5\u4e2atoken\u3002\u7136\u540e\u518d\u628a\u8fd95\u4e2atoken\u4ea4\u7ed970b\u5927\u6a21\u578b\u53bb\u505a\u9a8c\u8bc1\uff0c\u5e76\u4fdd\u7559\u9a8c\u8bc1\u6b63\u786e\u7684\u524dN\u4e2atoken\u505a\u4e3a\u8f93\u51fa\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002<\/p>\n<p>\u7531\u4e8e\u9a8c\u8bc1\u662f\u53ef\u4ee5\u6279\u91cf\u8fdb\u884c\u7684\uff0c\u800c\u5c0f\u6a21\u578b\u7684\u63a8\u7406\u901f\u5ea6\u53c8\u6bd4\u8f83\u5feb\u3002\u8fd9\u6837\u5c31\u53ef\u4ee5\u5927\u5927\u63d0\u534770b\u5927\u6a21\u578b\u7684\u63a8\u7406\u901f\u5ea6\uff0c\u540c\u65f6\u4fdd\u969c70b\u5927\u6a21\u578b\u7684\u6548\u679c\u3002<\/p>\n<p>\u4ee5\u4e0b\u4e3a\u6211\u4eec\u9488\u5bf970b\u6a21\u578b\u6240\u505a\u7684\u5b9e\u9a8c\u6548\u679c\u3002<\/p>\n<table class=\"data-table\" data-transient-attributes=\"class\" data-width=\"677px\">\n<colgroup data-id=\"c7104f7d-iOak1I07\">\n<col span=\"1\" width=\"338.5\" data-id=\"cd89ecb0-cW6gQjUO\" \/>\n<col span=\"1\" width=\"338.5\" data-id=\"cd89ecb0-LQYFZk2U\" \/><\/colgroup>\n<tbody data-id=\"t6d5e859-dhXTZokb\">\n<tr data-id=\"t31e458f-sjY2cHko\">\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-ywC2JAgL\" data-transient-attributes=\"table-cell-selection\">\u63a8\u7406\u65b9\u6cd5<\/td>\n<td class=\"table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-qldpsU3q\" data-transient-attributes=\"table-cell-selection\">RT<\/td>\n<\/tr>\n<tr data-id=\"t31e458f-WRZG7pZi\">\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-xUj4acFm\" data-transient-attributes=\"table-cell-selection\">70B\u5927\u6a21\u578b<\/td>\n<td class=\"table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-J7i4oqPD\" data-transient-attributes=\"table-cell-selection\">11s<\/td>\n<\/tr>\n<tr data-id=\"t31e458f-4udhfYEK\">\n<td class=\"table-last-column\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-7ct2aKJ5\" data-transient-attributes=\"table-cell-selection\">70B\u5927\u6a21\u578b+7B\u5c0f\u6a21\u578b<\/p>\n<p>\u9884\u6d4b\u89e3\u7801<\/td>\n<td class=\"table-last-column table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-hpSwtAdt\" data-transient-attributes=\"table-cell-selection\">2.8s<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53ef\u89c1\u9884\u6d4b\u89e3\u7801\u5728\u4e00\u5b9a\u7684\u573a\u666f\u4e0b\u53ef\u4ee5\u63d0\u5347\u5927\u6a21\u578b\u7684\u63a8\u7406\u901f\u5ea6\u3002<\/p>\n<p>\u6b64\u5916\u8fd8\u6709\u4e00\u79cd\u66f4\u7b80\u5355\u7684\u65b9\u5f0f\uff0c\u5982\u679c\u4f60\u4e0d\u60f3\u8bad\u7ec37b\u7684\u5c0f\u6a21\u578b\uff0c\u800c\u4f60\u7684\u8f93\u51fa\u4e2d\u5927\u90e8\u5206\u90fd\u4e0e\u8f93\u5165promt\u76f8\u4f3c\uff0c\u6bd4\u5982\u4f60\u53ea\u662f\u8ba9\u5927\u6a21\u578b\u5e2e\u4f60\u4fee\u6539\u4e0b\u6587\u7ae0\u4e2d\u9519\u522b\u5b57\u3002\u90a3\u4e48\u4f60\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528n-gram\u5339\u914dprompt\u7684\u65b9\u6cd5\u66ff\u4ee3\u5c0f\u6a21\u578b\uff0c\u5373\u76f4\u63a5\u4ece\u8f93\u5165prompt\u4e2d\u9009\u53d6\u9884\u6d4b\u7684token\uff0c\u8ba9\u5927\u6a21\u578b\u76f4\u63a5\u53bb\u9a8c\u8bc1\u3002\u8fd9\u6837\u8f93\u51fa\u901f\u5ea6\u66f4\u5feb\uff0c\u66f4\u7b80\u5355\u3002<\/p>\n<p>\u5173\u4e8e\u9884\u6d4b\u89e3\u7801\uff0c\u60f3\u6df1\u5165\u4e86\u89e3\u7684\u540c\u5b66\u53ef\u4ee5\u53c2\u8003vllm\u7684\u8fd9\u7bc7\u6587\u6863\u3002[8] How Speculative Decoding Boosts vLLM Performance by up to 2.8x<\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u4ecb\u7ecd\u4e0b\u5982\u4f55\u5728vllm\u4e2d\u914d\u7f6e\u9884\u6d4b\u89e3\u7801\u3002<\/p>\n<p><strong>a.\u4f7f\u7528\u5927\u6a21\u578b+\u5c0f\u6a21\u578b\u7684\u65b9\u5f0f<\/strong><\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s8.51cto.com\/oss\/202502\/20\/5872bca82f1d178527d853af42e3f82f36a871.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p><strong>b.\u4f7f\u7528n-gram\u7684\u65b9\u5f0f<\/strong><\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s9.51cto.com\/oss\/202502\/20\/62098a929795aa1deb64917ef15be3942da95d.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<h2>\u4e5d\u3001\u9ad8\u6548\u90e8\u7f72Deepseek-R1\u6a21\u578b\u7684\u65b9\u6cd5<\/h2>\n<p>\u524d\u9762\u6211\u4eec\u4ecb\u7ecd\u4e86\u4e1a\u754c\u5927\u6a21\u578b\u6027\u80fd\u4f18\u5316\u7684\u5f88\u591a\u65b9\u6cd5\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u5c06\u7528SGLang\u8fd9\u4e2a\u63a8\u7406\u5f15\u64ce\u6765\u90e8\u7f72\u4e0b\u6700\u8fd1\u7206\u706bDeepseek-R1\u6ee1\u8840\u7248\u5927\u6a21\u578b\u3002\u4e0b\u9762\u5206\u4eab\u4e0b\u8be6\u7ec6\u7684\u90e8\u7f72\u6b65\u9aa4\u3002<\/p>\n<p><strong>a.\u5982\u4f55\u4e0b\u8f7dDeepseek-r1<\/strong><\/p>\n<p>\u8fd9\u6b21Deepseek\u53d1\u5e03\u4e86\u4e00\u7cfb\u5217\u6a21\u578b\uff0c\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s9.51cto.com\/oss\/202502\/20\/2702e534685ade451ae58863357a1b0be7c70f.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s4.51cto.com\/oss\/202502\/20\/b2125c0639ef857da59474e5e86eea2a389242.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<p>\u539f\u59cb\u6a21\u578b\u5305\u62ecDeepseek-r1-zero\u4e0eDeepseek-r1\uff0c\u5176\u4e2dDeepseek-r1\u662f\u5b98\u65b9\u63a8\u8350\u7684\u7ecf\u8fc7\u591a\u9636\u6bb5\u8bad\u7ec3\u7684\u6700\u4f18\u6a21\u578b\u3002\u4f46\u662fDeepseek-r1\u6709671B\u5927\u5c0f\u7684\u53c2\u6570\uff0c\u90e8\u7f72\u8d77\u6765\u81f3\u5c11\u9700\u89812*8H20GPU\uff0c\u6bd4\u8f83\u8017\u8d39\u8d44\u6e90\u3002\u6240\u4ee5deepseek\u56e2\u961f\u53c8\u57fa\u4e8eDeepseek-r1\u84b8\u998f\u51fa\u4e86\u4e00\u7cfb\u5217\u5c0f\u7684\u6a21\u578b\uff0c\u5176\u4e2d\u6548\u679c\u4e0d\u9519\u6bd4\u5982DeepSeek-R1-Distill-Qwen-32B\uff0c\u5355\u5361H20\u53ef\u4ee5\u8fd0\u884c\u542f\u52a8\u3002<\/p>\n<p>\u6211\u4eec\u8fd9\u91cc\u53ea\u4ecb\u7ecd\u6ee1\u8840\u7248Deepseek-r1\u7684\u90e8\u7f72\u65b9\u6cd5\u3002<\/p>\n<p><strong>b.\u51c6\u5907\u90e8\u7f72\u73af\u5883<\/strong><\/p>\n<p>\u6211\u4eec\u5c1d\u8bd5\u4f7f\u7528SGLang\u8fd9\u4e2a\u5927\u6a21\u578b\u63a8\u7406\u5f15\u64ce\u90e8\u7f72Deepseek-r1\u3002\u4ee5\u4e0b\u4e3a\u6211\u4eec\u7684\u90e8\u7f72\u8f6f\u786c\u4ef6\u73af\u5883\u51c6\u5907\u3002<\/p>\n<table class=\"data-table\" data-transient-attributes=\"class\" data-width=\"677px\">\n<colgroup data-id=\"c7104f7d-opA7184U\">\n<col span=\"1\" width=\"225.656\" data-id=\"cd89ecb0-KkG7S4A2\" \/>\n<col span=\"1\" width=\"225.656\" data-id=\"cd89ecb0-hpUCnL6M\" \/>\n<col span=\"1\" width=\"225.688\" data-id=\"cd89ecb0-ctrFCNKT\" \/><\/colgroup>\n<tbody data-id=\"t6d5e859-EHVeCahd\">\n<tr data-id=\"t31e458f-XFokRhMG\">\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-qVmdW2Hh\" data-transient-attributes=\"table-cell-selection\">GPU<\/td>\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-uDBsn2L5\" data-transient-attributes=\"table-cell-selection\">2*8*H20<\/td>\n<td class=\"table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-gnKkEDL9\" data-transient-attributes=\"table-cell-selection\">IP\uff1a10.0.0.1\u4e0e10.0.0.2<\/td>\n<\/tr>\n<tr data-id=\"t31e458f-Dk5NJOGK\">\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-aUWllaOV\" data-transient-attributes=\"table-cell-selection\">\u63a8\u7406\u5f15\u64ce<\/td>\n<td colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-xEiajUgn\" data-transient-attributes=\"table-cell-selection\">SGLang<\/td>\n<td class=\"table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-JJLqTDNI\" data-transient-attributes=\"table-cell-selection\">\u5b89\u88c5\u65b9\u5f0f\u53c2\u8003\uff1ahttps:\/\/docs.sglang.ai\/start\/install.html<\/td>\n<\/tr>\n<tr data-id=\"t31e458f-Y3Gi8qc5\">\n<td class=\"table-last-column\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-IgeINjlv\" data-transient-attributes=\"table-cell-selection\">\u5927\u6a21\u578b<\/td>\n<td class=\"table-last-column\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-zT9G055l\" data-transient-attributes=\"table-cell-selection\">deepseek-r1<\/p>\n<p>\u6ee1\u8840\u7248<\/td>\n<td class=\"table-last-column table-last-row\" colspan=\"1\" rowspan=\"1\" data-id=\"ta6dfff9-OkREaauM\" data-transient-attributes=\"table-cell-selection\">\u4e0b\u8f7d\u5730\u5740\uff1ahttps:\/\/modelscope.cn\/models<\/p>\n<p>\/deepseek-ai\/DeepSeek-R1\/<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u90e8\u7f72Deepseek-r1<\/p>\n<p>\u51c6\u5907\u597dSGLang\u955c\u50cf\uff0cdeepseek-r1\u6a21\u578b\uff0cGPU\u540e\uff0c\u53ef\u4ee5\u6309\u7167\u5982\u4e0b\u547d\u4ee4\u542f\u52a8deepseek-r1<\/p>\n<p>node 1\uff1a<\/p>\n<p>python -m sglang.launch_server &#8211;model-path deepseek-ai\/DeepSeek-V3 &#8211;tp 16 &#8211;dist-init-addr 10.0.0.1:5000 &#8211;nnodes 2 &#8211;node-rank 0 &#8211;trust-remote-code<\/p>\n<p>node 2\uff1a<\/p>\n<p>python -m sglang.launch_server &#8211;model-path deepseek-ai\/DeepSeek-V3 &#8211;tp 16 &#8211;dist-init-addr 10.0.0.1:5000 &#8211;nnodes 2 &#8211;node-rank 1 &#8211;trust-remote-code<\/p>\n<p>\u8fd9\u91cc\u4f7f\u7528\u7684\u662f\u591a\u673a\u591a\u5361\u90e8\u7f72\uff0c\u90e8\u7f72\u540e\u4f7f\u7528Openai\u683c\u5f0f\u8bf7\u6c42\u53d1\u9001\u5230node1\u4e0a\u5373\u53ef\u3002<\/p>\n<p><img decoding=\"async\" title=\"\u56fe\u7247\" src=\"https:\/\/s7.51cto.com\/oss\/202502\/20\/03182a416bf5b98fa1a724e1f8cf3cac3e0f4b.webp\" alt=\"\u56fe\u7247\" data-type=\"inline\" \/><\/p>\n<h2>\u5341\u3001\u603b\u7ed3<\/h2>\n<p>\u6587\u7ae0\u4f9d\u6b21\u603b\u7ed3\u4e86\u90e8\u7f72\u9ad8\u6027\u80fd\u5927\u6a21\u578b\u63a8\u7406\u670d\u52a1\u7684\u6280\u5de7\u4e0e\u5b9e\u8df5\uff0c\u5148\u540e\u4ecb\u7ecd\u4e86Paged Attention\uff0cRadix Attention\uff0cchunked prefill\uff0c\u591a\u5361\u5e76\u884c\u7b49\u5927\u6a21\u578b\u63a8\u7406\u52a0\u901f\u65b9\u6cd5\uff0c\u5e76\u7ed9\u51fa\u9a8c\u8bc1\u7ed3\u679c\u4e0e\u64cd\u4f5c\u65b9\u6cd5\u3002\u6587\u7ae0\u6700\u540e\u8fd8\u7ed9\u51fa\u6700\u8fd1\u7206\u706b\u7684deepseek-r1\u7684\u9ad8\u6548\u90e8\u7f72\u65b9\u6cd5\uff0c\u6b22\u8fce\u5927\u5bb6\u53bb\u5c1d\u8bd5\u4f18\u5316\u3002<\/p>\n<p>\u540e\u7eed\u6211\u4eec\u5c06\u4f1a\u6301\u7eed\u5173\u6ce8\u5927\u6a21\u578b\u63a8\u7406\u6027\u80fd\u63d0\u5347\u65b9\u9762\u7684\u6700\u65b0\u6280\u672f\uff0c\u9a8c\u8bc1\u5e76\u53ca\u65f6\u5206\u4eab\u7ed9\u5927\u5bb6\u3002<\/p>\n<p><strong>\u53c2\u8003\u6587\u732e<\/strong><\/p>\n<p>[1] vLLM v0.6.0: 2.7x Throughput Improvement and 5x Latency Reduction https:\/\/blog.vllm.ai\/2024\/09\/05\/perf-update.html<\/p>\n<p>[2] sglang \u4ee3\u7801 https:\/\/github.com\/sgl-project\/sglang\/tree\/main\/python\/sglang\/srt\/managers<\/p>\n<p>[3] Efficient Memory Management for Large Language Model Serving with PagedAttention(https:\/\/arxiv.org\/abs\/2309.06180)<\/p>\n<p>[4] vLLM: Easy, Fast, and Cheap LLM Serving with PagedAttention https:\/\/blog.vllm.ai\/2023\/06\/20\/vllm.html<\/p>\n<p>[5] Fast and Expressive LLM Inference with RadixAttention and SGLang https:\/\/lmsys.org\/blog\/2024-01-17-sglang\/<\/p>\n<p>[6] vllm Documentation https:\/\/docs.vllm.ai\/en\/latest\/<\/p>\n<p>[7] SGLang Documentation https:\/\/docs.sglang.ai\/backend\/server_arguments.html<\/p>\n<p>[8] How Speculative Decoding Boosts vLLM Performance by up to 2.8x https:\/\/blog.vllm.ai\/2024\/10\/17\/spec-decode.html<\/p>\n<\/div>\n<p>\u6587\u7ae0\u6765\u81ea\uff1a51CTO<\/p>\n<\/div>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_24667\" class=\"pvc_stats total_only  \" data-element-id=\"24667\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Deepseek-r1\u6a21\u578b\u7684\u7206\u706b\u6807\u5fd7\u7740\u672c\u5730\u90e8\u7f72\u5927\u6a21\u578b\u7684\u9700\u6c42\u65e5\u76ca\u589e\u957f\u3002\u672c\u6587\u4e3b\u8981\u63a2\u8ba8\u5982\u4f55\u4f18\u5316\u672c\u5730\u90e8\u7f72\u5927\u6a21\u578b\u7684\u6027\u80fd\uff0c [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_24667\" class=\"pvc_stats total_only  \" data-element-id=\"24667\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":56,"featured_media":24669,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,20,80],"tags":[1526,113,667],"class_list":["post-24667","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-23","category-20","category-80","tag-deepseek","tag-113","tag-667"],"_links":{"self":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/24667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/comments?post=24667"}],"version-history":[{"count":1,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/24667\/revisions"}],"predecessor-version":[{"id":24671,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/24667\/revisions\/24671"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media\/24669"}],"wp:attachment":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media?parent=24667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/categories?post=24667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/tags?post=24667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}