{"id":94121,"date":"2026-08-13T20:01:26","date_gmt":"2026-08-13T12:01:26","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/94121.html"},"modified":"2026-08-13T20:01:26","modified_gmt":"2026-08-13T12:01:26","slug":"%e5%a4%a7%e6%a8%a1%e5%9e%8b%e6%8e%a8%e7%90%86-oom-%e6%b7%b1%e5%ba%a6%e6%8e%92%e6%9f%a5%ef%bc%9akv-cache-%e6%98%af%e5%85%83%e5%87%b6%ef%bc%81%e6%98%be%e5%ad%98%e6%9a%b4%e6%b6%a8%e5%ae%8c","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/94121.html","title":{"rendered":"\u5927\u6a21\u578b\u63a8\u7406 OOM \u6df1\u5ea6\u6392\u67e5\uff1aKV\u2011Cache \u662f\u5143\u51f6\uff01\u663e\u5b58\u66b4\u6da8\u5b8c\u6574\u5b9a\u4f4d + \u4f18\u5316\u5168\u5957\u65b9\u6848"},"content":{"rendered":"<p>\u6458\u8981&#xff1a;\u5927\u6a21\u578b\u63a8\u7406\u5e38\u51fa\u73b0\u663e\u5b58\u5145\u8db3\u4f46\u7a81\u53d1 OOM \u5d29\u6e83\u7684\u95ee\u9898&#xff0c;\u591a\u6570\u5f00\u53d1\u8005\u8bef\u5224\u4e3a\u6a21\u578b\u8fc7\u5927&#xff0c;\u5ffd\u7565\u4e86KV-Cache \u52a8\u6001\u663e\u5b58\u66b4\u6da8\u7684\u6838\u5fc3\u95ee\u9898\u3002\u672c\u6587\u901a\u4fd7\u62c6\u89e3 KV-Cache \u663e\u5b58\u81a8\u80c0\u539f\u7406&#xff0c;\u624b\u628a\u624b\u8bb2\u89e3 4 \u79cd\u663e\u5b58\u74f6\u9888\u5b9a\u4f4d\u65b9\u6cd5&#xff0c;\u7ed9\u51fa 5 \u5957\u53ef\u76f4\u63a5\u590d\u5236\u7684\u751f\u4ea7\u7ea7\u4f18\u5316\u65b9\u6848&#xff0c;\u5e76\u6c47\u603b\u5168\u7f51\u9ad8\u9891\u8e29\u5751\u8bef\u533a\u3002\u53ef\u9ad8\u6548\u89e3\u51b3\u957f\u6587\u672c\u3001\u591a\u8f6e\u5bf9\u8bdd\u3001\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u6e10\u8fdb\u5f0f\u663e\u5b58\u6ea2\u51fa\u95ee\u9898&#xff0c;\u663e\u8457\u63d0\u5347\u5927\u6a21\u578b\u90e8\u7f72\u7a33\u5b9a\u6027\u4e0e\u663e\u5b58\u5229\u7528\u7387\u3002<\/p>\n<p>\u5173\u952e\u8bcd&#xff1a;\u5927\u6a21\u578b\u63a8\u7406&#xff1b;OOM \u62a5\u9519&#xff1b;KV-Cache&#xff1b;\u663e\u5b58\u66b4\u6da8&#xff1b;\u663e\u5b58\u4f18\u5316&#xff1b;transformers&#xff1b;vLLM<\/p>\n<h3>\u524d\u8a00<\/h3>\n<p>\u505a\u5927\u6a21\u578b\u672c\u5730\u90e8\u7f72\u3001\u7ebf\u4e0a\u63a8\u7406\u670d\u52a1\u7684\u5f00\u53d1\u8005&#xff0c;\u57fa\u672c\u90fd\u9047\u5230\u8fc7\u7ecf\u5178\u7591\u96be\u95ee\u9898&#xff1a;\u663e\u5361\u663e\u5b58\u660e\u660e\u591f\u7528\u3001\u6a21\u578b\u52a0\u8f7d\u6b63\u5e38\u3001\u77ed\u5bf9\u8bdd\u6beb\u65e0\u95ee\u9898&#xff0c;\u4f46\u8dd1\u4e00\u4f1a\u513f\u957f\u6587\u672c\u6216\u591a\u8f6e\u5e76\u53d1&#xff0c;\u5c31\u7a81\u7136 OOM \u5d29\u6e83\u3002<\/p>\n<p>\u5927\u591a\u6570\u4eba\u4f1a\u76f2\u76ee\u5f52\u56e0\u4e3a\u201c\u6a21\u578b\u592a\u5927\u3001\u663e\u5b58\u4e0d\u591f\u201d&#xff0c;\u901a\u8fc7\u51cf\u5c0f\u6a21\u578b\u3001\u964d\u4f4e batch\u3001\u52a0\u91cd\u91cf\u5316\u7b49\u65b9\u5f0f\u4f18\u5316&#xff0c;\u4f46\u5f80\u5f80\u6cbb\u6807\u4e0d\u6cbb\u672c&#xff0c;OOM \u4f9d\u65e7\u53cd\u590d\u590d\u73b0\u3002<\/p>\n<p>\u6838\u5fc3\u7ed3\u8bba&#xff1a;90% \u63a8\u7406\u4e2d\u540e\u671f OOM\u3001\u663e\u5b58\u6301\u7eed\u66b4\u6da8&#xff0c;\u5143\u51f6\u4e0d\u662f\u6a21\u578b\u6743\u91cd&#xff0c;\u800c\u662f KV\u2011Cache\u3002<\/p>\n<p>\u6a21\u578b\u6743\u91cd\u5c5e\u4e8e\u56fa\u5b9a\u9759\u6001\u663e\u5b58&#xff0c;\u52a0\u8f7d\u540e\u4e0d\u518d\u53d8\u5316&#xff1b;\u800c KV\u2011Cache \u5c5e\u4e8e\u52a8\u6001\u7d2f\u79ef\u663e\u5b58&#xff0c;\u4f1a\u968f\u5bf9\u8bdd\u8f6e\u6b21\u3001token \u957f\u5ea6\u3001\u5e76\u53d1\u6570\u6301\u7eed\u4e0a\u6da8&#xff0c;\u662f\u957f\u6587\u672c\u63a8\u7406\u3001\u5bf9\u8bdd\u673a\u5668\u4eba\u3001\u9ad8\u5e76\u53d1\u670d\u52a1 OOM \u7684\u6839\u672c\u539f\u56e0\u3002<\/p>\n<p>\u5e02\u9762\u4e0a\u7edd\u5927\u591a\u6570\u6559\u7a0b\u53ea\u8bb2\u6743\u91cd\u91cf\u5316\u3001\u6a21\u578b\u7626\u8eab&#xff0c;\u51e0\u4e4e\u4e0d\u8bb2\u89e3 KV \u7f13\u5b58\u7684\u663e\u5b58\u81a8\u80c0\u673a\u5236\u4e0e\u4f18\u5316\u65b9\u6848\u3002\u672c\u6587\u4ece\u73b0\u8c61\u2192\u539f\u7406\u2192\u5b9a\u4f4d\u2192\u4f18\u5316\u2192\u907f\u5751\u5b8c\u6574\u95ed\u73af&#xff0c;\u5e26\u4f60\u5f7b\u5e95\u6839\u6cbb\u5927\u6a21\u578b\u63a8\u7406\u663e\u5b58\u6ea2\u51fa\u95ee\u9898\u3002<\/p>\n<h3>\u4e00\u3001\u8be1\u5f02 OOM \u73b0\u8c61&#xff1a;\u663e\u5b58\u5145\u8db3\u4e3a\u4ec0\u4e48\u8fd8\u5d29&#xff1f;<\/h3>\n<p>\u5148\u68b3\u7406\u6240\u6709\u4eba\u90fd\u4f1a\u9047\u5230\u7684\u5178\u578b\u6545\u969c\u7279\u5f81&#xff1a;<\/p>\n<p>1\u3001\u663e\u5b58\u4f59\u91cf\u5145\u8db3&#xff1a;24G \u663e\u5361\u52a0\u8f7d 7B\/13B \u91cf\u5316\u6a21\u578b\u540e&#xff0c;\u5269\u4f59\u663e\u5b58\u4f9d\u7136\u5145\u8db3&#xff1b;<\/p>\n<p>2\u3001\u51b7\u542f\u52a8\u5b8c\u5168\u6b63\u5e38&#xff1a;\u9996\u8f6e\u5bf9\u8bdd\u3001\u77ed\u6587\u672c\u751f\u6210\u3001\u4f4e\u5e76\u53d1\u63a8\u7406\u7a33\u5b9a\u65e0\u62a5\u9519&#xff1b;<\/p>\n<p>3\u3001\u70ed\u8fd0\u884c\u7a81\u53d1\u5d29\u6e83&#xff1a;\u591a\u8f6e\u5bf9\u8bdd\u3001\u4e0a\u4e0b\u6587\u53d8\u957f\u3001\u6301\u7eed\u63a8\u7406\u540e&#xff0c;\u65e0\u5f81\u5146\u89e6\u53d1 OutOfMemory&#xff1b;<\/p>\n<p>4\u3001\u5e38\u89c4\u4f18\u5316\u65e0\u6548&#xff1a;\u964d\u7cbe\u5ea6\u3001\u51cf\u5c0f batch\u3001\u5173\u95ed\u68af\u5ea6&#xff0c;\u53ea\u80fd\u77ed\u6682\u7f13\u89e3&#xff0c;\u65e0\u6cd5\u6839\u6cbb\u3002<\/p>\n<p>\u672c\u8d28\u539f\u56e0&#xff1a;\u5927\u6a21\u578b\u663e\u5b58\u5206\u4e3a\u300c\u56fa\u5b9a\u663e\u5b58\u300d\u548c\u300c\u52a8\u6001\u663e\u5b58\u300d<\/p>\n<p>\u6a21\u578b\u6743\u91cd\u663e\u5b58\u5168\u7a0b\u56fa\u5b9a\u4e0d\u53d8&#xff0c;\u771f\u6b63\u6301\u7eed\u81a8\u80c0\u3001\u5403\u6ee1\u663e\u5b58\u7684\u53ea\u6709 KV-Cache\u3002\u5f88\u591a\u5f00\u53d1\u8005\u53ea\u7b97\u6a21\u578b\u6743\u91cd\u663e\u5b58&#xff0c;\u5b8c\u5168\u5ffd\u7565\u52a8\u6001\u7f13\u5b58\u5f00\u9500&#xff0c;\u6700\u7ec8\u9020\u6210\u201c\u663e\u5b58\u770b\u7740\u591f\u7528&#xff0c;\u5b9e\u9645\u88ab\u7f13\u5b58\u6491\u7206\u201d\u7684\u5047\u8c61\u3002<\/p>\n<h3>\u4e8c\u3001KV-Cache \u6838\u5fc3\u539f\u7406&#xff08;\u901a\u4fd7\u6613\u61c2 &#043; \u53ef\u89c6\u5316\u6d41\u7a0b\u56fe&#xff09;<\/h3>\n<h4>2.1 \u4e3a\u4ec0\u4e48\u9700\u8981 KV-Cache&#xff1f;<\/h4>\n<p>\u5927\u6a21\u578b\u63a8\u7406\u5206\u4e3a\u4e24\u4e2a\u9636\u6bb5&#xff1a;Prefill \u9884\u586b\u5145\u3001Decode \u9010 Token \u751f\u6210\u3002<\/p>\n<p>\u82e5\u65e0 KV-Cache&#xff0c;\u6a21\u578b\u6bcf\u751f\u6210\u4e00\u4e2a\u65b0 token&#xff0c;\u90fd\u8981\u91cd\u65b0\u8ba1\u7b97\u5168\u6587\u6240\u6709\u5386\u53f2 token \u7684 K\/V \u5411\u91cf&#xff0c;\u8ba1\u7b97\u590d\u6742\u5ea6\u4e3a O(n\u00b2)&#xff0c;\u957f\u6587\u672c\u63a8\u7406\u901f\u5ea6\u6781\u5dee\u3001\u5b8c\u5168\u4e0d\u53ef\u7528\u3002<\/p>\n<p>KV-Cache \u7684\u4f5c\u7528&#xff1a;\u7f13\u5b58\u6240\u6709\u5386\u53f2 token \u7684 Key\/Value \u5411\u91cf&#xff0c;\u540e\u7eed\u53ea\u8ba1\u7b97\u65b0\u589e token&#xff0c;\u590d\u7528\u5386\u53f2\u7f13\u5b58&#xff0c;\u5c06\u63a8\u7406\u590d\u6742\u5ea6\u964d\u81f3 O(n)&#xff0c;\u662f\u5927\u6a21\u578b\u9ad8\u901f\u751f\u6210\u7684\u6838\u5fc3\u673a\u5236\u3002<\/p>\n<h4>2.2 KV-Cache \u663e\u5b58\u66b4\u6da8\u7684\u771f\u6b63\u903b\u8f91<\/h4>\n<p>1\u3001\u6bcf\u4e00\u5c42 Transformer\u3001\u6bcf\u4e00\u4e2a\u6ce8\u610f\u529b\u5934\u90fd\u4f1a\u4ea7\u751f\u72ec\u7acb KV \u7f13\u5b58&#xff0c;\u591a\u5c42\u53e0\u52a0\u663e\u5b58\u5f00\u9500\u5de8\u5927&#xff1b;<\/p>\n<p>2\u3001\u7f13\u5b58\u53ea\u8ffd\u52a0\u3001\u4e0d\u81ea\u52a8\u6e05\u7406&#xff1a;\u4e0a\u4e0b\u6587\u8d8a\u957f\u3001\u8f6e\u6b21\u8d8a\u591a&#xff0c;\u7f13\u5b58\u8d8a\u5927&#xff1b;\u591a\u5e76\u53d1\u573a\u666f\u4e0b\u7f13\u5b58\u4e92\u76f8\u53e0\u52a0&#xff1b;<\/p>\n<p>3\u3001\u539f\u751f transformers \u65e0\u6dd8\u6c70\u3001\u65e0\u56de\u6536\u3001\u65e0\u7a97\u53e3\u9650\u5236&#xff0c;\u7f13\u5b58\u4f1a\u4e00\u76f4\u5360\u7528\u663e\u5b58&#xff0c;\u76f4\u5230 OOM\u3002<\/p>\n<h4>2.3 \u53ef\u89c6\u5316\u6d41\u7a0b\u4e0e\u663e\u5b58\u7ed3\u6784&#xff08;\u5168\u5e73\u53f0\u53ef\u6e32\u67d3&#xff09;<\/h4>\n<p>\u6d41\u7a0b\u56fe 1&#xff1a;KV-Cache \u63a8\u7406\u5b8c\u6574\u6d41\u7a0b&#xff08;\u663e\u5b58\u66b4\u6da8\u6839\u6e90&#xff09;<\/p>\n<p>#mermaid-svg-Pl7gfET9smcm0zeI{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Pl7gfET9smcm0zeI .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Pl7gfET9smcm0zeI .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Pl7gfET9smcm0zeI .error-icon{fill:#552222;}#mermaid-svg-Pl7gfET9smcm0zeI .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Pl7gfET9smcm0zeI .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Pl7gfET9smcm0zeI .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Pl7gfET9smcm0zeI .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Pl7gfET9smcm0zeI .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Pl7gfET9smcm0zeI .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Pl7gfET9smcm0zeI .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Pl7gfET9smcm0zeI .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Pl7gfET9smcm0zeI .marker.cross{stroke:#333333;}#mermaid-svg-Pl7gfET9smcm0zeI svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Pl7gfET9smcm0zeI p{margin:0;}#mermaid-svg-Pl7gfET9smcm0zeI .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-Pl7gfET9smcm0zeI .cluster-label text{fill:#333;}#mermaid-svg-Pl7gfET9smcm0zeI .cluster-label span{color:#333;}#mermaid-svg-Pl7gfET9smcm0zeI .cluster-label span p{background-color:transparent;}#mermaid-svg-Pl7gfET9smcm0zeI .label text,#mermaid-svg-Pl7gfET9smcm0zeI span{fill:#333;color:#333;}#mermaid-svg-Pl7gfET9smcm0zeI .node rect,#mermaid-svg-Pl7gfET9smcm0zeI .node circle,#mermaid-svg-Pl7gfET9smcm0zeI .node ellipse,#mermaid-svg-Pl7gfET9smcm0zeI .node polygon,#mermaid-svg-Pl7gfET9smcm0zeI .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Pl7gfET9smcm0zeI .rough-node .label text,#mermaid-svg-Pl7gfET9smcm0zeI .node .label text,#mermaid-svg-Pl7gfET9smcm0zeI .image-shape .label,#mermaid-svg-Pl7gfET9smcm0zeI .icon-shape .label{text-anchor:middle;}#mermaid-svg-Pl7gfET9smcm0zeI .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Pl7gfET9smcm0zeI .rough-node .label,#mermaid-svg-Pl7gfET9smcm0zeI .node .label,#mermaid-svg-Pl7gfET9smcm0zeI .image-shape .label,#mermaid-svg-Pl7gfET9smcm0zeI .icon-shape .label{text-align:center;}#mermaid-svg-Pl7gfET9smcm0zeI .node.clickable{cursor:pointer;}#mermaid-svg-Pl7gfET9smcm0zeI .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Pl7gfET9smcm0zeI .arrowheadPath{fill:#333333;}#mermaid-svg-Pl7gfET9smcm0zeI .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Pl7gfET9smcm0zeI .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Pl7gfET9smcm0zeI .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Pl7gfET9smcm0zeI .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Pl7gfET9smcm0zeI .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Pl7gfET9smcm0zeI .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Pl7gfET9smcm0zeI .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Pl7gfET9smcm0zeI .cluster text{fill:#333;}#mermaid-svg-Pl7gfET9smcm0zeI .cluster span{color:#333;}#mermaid-svg-Pl7gfET9smcm0zeI div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Pl7gfET9smcm0zeI .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Pl7gfET9smcm0zeI rect.text{fill:none;stroke-width:0;}#mermaid-svg-Pl7gfET9smcm0zeI .icon-shape,#mermaid-svg-Pl7gfET9smcm0zeI .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Pl7gfET9smcm0zeI .icon-shape p,#mermaid-svg-Pl7gfET9smcm0zeI .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Pl7gfET9smcm0zeI .icon-shape .label rect,#mermaid-svg-Pl7gfET9smcm0zeI .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Pl7gfET9smcm0zeI .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Pl7gfET9smcm0zeI .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Pl7gfET9smcm0zeI :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u7528\u6237\u8f93\u5165 Prompt \u6587\u672c\\\\<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>Prefill \u9636\u6bb5\u4e00\u6b21\u6027\u8ba1\u7b97\u5168\u90e8 Token K\/V \u5411\u91cf<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u5199\u5165\u663e\u5b58\u521d\u59cb\u5316 KV-Cache \u7f13\u5b58<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>Decode \u9010 Token \u751f\u6210\u9636\u6bb5<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u6bcf\u751f\u6210 1 \u4e2a\u65b0 Token\u8ba1\u7b97\u65b0 K\/V \u5e76\u8ffd\u52a0\u7f13\u5b58<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>KV \u7f13\u5b58\u53ea\u589e\u4e0d\u51cf\u6301\u7eed\u7d2f\u79ef\u5360\u7528\u663e\u5b58<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u957f\u6587\u672c\/\u591a\u5e76\u53d1\u7f13\u5b58\u53e0\u52a0\u663e\u5b58\u8017\u5c3d\u89e6\u53d1 OOM \u5d29\u6e83<\/p>\n<p><\/span><\/p>\n<p>\u6d41\u7a0b\u56fe 2&#xff1a;\u5927\u6a21\u578b\u663e\u5b58\u5206\u5c42\u7ed3\u6784&#xff08;\u7cbe\u51c6\u5b9a\u4f4d\u74f6\u9888&#xff09;<\/p>\n<p>#mermaid-svg-1IkdHjQYaGRV5UMs{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-1IkdHjQYaGRV5UMs .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-1IkdHjQYaGRV5UMs .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-1IkdHjQYaGRV5UMs .error-icon{fill:#552222;}#mermaid-svg-1IkdHjQYaGRV5UMs .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-1IkdHjQYaGRV5UMs .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-1IkdHjQYaGRV5UMs .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-1IkdHjQYaGRV5UMs .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-1IkdHjQYaGRV5UMs .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-1IkdHjQYaGRV5UMs .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-1IkdHjQYaGRV5UMs .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-1IkdHjQYaGRV5UMs .marker{fill:#333333;stroke:#333333;}#mermaid-svg-1IkdHjQYaGRV5UMs .marker.cross{stroke:#333333;}#mermaid-svg-1IkdHjQYaGRV5UMs svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-1IkdHjQYaGRV5UMs p{margin:0;}#mermaid-svg-1IkdHjQYaGRV5UMs .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-1IkdHjQYaGRV5UMs .cluster-label text{fill:#333;}#mermaid-svg-1IkdHjQYaGRV5UMs .cluster-label span{color:#333;}#mermaid-svg-1IkdHjQYaGRV5UMs .cluster-label span p{background-color:transparent;}#mermaid-svg-1IkdHjQYaGRV5UMs .label text,#mermaid-svg-1IkdHjQYaGRV5UMs span{fill:#333;color:#333;}#mermaid-svg-1IkdHjQYaGRV5UMs .node rect,#mermaid-svg-1IkdHjQYaGRV5UMs .node circle,#mermaid-svg-1IkdHjQYaGRV5UMs .node ellipse,#mermaid-svg-1IkdHjQYaGRV5UMs .node polygon,#mermaid-svg-1IkdHjQYaGRV5UMs .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-1IkdHjQYaGRV5UMs .rough-node .label text,#mermaid-svg-1IkdHjQYaGRV5UMs .node .label text,#mermaid-svg-1IkdHjQYaGRV5UMs .image-shape .label,#mermaid-svg-1IkdHjQYaGRV5UMs .icon-shape .label{text-anchor:middle;}#mermaid-svg-1IkdHjQYaGRV5UMs .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-1IkdHjQYaGRV5UMs .rough-node .label,#mermaid-svg-1IkdHjQYaGRV5UMs .node .label,#mermaid-svg-1IkdHjQYaGRV5UMs .image-shape .label,#mermaid-svg-1IkdHjQYaGRV5UMs .icon-shape .label{text-align:center;}#mermaid-svg-1IkdHjQYaGRV5UMs .node.clickable{cursor:pointer;}#mermaid-svg-1IkdHjQYaGRV5UMs .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-1IkdHjQYaGRV5UMs .arrowheadPath{fill:#333333;}#mermaid-svg-1IkdHjQYaGRV5UMs .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-1IkdHjQYaGRV5UMs .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-1IkdHjQYaGRV5UMs .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-1IkdHjQYaGRV5UMs .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-1IkdHjQYaGRV5UMs .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-1IkdHjQYaGRV5UMs .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-1IkdHjQYaGRV5UMs .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-1IkdHjQYaGRV5UMs .cluster text{fill:#333;}#mermaid-svg-1IkdHjQYaGRV5UMs .cluster span{color:#333;}#mermaid-svg-1IkdHjQYaGRV5UMs div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-1IkdHjQYaGRV5UMs .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-1IkdHjQYaGRV5UMs rect.text{fill:none;stroke-width:0;}#mermaid-svg-1IkdHjQYaGRV5UMs .icon-shape,#mermaid-svg-1IkdHjQYaGRV5UMs .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-1IkdHjQYaGRV5UMs .icon-shape p,#mermaid-svg-1IkdHjQYaGRV5UMs .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-1IkdHjQYaGRV5UMs .icon-shape .label rect,#mermaid-svg-1IkdHjQYaGRV5UMs .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-1IkdHjQYaGRV5UMs .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-1IkdHjQYaGRV5UMs .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-1IkdHjQYaGRV5UMs :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u5927\u6a21\u578b\u63a8\u7406\u603b\u663e\u5b58\u5360\u7528<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u56fa\u5b9a\u9759\u6001\u663e\u5b58\u6c38\u4e45\u7a33\u5b9a\u3001\u65e0\u66b4\u6da8\u98ce\u9669<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u52a8\u6001\u6d6e\u52a8\u663e\u5b58OOM \u6838\u5fc3\u5143\u51f6\u3001\u6301\u7eed\u589e\u957f<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u6a21\u578b\u6743\u91cd\u53c2\u6570\u663e\u5b587B\/13B \u91cf\u5316\u540e\u6570\u503c\u56fa\u5b9a<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u6846\u67b6\u57fa\u7840\u663e\u5b58\u4e0a\u4e0b\u6587\u5e95\u5ea7\u56fa\u5b9a\u5f00\u9500<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u4e34\u65f6\u6fc0\u6d3b\u503c\u663e\u5b58\u5360\u6bd4\u6781\u4f4e\u3001\u53ef\u5ffd\u7565<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>KV-Cache \u952e\u503c\u7f13\u5b58\u663e\u5b58\u968f Token\/\u8f6e\u6b21\/\u5e76\u53d1\u66b4\u6da8<\/p>\n<p><\/span><\/p>\n<p>\u4e00\u53e5\u8bdd\u603b\u7ed3&#xff1a;\u56fa\u5b9a\u663e\u5b58\u4e0d\u6da8&#xff0c;KV \u7f13\u5b58\u4e00\u76f4\u6da8&#xff0c;\u662f\u6e10\u8fdb\u5f0f OOM \u7684\u552f\u4e00\u6838\u5fc3\u6765\u6e90\u3002<\/p>\n<h3>\u4e09\u30014 \u79cd\u5b9a\u4f4d\u624b\u6bb5&#xff1a;\u7cbe\u51c6\u9501\u5b9a KV \u7f13\u5b58 OOM<\/h3>\n<p>\u666e\u901a\u5f00\u53d1\u8005\u53ea\u4f1a\u770b\u663e\u5361\u603b\u663e\u5b58&#xff0c;\u65e0\u6cd5\u533a\u5206\u6743\u91cd\u3001\u6fc0\u6d3b\u3001\u7f13\u5b58\u5f00\u9500\u3002\u4e0b\u9762 4 \u79cd\u65b9\u6cd5\u53ef\u7cbe\u51c6\u5b9a\u4f4d KV-Cache \u663e\u5b58\u6cc4\u6f0f\u4e0e\u66b4\u6da8\u95ee\u9898\u3002<\/p>\n<h4>\u624b\u6bb5 1&#xff1a;nvidia-smi \u52a8\u6001\u89c2\u6d4b&#xff08;\u5feb\u901f\u521d\u7b5b&#xff09;<\/h4>\n<p>\u9759\u6001\u622a\u56fe\u6beb\u65e0\u610f\u4e49&#xff0c;\u5fc5\u987b\u52a8\u6001\u76d1\u63a7&#xff1a;<\/p>\n<p>nvidia-smi <span class=\"token parameter variable\">-l<\/span> <span class=\"token number\">1<\/span><\/p>\n<p>\u5224\u5b9a\u6807\u51c6&#xff1a;\u6a21\u578b\u52a0\u8f7d\u540e\u663e\u5b58\u7a33\u5b9a&#xff0c;\u63a8\u7406\u8fc7\u7a0b\u663e\u5b58\u6301\u7eed\u4e0a\u6da8\u3001\u505c\u6b62\u63a8\u7406\u4e0d\u56de\u843d&#xff0c;\u5373\u4e3a KV-Cache \u7d2f\u79ef\u5bfc\u81f4 OOM\u3002<\/p>\n<h4>\u624b\u6bb5 2&#xff1a;Torch \u7cbe\u7ec6\u5316\u663e\u5b58\u76d1\u63a7&#xff08;\u7cbe\u51c6\u91cf\u5316&#xff09;<\/h4>\n<p>\u901a\u8fc7 torch \u63a5\u53e3\u7edf\u8ba1\u63a8\u7406\u524d\u540e\u663e\u5b58\u589e\u91cf&#xff0c;\u589e\u91cf\u5373\u4e3a\u7eaf KV \u7f13\u5b58\u5f00\u9500\u3002<\/p>\n<p><span class=\"token keyword\">import<\/span> torch<br \/>\n<span class=\"token keyword\">from<\/span> transformers <span class=\"token keyword\">import<\/span> AutoModelForCausalLM<span class=\"token punctuation\">,<\/span> AutoTokenizer<\/p>\n<p><span class=\"token comment\"># \u6253\u5370\u7cbe\u7ec6\u5316\u663e\u5b58\u5360\u7528<\/span><br \/>\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">print_gpu_memory<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u5df2\u5206\u914d\u663e\u5b58&#xff1a;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>torch<span class=\"token punctuation\">.<\/span>cuda<span class=\"token punctuation\">.<\/span>memory_allocated<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">\/<\/span><span class=\"token number\">1024<\/span><span class=\"token operator\">\/<\/span><span class=\"token number\">1024<\/span><span class=\"token operator\">\/<\/span><span class=\"token number\">1024<\/span><span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">.2f<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">GB&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u7f13\u5b58\u663e\u5b58&#xff1a;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>torch<span class=\"token punctuation\">.<\/span>cuda<span class=\"token punctuation\">.<\/span>memory_reserved<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">\/<\/span><span class=\"token number\">1024<\/span><span class=\"token operator\">\/<\/span><span class=\"token number\">1024<\/span><span class=\"token operator\">\/<\/span><span class=\"token number\">1024<\/span><span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">.2f<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">GB&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u52a0\u8f7d\u6a21\u578b&#xff0c;\u7edf\u8ba1\u57fa\u7840\u663e\u5b58<\/span><br \/>\nmodel <span class=\"token operator\">&#061;<\/span> AutoModelForCausalLM<span class=\"token punctuation\">.<\/span>from_pretrained<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;your-model-path&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\nprint_gpu_memory<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u63a8\u7406\u540e\u67e5\u770bKV\u7f13\u5b58\u589e\u91cf<\/span><br \/>\noutputs <span class=\"token operator\">&#061;<\/span> model<span class=\"token punctuation\">.<\/span>generate<span class=\"token punctuation\">(<\/span><span class=\"token operator\">**<\/span>inputs<span class=\"token punctuation\">,<\/span> max_new_tokens<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1024<\/span><span class=\"token punctuation\">)<\/span><br \/>\nprint_gpu_memory<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h4>\u624b\u6bb5 3&#xff1a;vLLM \u65e5\u5fd7\u6392\u67e5&#xff08;\u7ebf\u4e0a\u670d\u52a1\u4e13\u7528&#xff09;<\/h4>\n<p>vLLM \u539f\u751f\u8f93\u51fa KV \u7f13\u5b58\u76d1\u63a7\u6307\u6807&#xff1a;KV cache usage\u3001cached tokens\u3001\u7f13\u5b58\u547d\u4e2d\u7387\u3002<\/p>\n<p>\u82e5\u670d\u52a1\u8fd0\u884c\u4e2d KV \u4f7f\u7528\u7387\u6301\u7eed\u903c\u8fd1 100% \u5e76\u89e6\u53d1 OOM&#xff0c;\u8bf4\u660e\u7f13\u5b58\u65e0\u6dd8\u6c70\u3001\u6301\u7eed\u5806\u79ef&#xff0c;\u662f\u5178\u578b\u7684 KV-Cache \u74f6\u9888\u3002<\/p>\n<h4>\u624b\u6bb5 4&#xff1a;KV \u663e\u5b58\u516c\u5f0f\u9884\u4f30&#xff08;\u4e8b\u524d\u907f\u5751&#xff09;<\/h4>\n<p>\u53ef\u63d0\u524d\u8ba1\u7b97\u6700\u5927\u4e0a\u4e0b\u6587\u4e0e\u5e76\u53d1\u5bf9\u5e94\u7684\u663e\u5b58\u5f00\u9500&#xff0c;\u89c4\u907f\u7a81\u53d1 OOM\u3002<\/p>\n<p>KV\u663e\u5b58(GB) &#061; 2 \u00d7 \u5c42\u6570 \u00d7 \u5934\u7ef4\u5ea6 \u00d7 \u5e8f\u5217\u957f\u5ea6 \u00d7 \u5e76\u53d1\u6570 \u00d7 \u7cbe\u5ea6 \/ 1024\u00b3<\/p>\n<p>\u6838\u5fc3\u89c4\u5f8b&#xff1a;\u5e8f\u5217\u957f\u5ea6\u548c\u5e76\u53d1\u6570\u662f\u6700\u5927\u53d8\u91cf&#xff0c;\u7cbe\u5ea6\u8d8a\u9ad8&#xff0c;\u7f13\u5b58\u663e\u5b58\u5f00\u9500\u8d8a\u5927\u3002<\/p>\n<h3>\u56db\u30015 \u5957\u53ef\u76f4\u63a5\u843d\u5730\u7684\u751f\u4ea7\u7ea7\u4f18\u5316\u65b9\u6848<\/h3>\n<p>\u4ee5\u4e0b\u65b9\u6848\u4ece\u9650\u5236\u3001\u526a\u679d\u3001\u91cf\u5316\u3001\u8c03\u53c2\u3001\u6362\u5f15\u64ce\u4e94\u5c42\u4f18\u5316&#xff0c;\u5168\u90e8\u53ef\u76f4\u63a5\u590d\u5236\u4e0a\u7ebf&#xff0c;\u6839\u6cbb KV \u7f13\u5b58 OOM\u3002<\/p>\n<h4>\u65b9\u6848 1&#xff1a;\u56fa\u5b9a\u4e0a\u4e0b\u6587\u7a97\u53e3&#xff08;\u57fa\u7840\u515c\u5e95&#xff09;<\/h4>\n<p>\u9650\u5236\u6700\u5927\u5e8f\u5217\u957f\u5ea6&#xff0c;\u675c\u7edd\u7f13\u5b58\u65e0\u9650\u7d2f\u79ef&#xff0c;\u96f6\u6210\u672c\u7a33\u663e\u5b58\u3002<\/p>\n<p>model<span class=\"token punctuation\">.<\/span>config<span class=\"token punctuation\">.<\/span>max_seq_len <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">8192<\/span><br \/>\nmodel<span class=\"token punctuation\">.<\/span>generate<span class=\"token punctuation\">(<\/span><br \/>\n    <span class=\"token operator\">**<\/span>inputs<span class=\"token punctuation\">,<\/span><br \/>\n    max_new_tokens<span class=\"token operator\">&#061;<\/span><span class=\"token number\">512<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    max_length<span class=\"token operator\">&#061;<\/span><span class=\"token number\">8192<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    use_cache<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<h4>\u65b9\u6848 2&#xff1a;\u6ed1\u52a8\u7a97\u53e3\u6ce8\u610f\u529b&#xff08;\u957f\u6587\u672c\u6700\u4f18&#xff09;<\/h4>\n<p>\u81ea\u52a8\u6dd8\u6c70\u4e45\u8fdc\u7f13\u5b58&#xff0c;\u53ea\u4fdd\u7559\u8fd1\u671f\u6709\u6548 token&#xff0c;\u663e\u5b58\u76f4\u63a5\u4e0b\u964d 50%~70%\u3002<\/p>\n<p><span class=\"token comment\"># \u4ec5\u4fdd\u7559\u6700\u8fd1 4096 token KV \u7f13\u5b58<\/span><br \/>\nmodel<span class=\"token punctuation\">.<\/span>config<span class=\"token punctuation\">.<\/span>sliding_window <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">4096<\/span><br \/>\noutputs <span class=\"token operator\">&#061;<\/span> model<span class=\"token punctuation\">.<\/span>generate<span class=\"token punctuation\">(<\/span><span class=\"token operator\">**<\/span>inputs<span class=\"token punctuation\">,<\/span> use_cache<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h4>\u65b9\u6848 3&#xff1a;KV-Cache \u91cf\u5316\u538b\u7f29&#xff08;\u663e\u5b58\u51cf\u534a&#xff09;<\/h4>\n<p>\u7edd\u5927\u591a\u6570\u4eba\u53ea\u91cf\u5316\u6743\u91cd&#xff0c;\u771f\u6b63\u8be5\u91cf\u5316\u7684\u662f KV \u7f13\u5b58\u3002<\/p>\n<p>vLLM \u53c2\u6570<\/p>\n<p><span class=\"token comment\"># \u5e73\u8861\u7cbe\u5ea6\u4e0e\u663e\u5b58<\/span><br \/>\n&#8211;kv-cache-dtype int8<\/p>\n<p><span class=\"token comment\"># \u6781\u81f4\u538b\u7f29&#xff08;\u4f4e\u663e\u5b58\u3001\u8d85\u957f\u6587\u672c&#xff09;<\/span><br \/>\n&#8211;kv-cache-dtype int4<\/p>\n<p>Transformers \u914d\u7f6e<\/p>\n<p><span class=\"token keyword\">from<\/span> transformers <span class=\"token keyword\">import<\/span> GenerationConfig<\/p>\n<p>gen_config <span class=\"token operator\">&#061;<\/span> GenerationConfig<span class=\"token punctuation\">(<\/span><br \/>\n    use_cache<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    kv_cache_dtype<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;int8&#034;<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<h4>\u65b9\u6848 4&#xff1a;\u5e76\u53d1\u4e0e\u6279\u5904\u7406\u7cbe\u7ec6\u5316\u8c03\u4f18&#xff08;\u7ebf\u4e0a\u5fc5\u5907&#xff09;<\/h4>\n<p>\u63a7\u5236\u5e76\u53d1\u5e8f\u5217\u3001\u5f00\u542f\u52a8\u6001 batch\u3001\u8bbe\u7f6e\u7f13\u5b58\u8fc7\u671f&#xff0c;\u675c\u7edd\u50f5\u5c38\u7f13\u5b58\u5806\u79ef\u3002<\/p>\n<p>vllm serve your-model-path <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;max-num-seqs <span class=\"token number\">16<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;batch-size auto <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;cache-ttl <span class=\"token number\">300<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;kv-cache-dtype int8<\/p>\n<h4>\u65b9\u6848 5&#xff1a;\u66ff\u6362\u63a8\u7406\u5f15\u64ce&#xff08;\u6839\u6cbb\u539f\u751f\u7f3a\u9677&#xff09;<\/h4>\n<p>\u539f\u751f transformers \u65e0\u5206\u9875\u3001\u65e0\u6dd8\u6c70\u3001\u65e0\u81ea\u52a8\u56de\u6536&#xff0c;\u957f\u65f6\u95f4\u8fd0\u884c\u5fc5\u7136\u663e\u5b58\u6cc4\u6f0f\u3002<\/p>\n<p>\u66ff\u6362\u4e3a vLLM \/ TGI \u53ef\u83b7\u5f97\u6838\u5fc3\u4f18\u52bf&#xff1a;<\/p>\n<p>1\u3001PagedAttention \u5206\u9875\u7f13\u5b58&#xff0c;\u6781\u4f4e\u663e\u5b58\u788e\u7247&#xff1b;<\/p>\n<p>2\u3001LRU \u81ea\u52a8\u6dd8\u6c70\u95f2\u7f6e\u7f13\u5b58&#xff1b;<\/p>\n<p>3\u3001\u52a8\u6001\u6279\u5904\u7406\u3001\u7f13\u5b58\u590d\u7528&#xff0c;\u663e\u5b58\u5229\u7528\u7387\u5927\u5e45\u63d0\u5347&#xff1b;<\/p>\n<p>4\u3001\u539f\u751f\u652f\u6301 KV \u91cf\u5316\u3001\u6ed1\u52a8\u7a97\u53e3\u3002<\/p>\n<p>\u5b9e\u6d4b\u540c\u7b49\u6761\u4ef6\u4e0b&#xff0c;vLLM \u663e\u5b58\u5360\u7528\u6bd4\u539f\u751f transformers \u4f4e 30%~50%\u3002<\/p>\n<h3>\u4e94\u3001\u9ad8\u9891\u8e29\u5751\u6e05\u5355&#xff1a;\u907f\u5f00\u5168\u7f51 90% \u65e0\u6548\u6559\u7a0b<\/h3>\n<h4>\u5751 1&#xff1a;\u53ea\u91cf\u5316\u6743\u91cd&#xff0c;\u4e0d\u4f18\u5316 KV \u7f13\u5b58<\/h4>\n<p>\u6743\u91cd\u91cf\u5316\u53ea\u80fd\u51cf\u5c11\u52a0\u8f7d\u663e\u5b58&#xff0c;\u65e0\u6cd5\u89e3\u51b3\u63a8\u7406\u9636\u6bb5\u7f13\u5b58\u66b4\u6da8&#xff0c;\u5c5e\u4e8e\u6cbb\u6807\u4e0d\u6cbb\u672c\u3002<\/p>\n<h4>\u5751 2&#xff1a;use_cache&#061;False \u5173\u95ed\u7f13\u5b58<\/h4>\n<p>\u4e25\u91cd\u9519\u8bef\u3002\u5173\u95ed\u7f13\u5b58\u4f1a\u8ba9\u63a8\u7406\u901f\u5ea6\u66b4\u8dcc&#xff0c;\u6fc0\u6d3b\u503c\u663e\u5b58\u66b4\u6da8&#xff0c;OOM \u6982\u7387\u66f4\u9ad8\u3002<\/p>\n<h4>\u5751 3&#xff1a;\u53ea\u964d batch&#xff0c;\u4e0d\u9650\u5236\u5e8f\u5217\u957f\u5ea6<\/h4>\n<p>\u5355\u6761\u8d85\u957f\u6587\u672c\u7684 KV \u7f13\u5b58\u5f00\u9500\u8fdc\u5927\u4e8e\u5c0f batch \u77ed\u6587\u672c&#xff0c;\u4e0d\u63a7\u4e0a\u4e0b\u6587\u4f9d\u65e7\u4f1a\u5d29\u3002<\/p>\n<h4>\u5751 4&#xff1a;\u9760\u9759\u6001 nvidia-smi \u5224\u65ad\u74f6\u9888<\/h4>\n<p>\u9759\u6001\u603b\u663e\u5b58\u65e0\u6cd5\u533a\u5206\u6743\u91cd\u3001\u7f13\u5b58\u3001\u6fc0\u6d3b\u503c&#xff0c;\u6781\u6613\u8bef\u5224\u4f18\u5316\u65b9\u5411\u3002<\/p>\n<h4>\u5751 5&#xff1a;\u539f\u751f transformers \u8dd1\u7ebf\u4e0a\u9ad8\u5e76\u53d1<\/h4>\n<p>\u65e0\u7f13\u5b58\u6dd8\u6c70\u673a\u5236&#xff0c;\u957f\u671f\u8fd0\u884c\u5fc5\u663e\u5b58\u6cc4\u6f0f\u3001\u8fdb\u7a0b\u5d29\u6e83&#xff0c;\u4ec5\u9002\u5408\u672c\u5730\u8c03\u8bd5\u3002<\/p>\n<h3>\u516d\u3001\u603b\u7ed3<\/h3>\n<p>\u5927\u6a21\u578b\u63a8\u7406\u4e2d\u540e\u671f OOM\u3001\u663e\u5b58\u6301\u7eed\u66b4\u6da8\u7684\u6838\u5fc3\u5143\u51f6\u662f KV-Cache&#xff0c;\u800c\u975e\u6a21\u578b\u6743\u91cd\u3002\u56fa\u5b9a\u663e\u5b58\u53ef\u63a7\u7a33\u5b9a&#xff0c;\u52a8\u6001\u65e0\u63a7\u7684 KV \u7f13\u5b58\u624d\u662f\u957f\u6587\u672c\u3001\u591a\u8f6e\u5bf9\u8bdd\u3001\u9ad8\u5e76\u53d1\u573a\u666f\u663e\u5b58\u6ea2\u51fa\u7684\u6839\u672c\u539f\u56e0\u3002<\/p>\n<p>\u6807\u51c6\u6839\u6cbb\u601d\u8def&#xff1a;\u5b9a\u4f4d\u7f13\u5b58\u74f6\u9888 \u2192 \u526a\u679d&#043;\u91cf\u5316\u538b\u7f29\u663e\u5b58 \u2192 \u4f18\u5316\u63a8\u7406\u5f15\u64ce\u4e0e\u5e76\u53d1\u53c2\u6570&#xff0c;\u62d2\u7edd\u76f2\u76ee\u6362\u6a21\u578b\u3001\u964d\u7cbe\u5ea6\u3001\u5806\u786c\u4ef6\u3002<\/p>\n<p>\u672c\u6587\u5168\u5957\u6392\u67e5&#043;\u4f18\u5316\u65b9\u6848&#xff0c;\u53ef\u89e3\u51b3 99% \u7684 KV \u7f13\u5b58\u578b OOM \u95ee\u9898&#xff0c;\u9002\u914d\u672c\u5730\u90e8\u7f72\u3001\u4f01\u4e1a\u7ebf\u4e0a\u670d\u52a1\u3001\u957f\u6587\u672c\u95ee\u7b54\u7b49\u573a\u666f\u3002<\/p>\n<p>\u540e\u7eed\u4e13\u680f\u6301\u7eed\u66f4\u65b0\u5927\u6a21\u578b\u90e8\u7f72\u3001\u663e\u5b58\u6392\u9519\u3001vLLM \u9ad8\u9636\u8c03\u4f18\u3001\u5206\u5e03\u5f0f\u63a8\u7406\u5b9e\u6218\u5e72\u8d27&#xff0c;\u6b22\u8fce\u5173\u6ce8\u6301\u7eed\u8fdb\u9636\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6458\u8981&#xff1a;\u5927\u6a21\u578b\u63a8\u7406\u5e38\u51fa\u73b0\u663e\u5b58\u5145\u8db3\u4f46\u7a81\u53d1 OOM \u5d29\u6e83\u7684\u95ee\u9898&#xff0c;\u591a\u6570\u5f00\u53d1\u8005\u8bef\u5224\u4e3a\u6a21\u578b\u8fc7\u5927&#xff0c;\u5ffd\u7565\u4e86KV-Cache \u52a8\u6001\u663e\u5b58\u66b4\u6da8\u7684\u6838\u5fc3\u95ee\u9898\u3002\u672c\u6587\u901a\u4fd7\u62c6\u89e3 KV-Cache \u663e\u5b58\u81a8\u80c0\u539f\u7406&#xff0c;\u624b\u628a\u624b\u8bb2\u89e3 4 \u79cd\u663e\u5b58\u74f6\u9888\u5b9a\u4f4d\u65b9\u6cd5&#xff0c;\u7ed9\u51fa 5 \u5957\u53ef\u76f4\u63a5\u590d\u5236\u7684\u751f\u4ea7\u7ea7\u4f18\u5316\u65b9\u6848&#xff0c;\u5e76\u6c47\u603b\u5168\u7f51\u9ad8\u9891\u8e29\u5751\u8bef\u533a\u3002\u53ef\u9ad8\u6548\u89e3\u51b3\u957f\u6587\u672c\u3001\u591a\u8f6e\u5bf9\u8bdd\u3001\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u6e10\u8fdb\u5f0f\u663e\u5b58\u6ea2\u51fa\u95ee\u9898&#xff0c;\u663e\u8457\u63d0\u5347\u5927\u6a21\u578b\u90e8\u7f72\u7a33\u5b9a\u6027\u4e0e\u663e\u5b58\u5229\u7528\u7387\u3002\u5173\u952e<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10782,8115,10783,50,132],"topic":[],"class_list":["post-94121","post","type-post","status-publish","format-standard","hentry","category-server","tag-kv-cache","tag-oom","tag-10783","tag-50","tag-132"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5927\u6a21\u578b\u63a8\u7406 OOM \u6df1\u5ea6\u6392\u67e5\uff1aKV\u2011Cache \u662f\u5143\u51f6\uff01\u663e\u5b58\u66b4\u6da8\u5b8c\u6574\u5b9a\u4f4d + \u4f18\u5316\u5168\u5957\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/94121.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5927\u6a21\u578b\u63a8\u7406 OOM \u6df1\u5ea6\u6392\u67e5\uff1aKV\u2011Cache \u662f\u5143\u51f6\uff01\u663e\u5b58\u66b4\u6da8\u5b8c\u6574\u5b9a\u4f4d + \u4f18\u5316\u5168\u5957\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6458\u8981&#xff1a;\u5927\u6a21\u578b\u63a8\u7406\u5e38\u51fa\u73b0\u663e\u5b58\u5145\u8db3\u4f46\u7a81\u53d1 OOM \u5d29\u6e83\u7684\u95ee\u9898&#xff0c;\u591a\u6570\u5f00\u53d1\u8005\u8bef\u5224\u4e3a\u6a21\u578b\u8fc7\u5927&#xff0c;\u5ffd\u7565\u4e86KV-Cache \u52a8\u6001\u663e\u5b58\u66b4\u6da8\u7684\u6838\u5fc3\u95ee\u9898\u3002\u672c\u6587\u901a\u4fd7\u62c6\u89e3 KV-Cache \u663e\u5b58\u81a8\u80c0\u539f\u7406&#xff0c;\u624b\u628a\u624b\u8bb2\u89e3 4 \u79cd\u663e\u5b58\u74f6\u9888\u5b9a\u4f4d\u65b9\u6cd5&#xff0c;\u7ed9\u51fa 5 \u5957\u53ef\u76f4\u63a5\u590d\u5236\u7684\u751f\u4ea7\u7ea7\u4f18\u5316\u65b9\u6848&#xff0c;\u5e76\u6c47\u603b\u5168\u7f51\u9ad8\u9891\u8e29\u5751\u8bef\u533a\u3002\u53ef\u9ad8\u6548\u89e3\u51b3\u957f\u6587\u672c\u3001\u591a\u8f6e\u5bf9\u8bdd\u3001\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u6e10\u8fdb\u5f0f\u663e\u5b58\u6ea2\u51fa\u95ee\u9898&#xff0c;\u663e\u8457\u63d0\u5347\u5927\u6a21\u578b\u90e8\u7f72\u7a33\u5b9a\u6027\u4e0e\u663e\u5b58\u5229\u7528\u7387\u3002\u5173\u952e\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/94121.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-13T12:01:26+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/94121.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/94121.html\",\"name\":\"\u5927\u6a21\u578b\u63a8\u7406 OOM \u6df1\u5ea6\u6392\u67e5\uff1aKV\u2011Cache \u662f\u5143\u51f6\uff01\u663e\u5b58\u66b4\u6da8\u5b8c\u6574\u5b9a\u4f4d + \u4f18\u5316\u5168\u5957\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-13T12:01:26+00:00\",\"dateModified\":\"2026-08-13T12:01:26+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/94121.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/94121.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/94121.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5927\u6a21\u578b\u63a8\u7406 OOM \u6df1\u5ea6\u6392\u67e5\uff1aKV\u2011Cache \u662f\u5143\u51f6\uff01\u663e\u5b58\u66b4\u6da8\u5b8c\u6574\u5b9a\u4f4d + \u4f18\u5316\u5168\u5957\u65b9\u6848\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5927\u6a21\u578b\u63a8\u7406 OOM \u6df1\u5ea6\u6392\u67e5\uff1aKV\u2011Cache \u662f\u5143\u51f6\uff01\u663e\u5b58\u66b4\u6da8\u5b8c\u6574\u5b9a\u4f4d + \u4f18\u5316\u5168\u5957\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/94121.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5927\u6a21\u578b\u63a8\u7406 OOM \u6df1\u5ea6\u6392\u67e5\uff1aKV\u2011Cache \u662f\u5143\u51f6\uff01\u663e\u5b58\u66b4\u6da8\u5b8c\u6574\u5b9a\u4f4d + \u4f18\u5316\u5168\u5957\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6458\u8981&#xff1a;\u5927\u6a21\u578b\u63a8\u7406\u5e38\u51fa\u73b0\u663e\u5b58\u5145\u8db3\u4f46\u7a81\u53d1 OOM \u5d29\u6e83\u7684\u95ee\u9898&#xff0c;\u591a\u6570\u5f00\u53d1\u8005\u8bef\u5224\u4e3a\u6a21\u578b\u8fc7\u5927&#xff0c;\u5ffd\u7565\u4e86KV-Cache \u52a8\u6001\u663e\u5b58\u66b4\u6da8\u7684\u6838\u5fc3\u95ee\u9898\u3002\u672c\u6587\u901a\u4fd7\u62c6\u89e3 KV-Cache \u663e\u5b58\u81a8\u80c0\u539f\u7406&#xff0c;\u624b\u628a\u624b\u8bb2\u89e3 4 \u79cd\u663e\u5b58\u74f6\u9888\u5b9a\u4f4d\u65b9\u6cd5&#xff0c;\u7ed9\u51fa 5 \u5957\u53ef\u76f4\u63a5\u590d\u5236\u7684\u751f\u4ea7\u7ea7\u4f18\u5316\u65b9\u6848&#xff0c;\u5e76\u6c47\u603b\u5168\u7f51\u9ad8\u9891\u8e29\u5751\u8bef\u533a\u3002\u53ef\u9ad8\u6548\u89e3\u51b3\u957f\u6587\u672c\u3001\u591a\u8f6e\u5bf9\u8bdd\u3001\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u6e10\u8fdb\u5f0f\u663e\u5b58\u6ea2\u51fa\u95ee\u9898&#xff0c;\u663e\u8457\u63d0\u5347\u5927\u6a21\u578b\u90e8\u7f72\u7a33\u5b9a\u6027\u4e0e\u663e\u5b58\u5229\u7528\u7387\u3002\u5173\u952e","og_url":"https:\/\/www.wsisp.com\/helps\/94121.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-13T12:01:26+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/94121.html","url":"https:\/\/www.wsisp.com\/helps\/94121.html","name":"\u5927\u6a21\u578b\u63a8\u7406 OOM \u6df1\u5ea6\u6392\u67e5\uff1aKV\u2011Cache \u662f\u5143\u51f6\uff01\u663e\u5b58\u66b4\u6da8\u5b8c\u6574\u5b9a\u4f4d + \u4f18\u5316\u5168\u5957\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-13T12:01:26+00:00","dateModified":"2026-08-13T12:01:26+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/94121.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/94121.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/94121.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5927\u6a21\u578b\u63a8\u7406 OOM \u6df1\u5ea6\u6392\u67e5\uff1aKV\u2011Cache \u662f\u5143\u51f6\uff01\u663e\u5b58\u66b4\u6da8\u5b8c\u6574\u5b9a\u4f4d + \u4f18\u5316\u5168\u5957\u65b9\u6848"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/94121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=94121"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/94121\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=94121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=94121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=94121"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=94121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}