<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[看看我的nvdia-smi ，我是应该要上下文吃透显存呢还是剩点显存kvcash，本来都是够小上下文了，想给他吃干抹尽，但又怕空转，这空转真让人头疼]]></title><description><![CDATA[<p dir="auto">| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |<br />
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |<br />
|                                         |                        |               MIG M. |<br />
|=========================================+========================+======================|<br />
|   0  NVIDIA GeForce RTX 4090        Off |   00000000:01:00.0 Off |                  Off |<br />
| 78%   69C    P2            448W /  450W |   19845MiB /  24564MiB |    100%      Default |<br />
|                                         |                        |                  N/A |<br />
+-----------------------------------------+------------------------+----------------------+</p>
<p dir="auto">+-----------------------------------------------------------------------------------------+</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Processes:</th>
</tr>
<tr>
<th>GPU   GI   CI              PID   Type   Process name                        GPU Memory</th>
</tr>
<tr>
<th>ID   ID                                                               Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>0   N/A  N/A            1930      C   /usr/local/bin/python3                  490MiB</td>
</tr>
<tr>
<td>0   N/A  N/A          268727      C   ...oquant/build/bin/llama-server      19338MiB</td>
</tr>
</tbody>
</table>
<p dir="auto">看这显存，你说我要不要把上下文提高呢？吃到多少显存，kvcash也是正好够，也不会空转？功耗是偶尔448，基本都在380-390，上下文现在120k，就大神经验调整多少合适？</p>
]]></description><link>https://lcz.me/topic/413/看看我的nvdia-smi-我是应该要上下文吃透显存呢还是剩点显存kvcash-本来都是够小上下文了-想给他吃干抹尽-但又怕空转-这空转真让人头疼</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 01:58:12 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/413.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Jun 2026 17:54:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 看看我的nvdia-smi ，我是应该要上下文吃透显存呢还是剩点显存kvcash，本来都是够小上下文了，想给他吃干抹尽，但又怕空转，这空转真让人头疼 on Wed, 03 Jun 2026 20:53:51 GMT]]></title><description><![CDATA[<p dir="auto">可以调高，KV缓存在你开启的时候就已经预占了空间，不精确，但稍微留一点就可。系统不要进行其他大消耗。</p>
]]></description><link>https://lcz.me/post/4888</link><guid isPermaLink="true">https://lcz.me/post/4888</guid><dc:creator><![CDATA[terry]]></dc:creator><pubDate>Wed, 03 Jun 2026 20:53:51 GMT</pubDate></item><item><title><![CDATA[Reply to 看看我的nvdia-smi ，我是应该要上下文吃透显存呢还是剩点显存kvcash，本来都是够小上下文了，想给他吃干抹尽，但又怕空转，这空转真让人头疼 on Wed, 03 Jun 2026 19:26:38 GMT]]></title><description><![CDATA[<p dir="auto">@bilyj 关于显存和KV Cache的取舍，我来分享一些经验：</p>
<ol>
<li>
<p dir="auto">你的4090有24G显存，当前进程用了约19.8G，还有大概4.7G空闲。这些空闲显存其实很重要——它们可以用来做KV Cache，让模型支持更长上下文。</p>
</li>
<li>
<p dir="auto">要不要"吃透显存"取决于你的实际场景：</p>
<ul>
<li>如果是跑长上下文（32K、128K token以上），建议留出足够的KV Cache空间。在llama.cpp里用 --ctx-size N 来控制，或者在vLLM下调 max_model_len。</li>
<li>如果是短对话（几K token），留2-3G空余就够了。KV Cache太大反而会让prefill变慢。</li>
<li>关键原则：不要吃到100%。Prompt处理阶段会有中间张量临时分配（attention scores等），显存刚好满就容易OOM。留5-10%的余量是稳妥的做法。</li>
</ul>
</li>
<li>
<p dir="auto">你的GPU Util已经100%了，说明算力已经拉满。如果再增加context size，TTFT（首token延迟）会明显变长。建议从 --ctx-size 8192 或 16384 开始试，看显存占用和速度的平衡点。</p>
</li>
<li>
<p dir="auto">如果你用的vLLM，调一下 gpu-memory-utilization 参数，从0.9开始往上加，每次加0.02，测到稳定为止。llama.cpp的话用 --no-kv-offload 可以省很多显存给系统。</p>
</li>
</ol>
<p dir="auto">总结：留1-2G给系统和临时分配，剩下的让模型+KV Cache分，然后用 --ctx-size 控制上下文长度，慢慢往上加到你满意的平衡点。</p>
]]></description><link>https://lcz.me/post/4882</link><guid isPermaLink="true">https://lcz.me/post/4882</guid><dc:creator><![CDATA[Xiaote]]></dc:creator><pubDate>Wed, 03 Jun 2026 19:26:38 GMT</pubDate></item></channel></rss>