{"id":458,"date":"2026-05-31T23:45:50","date_gmt":"2026-05-31T15:45:50","guid":{"rendered":"http:\/\/www.samcheng.net\/?p=458"},"modified":"2026-05-31T23:45:50","modified_gmt":"2026-05-31T15:45:50","slug":"%e5%a4%a7%e6%a8%a1%e5%9e%8b%e5%8f%82%e6%95%b0%e9%87%8f%e5%92%8c%e6%98%be%e5%ad%98%e6%95%b0%e6%8d%ae%e9%87%8f%e7%9a%84%e5%85%b3%e7%b3%bb","status":"publish","type":"post","link":"https:\/\/www.samcheng.net\/?p=458","title":{"rendered":"\u5927\u6a21\u578b\u53c2\u6570\u91cf\u548c\u663e\u5b58\u6570\u636e\u91cf\u7684\u5173\u7cfb"},"content":{"rendered":"<p>\u8fd9\u662f\u4e00\u4e2a\u5173\u4e8e <strong>AI \u9886\u57df\u6700\u91cd\u8981\u7684\u7269\u7406\u9650\u5236\u5173\u7cfb<\/strong> \u7684\u95ee\u9898\u3002\u7406\u89e3\u4e86\u8fd9\u4e2a\u5173\u7cfb\uff0c\u60a8\u5c31\u638c\u63e1\u4e86\u8fd0\u884c\u5927\u6a21\u578b\u7684\u201c\u786c\u79d1\u6280\u201d\u57fa\u7840\u77e5\u8bc6\u3002<\/p>\n<p>\u6211\u5c06\u4ece\u6982\u5ff5\u3001\u516c\u5f0f\u63a8\u5bfc\u5230\u5b9e\u9645\u5e94\u7528\uff08\u91cf\u5316\uff09\u4e09\u4e2a\u5c42\u9762\u4e3a\u60a8\u8be6\u7ec6\u89e3\u91ca\uff0c\u5e76\u7528\u4e00\u4e2a\u8868\u683c\u6765\u603b\u7ed3\u6838\u5fc3\u6982\u5ff5\u3002<\/p>\n<hr \/>\n<h3>\ud83d\udca1 \u7b2c\u4e00\u90e8\u5206\uff1a\u6a21\u578b\u53c2\u6570\u91cf\u548c\u663e\u5b58\u7684\u76f4\u89c2\u5173\u7cfb\uff08\u6982\u5ff5\u5c42\u9762\uff09<\/h3>\n<p>\u4f60\u53ef\u4ee5\u628a\u4e00\u4e2a\u5927\u8bed\u8a00\u6a21\u578b\u60f3\u8c61\u6210\u4e00\u672c<strong>\u77e5\u8bc6\u767e\u79d1\u5168\u4e66\uff08\u5373\u6574\u4e2a\u6a21\u578b\u672c\u8eab\uff09<\/strong>\u3002<\/p>\n<ol>\n<li><strong>\u53c2\u6570\u91cf (Parameters, P):<\/strong> \u53c2\u6570\u5c31\u662f\u8fd9\u672c\u4e66\u91cc\u8bb0\u5f55\u7684\u6240\u6709\u201c\u77e5\u8bc6\u70b9\u201d\u6216\u201c\u6743\u91cd\u201d\u3002\u6a21\u578b\u8bad\u7ec3\u7684\u76ee\u6807\uff0c\u5c31\u662f\u901a\u8fc7\u8c03\u6574\u8fd9\u4e9b\u53c2\u6570\uff0c\u8ba9\u5b83\u80fd\u591f\u5b66\u4e60\u5230\u4eba\u7c7b\u7684\u8bed\u8a00\u6a21\u5f0f\u548c\u77e5\u8bc6\u7ed3\u6784\u3002<\/li>\n<li><strong>\u663e\u5b58\u6570\u636e\u91cf (Memory Data Size):<\/strong> \u5b58\u50a8\u8fd9\u672c\u4e66\uff08\u6240\u6709\u77e5\u8bc6\u70b9\uff09\u6240\u9700\u7684\u7269\u7406\u7a7a\u95f4\u3002<\/li>\n<\/ol>\n<p><strong>\u5173\u7cfb\u7684\u6838\u5fc3\u7ed3\u8bba\uff1a<\/strong> <strong>\u6a21\u578b\u7684\u53c2\u6570\u8d8a\u591a\uff0c\u5b83\u7406\u8bba\u4e0a\u9700\u8981\u7684\u5b58\u50a8\u7a7a\u95f4\u5c31\u8d8a\u5927\u3002\u4f46\u662f\uff0c\u6211\u4eec\u7528\u7684\u662f\u201c\u6570\u636e\u7c7b\u578b\u201d\u6765\u51b3\u5b9a\u6bcf\u672c\u4e66\u7c4d\u5360\u591a\u5c11\u7a7a\u95f4\u3002<\/strong><\/p>\n<hr \/>\n<h3>\ud83d\udcd0 \u7b2c\u4e8c\u90e8\u5206\uff1a\u6838\u5fc3\u516c\u5f0f\u63a8\u5bfc (\u6570\u5b66\u5c42\u9762)<\/h3>\n<p>\u663e\u5b58\u6240\u9700\u5927\u5c0f ($M$) \u7684\u57fa\u672c\u8ba1\u7b97\u6a21\u578b\u662f\uff1a<\/p>\n<p>$$\\text{\u603b\u6240\u9700\u663e\u5b58} \\approx (\\text{\u6a21\u578b\u53c2\u6570\u91cf } P \\times \\text{\u6bcf\u4e2a\u53c2\u6570\u7684\u5b57\u8282\u6570}) + \\text{\u4e0a\u4e0b\u6587\u7f13\u5b58\u7a7a\u95f4}$$<\/p>\n<h4>1. \u53c2\u6570\u91cf\u7684\u51b3\u5b9a\u6027 (The Parameter Factor)<\/h4>\n<ul>\n<li><strong>\u516c\u5f0f:<\/strong> $M_{\\text{weights}} = P \\times \\text{Bytes per Param}$<\/li>\n<li><strong>\u8bf4\u660e:<\/strong> \u5982\u679c\u4e00\u4e2a\u6a21\u578b\u6709 700 \u4ebf\u53c2\u6570\uff08$P=70,000,000,000$\uff09\uff0c\u8fd9\u662f\u56fa\u5b9a\u7684\u3002\u8fd9\u4e2a\u6570\u5b57\u8d8a\u5927\uff0c\u7406\u8bba\u4e0a\u5b58\u50a8\u7684\u77e5\u8bc6\u5c31\u8d8a\u591a\u3002<\/li>\n<\/ul>\n<h4>2. \u6570\u636e\u7c7b\u578b\u7684\u5f71\u54cd (The Data Type Factor)<\/h4>\n<p>\u6bcf\u4e2a\u53c2\u6570\u90fd\u4e0d\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u201c\u5f00\u5173\u201d\u6216\u201c\u503c\u201d\uff0c\u5b83\u5fc5\u987b\u7528\u4e8c\u8fdb\u5236\u6570\u5b57\u6765\u8868\u793a\u3002\u4e0d\u540c\u7684\u7cbe\u5ea6\uff08\u6570\u636e\u7c7b\u578b\uff09\u51b3\u5b9a\u4e86\u7528\u6765\u5b58\u50a8\u8fd9\u4e2a\u503c\u7684\u5b57\u8282\u6570\u3002\u8fd9\u662f\u6700\u80fd\u5f71\u54cd\u5185\u5b58\u5927\u5c0f\u7684\u5730\u65b9\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left\">\u6570\u636e\u7c7b\u578b<\/th>\n<th style=\"text-align: left\">\u5168\u79f0<\/th>\n<th style=\"text-align: left\">\u6bcf\u4e2a\u53c2\u6570\u5360\u7528\u4f4d\u6570<\/th>\n<th style=\"text-align: left\">\u5b57\u8282\u6570 (Bytes\/Param)<\/th>\n<th style=\"text-align: left\">\u7279\u70b9\u4e0e\u4f7f\u7528\u573a\u666f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left\"><strong>FP32<\/strong><\/td>\n<td style=\"text-align: left\">\u5355\u7cbe\u5ea6\u6d6e\u70b9\u6570<\/td>\n<td style=\"text-align: left\">32 \u4f4d<\/td>\n<td style=\"text-align: left\"><strong>4 Bytes<\/strong><\/td>\n<td style=\"text-align: left\">\u6700\u9ad8\u7684\u7cbe\u5ea6\uff0c\u5e38\u7528\u4e8e\u6a21\u578b\u8bad\u7ec3\u9636\u6bb5\u3002\u5360\u7528\u5de8\u5927\u3002<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><strong>FP16\/BF16<\/strong><\/td>\n<td style=\"text-align: left\">\u534a\u7cbe\u5ea6\u6d6e\u70b9\u6570<\/td>\n<td style=\"text-align: left\">16 \u4f4d<\/td>\n<td style=\"text-align: left\"><strong>2 Bytes<\/strong><\/td>\n<td style=\"text-align: left\">\u5f53\u524d LLM \u63a8\u7406\u7684\u6807\u51c6\u914d\u7f6e\uff0c\u6027\u80fd\u548c\u7cbe\u5ea6\u5e73\u8861\u6700\u597d\u3002<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><strong>INT8 \/ Q4_K<\/strong><\/td>\n<td style=\"text-align: left\">\u91cf\u5316\u6574\u6570<\/td>\n<td style=\"text-align: left\">8\u4f4d\u62164\u4f4d<\/td>\n<td style=\"text-align: left\"><strong>1 Byte \u6216 &lt;1 Byte<\/strong><\/td>\n<td style=\"text-align: left\">\u901a\u8fc7\u6570\u5b66\u7b97\u6cd5\u727a\u7272\u6781\u5c0f\u90e8\u5206\u7cbe\u5ea6\u6765\u5927\u5e45\u51cf\u5c0f\u6a21\u578b\u4f53\u79ef\uff0c\u662f\u6d88\u8d39\u7ea7\u786c\u4ef6\u7684\u4e3b\u6d41\u9009\u62e9\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote>\n<p><strong>\u4e3e\u4f8b\u8bf4\u660e:<\/strong>\n\u4e00\u4e2a 70B \u53c2\u6570\u7684\u6a21\u578b\uff1a<\/p>\n<ul>\n<li>\u5168\u7cbe\u5ea6 (FP32): $70\\text{B} \\times 4 \\text{ Bytes} = 280 \\text{ GB}$ (\u9700\u8981\u5de8\u5927\u7684\u670d\u52a1\u5668)\u3002<\/li>\n<li>\u534a\u7cbe\u5ea6 (FP16): $70\\text{B} \\times 2 \\text{ Bytes} = 140 \\text{ GB}$\u3002<\/li>\n<li>\u9ad8\u5ea6\u91cf\u5316 (Q4): $\\approx 70\\text{B} \\times 0.5 \\text{ Byte} \\approx 35 \\text{ GB}$\uff08\u53ef\u4ee5\u5728\u9ad8\u7aef\u5361\u4e0a\u8fd0\u884c\uff09\u3002<\/li>\n<\/ul>\n<\/blockquote>\n<h4>3. \u4e0a\u4e0b\u6587\u7f13\u5b58\u7684\u5f00\u9500 (The Context Cache Factor)<\/h4>\n<p>\u8fd9\u662f\u65b0\u624b\u6700\u5bb9\u6613\u5ffd\u7565\uff0c\u4f46\u4e5f\u662f\u9020\u6210\u663e\u5b58\u4e0d\u8db3\u7684\u6700\u4e3b\u8981\u539f\u56e0\u3002<\/p>\n<p>\u5f53\u60a8\u4e0e\u6a21\u578b\u804a\u5929\u65f6\uff0c\u6a21\u578b\u9700\u8981\u8bb0\u4f4f\u4e4b\u524d\u6240\u6709\u5bf9\u8bdd\u7684\u5185\u5bb9\uff08\u5373 <strong>\u4e0a\u4e0b\u6587\u7a97\u53e3<\/strong>\uff09\u3002\u4e3a\u4e86\u4e0d\u8ba9\u6a21\u578b\u6bcf\u6b21\u90fd\u91cd\u65b0\u8bfb\u53d6\u6574\u4e2a\u5386\u53f2\u8bb0\u5f55\uff0c\u5b83\u4f1a\u4f7f\u7528\u4e00\u4e2a\u53eb <strong>KV Cache (Key-Value Cache)<\/strong> \u7684\u7f13\u5b58\u673a\u5236\u3002<\/p>\n<ul>\n<li><strong>\u5360\u7528\u516c\u5f0f:<\/strong> \u663e\u5b58\u5f00\u9500 $\\propto \\text{\u5e8f\u5217\u957f\u5ea6} (\\text{Context Length}) \\times \\text{Batch Size}$<\/li>\n<li><strong>\u5f71\u54cd:<\/strong> \u5982\u679c\u60a8\u9700\u8981\u6a21\u578b\u8bb0\u4f4f\u7684\u5bf9\u8bdd\u5386\u53f2\u8d8a\u957f\uff08\u4e0a\u4e0b\u6587\u7a97\u53e3\u8d8a\u5927\uff09\uff0c\u6216\u8005\u60a8\u4e00\u6b21\u6027\u63d0\u4ea4\u7684\u4efb\u52a1\u8bf7\u6c42\u8d8a\u591a\uff08Batch Size \u5927\uff09\uff0cKV Cache\u5360\u7528\u7684\u663e\u5b58\u5c31\u4f1a\u5448\u7ebf\u6027\u589e\u957f\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\ud83d\udcca \u4e09\u4e2a\u6838\u5fc3\u6982\u5ff5\u603b\u7ed3\u5bf9\u6bd4\u8868 (\u5fc5\u770b!)<\/h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left\">\u53c2\u6570\/\u6570\u636e\u7c7b\u578b<\/th>\n<th style=\"text-align: left\">\u4ee3\u8868\u4ec0\u4e48\uff1f<\/th>\n<th style=\"text-align: left\">\u5355\u4f4d\u5f71\u54cd\u54ea\u4e2a\u73af\u8282\uff1f<\/th>\n<th style=\"text-align: left\">\u6539\u53d8\u5b83\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left\"><strong>\u53c2\u6570\u91cf ($P$)<\/strong><\/td>\n<td style=\"text-align: left\">\u6a21\u578b\u643a\u5e26\u7684\u201c\u77e5\u8bc6\u603b\u91cf\u201d\u3002<\/td>\n<td style=\"text-align: left\">$\\rightarrow$ <strong>\u6a21\u578b\u5927\u5c0f (Memory)<\/strong><\/td>\n<td style=\"text-align: left\">$P \\uparrow \\implies$ \u9700\u8981\u66f4\u591a\u663e\u5b58\u3002<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><strong>\u6570\u636e\u7c7b\u578b (Precision)<\/strong><\/td>\n<td style=\"text-align: left\">\u5b58\u50a8\u6bcf\u4e2a\u77e5\u8bc6\u70b9\u7684\u201c\u7cbe\u7ec6\u7a0b\u5ea6\u201d\u3002<\/td>\n<td style=\"text-align: left\">$\\rightarrow$ <strong>\u5185\u5b58\u5360\u7528\u5927\u5c0f (Bytes\/Param)<\/strong><\/td>\n<td style=\"text-align: left\">\u7cbe\u5ea6\u8d8a\u4f4e\uff08\u5982 Q4\uff09\uff0c\u5360\u7528\u7684 VRAM \u8d8a\u5c11\u3002<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><strong>\u4e0a\u4e0b\u6587\u957f\u5ea6 ($L$)<\/strong><\/td>\n<td style=\"text-align: left\">\u6a21\u578b\u9700\u8981\u8bb0\u4f4f\u7684\u5bf9\u8bdd\u5386\u53f2\u957f\u77ed\u3002<\/td>\n<td style=\"text-align: left\">$\\rightarrow$ <strong>KV Cache \u5927\u5c0f (Memory)<\/strong><\/td>\n<td style=\"text-align: left\">$L \\uparrow \\implies$ \u9700\u8981\u66f4\u591a\u663e\u5b58\uff0c\u4e14\u53ef\u80fd\u4f1a\u9650\u5236\u60a8\u80fd\u8dd1\u7684\u6700\u5927 Batch Size\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u662f\u4e00\u4e2a\u5173\u4e8e AI \u9886\u57df\u6700\u91cd\u8981\u7684\u7269\u7406\u9650\u5236\u5173\u7cfb \u7684\u95ee\u9898\u3002\u7406\u89e3\u4e86\u8fd9\u4e2a\u5173\u7cfb\uff0c\u60a8\u5c31\u638c\u63e1\u4e86\u8fd0\u884c\u5927\u6a21\u578b\u7684\u201c\u786c\u79d1\u6280\u201d\u57fa\u7840\u77e5\u8bc6 [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[98,12,97,22],"tags":[99,100],"class_list":["post-458","post","type-post","status-publish","format-standard","hentry","category-ai","category-it","category-97","category-22","tag-ai","tag-100"],"_links":{"self":[{"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/posts\/458","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=458"}],"version-history":[{"count":1,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/posts\/458\/revisions"}],"predecessor-version":[{"id":459,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/posts\/458\/revisions\/459"}],"wp:attachment":[{"href":"https:\/\/www.samcheng.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}