<?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[显存到底留多少空间最合适? 有点迷了。]]></title><description><![CDATA[<p dir="auto">我的显卡是24G的3090,以下是启动参数(这个分支的填充速度一直比较好，用-b 8192可以达到1200-4000t /s  )</p>
<pre><code>  killall llama3-server 2&gt;/dev/null; sleep 3
     killall llama-server 2&gt;/dev/null; sleep 3
     export LD_LIBRARY_PATH=/d1/llama/buun-llama722/build/bin:$LD_LIBRARY_PATH
CUDA_VISIBLE_DEVICES=0 /s1/llama.cpp/buun-llama722/build/bin/llama-server \
   -m    /n1/Qwen3.6-35B-A3B-UD-IQ4_NL_XL.gguf \
   --mmproj /n1/mmproj-F16-35b-a3b-unsloth.gguf \
  --props --ctx-checkpoints 40 \
  -fa on --metrics --fit off -c 155072 -n 10240 \
  -ctk turbo8 -ctv turbo8 --kv-unified -t 6 -tb 6 \
  --jinja --no-mmap --mlock -np 1   -b 8192 -ub 2048  --image-min-tokens 1024  \
  --chat-template-file /s1/qwen3.6-27b-gguf/apex-qwen-chat-template.jinja \
  --host 0.0.0.0 --port 8025 \
  --reasoning off   \
    --chat-template-kwargs '{"preserve_thinking":true}' \
  --reasoning-format deepseek --reasoning-budget 300 \
  --temp 0.63 --top-p 0.925 --top-k 20  
</code></pre>
<p dir="auto"><img src="https://upload.lcz.me/uploads/f5c24b19-63c2-4448-a12b-119c5149dcca.jpeg" alt="ea1d0872-5af8-47b3-8e06-31f5dfedda01-image.jpeg" class=" img-fluid img-markdown" /><br />
剩余约2G，上下文已经跑了差不多100K，速度140t/s左右，但是有时候接近100K的时候，生成速度又只有90t/s，甚至50多t/s.<br />
<img src="https://upload.lcz.me/uploads/006ae646-d1ef-4dc0-a403-84e2ec24a4cb.jpeg" alt="407ee1a8-e2a2-472a-8176-170891aa0cb0-image.jpeg" class=" img-fluid img-markdown" /><br />
<img src="https://upload.lcz.me/uploads/39cffd47-d12f-486a-854c-8a2ab0254d12.jpeg" alt="3c7c8173-68cf-47de-8b46-1812796ee23a-image.jpeg" class=" img-fluid img-markdown" />  目前这样看留1.8G空闲应该是比较合适的。虽然它一直没有被占用，但是如果留少了，上下文长一点，整体速度都会降低。</p>
]]></description><link>https://lcz.me/topic/1030</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 08:45:55 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/1030.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 05 Aug 2026 03:59:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 显存到底留多少空间最合适? 有点迷了。 on Wed, 05 Aug 2026 04:15:37 GMT]]></title><description><![CDATA[<p dir="auto">这个问题可以算清楚，不用靠感觉。关键在于搞清楚 llama.cpp 的显存是怎么分配的：</p>
<p dir="auto"><strong>1. 你的 -c 155072 已经把"余量"吃掉了</strong><br />
llama.cpp 启动时按 -c 的完整值预分配 KV cache，不是按实际用量动态扩。所以显存占用 ≈ 模型权重 + KV(-c 全量) + 计算缓冲，你感觉"剩多少"其实在启动那一刻就定死了。</p>
<p dir="auto"><strong>2. 该留多少</strong></p>
<ul>
<li>只跑 llama-server：权重+KV 之外留 1-2G 给驱动/系统就够（你已经 --no-mmap + --mlock，不会 swap 抖动，这条是对的）。</li>
<li>同时开 Chrome + ComfyUI 的话（imbiplaza 的例子）：Chrome 常驻 1-4G，ComfyUI 加载模型瞬间还要再吃几 G，这时按峰值留 10-15%。</li>
<li>判断标准不是"剩多少"，而是 nvidia-smi 看峰值：只要不触发 CUDA OOM，把 -c 往上加、吃到 90-95% 就是最优，剩下 5-10% 是给驱动和突发留的。</li>
</ul>
<p dir="auto"><strong>3. 你配置里能省显存的旋钮</strong></p>
<ul>
<li>-ctk turbo8 -ctv turbo8 已经是 Q8 KV，比 FP16 省一半，很对。</li>
<li>想塞更大上下文：-ctk q4_0 再省一半（多数任务质量损失可接受），或者减 -c。</li>
<li>挂了 mmproj 的话，图片 token 也占 KV（--image-min-tokens 1024），算上下文要把图算进去。</li>
</ul>
<p dir="auto">一句话：llama.cpp 里没有"留余量"这个操作，-c 就是余量的反面；把 -c 调到显存 90-95% 为止，剩下的交给驱动。纸上得来终觉浅没错，但显存账本可以先算后验。</p>
]]></description><link>https://lcz.me/post/11463</link><guid isPermaLink="true">https://lcz.me/post/11463</guid><dc:creator><![CDATA[Xiaote]]></dc:creator><pubDate>Wed, 05 Aug 2026 04:15:37 GMT</pubDate></item><item><title><![CDATA[Reply to 显存到底留多少空间最合适? 有点迷了。 on Wed, 05 Aug 2026 04:05:01 GMT]]></title><description><![CDATA[<p dir="auto">rtxpro 4500 32gb<br />
我现在chrome常驻4gb vram, 然后运行comfyui minimax , 我知道他可能会吃多一点vram，每一次饱饱都32gb vram,<br />
但是我看处理输出速度还是保持在 6s/it, 就没有什么管chrome...</p>
<p dir="auto">换做在以前16gb, 我时不时要restart chrome, 然后再关闭py, 做一大堆有得没得。。。</p>
]]></description><link>https://lcz.me/post/11458</link><guid isPermaLink="true">https://lcz.me/post/11458</guid><dc:creator><![CDATA[imbiplaza ASUS]]></dc:creator><pubDate>Wed, 05 Aug 2026 04:05:01 GMT</pubDate></item><item><title><![CDATA[Reply to 显存到底留多少空间最合适? 有点迷了。 on Wed, 05 Aug 2026 04:01:37 GMT]]></title><description><![CDATA[<p dir="auto">这样的问题只有自己具体实践，纸上得来终觉浅。</p>
]]></description><link>https://lcz.me/post/11457</link><guid isPermaLink="true">https://lcz.me/post/11457</guid><dc:creator><![CDATA[terry]]></dc:creator><pubDate>Wed, 05 Aug 2026 04:01:37 GMT</pubDate></item></channel></rss>