{"version":"v1","id":"local-llm-vram-calculator","matrix":"workflows","status":"live","updated":"2026-10-27","title":{"en":"Local LLM VRAM Calculator","zh":"本地大模型显存计算器"},"h1":{"en":"Local LLM VRAM Calculator (7B–120B, Q4–FP16)","zh":"本地大模型显存计算器（7B–120B，Q4–FP16）"},"description":{"en":"Estimate the VRAM needed to run an open model locally, including KV cache and overhead.","zh":"估算在本地运行开源模型所需的显存，含 KV 缓存与运行时开销。"},"answer":{"en":"VRAM = weights + KV cache + runtime overhead. Weights are parameters × bytes per parameter: a 70B model at 4-bit is roughly 39 GB before cache. Add about 2–4 GB of KV cache for 8K context, plus ~1 GB overhead — so plan on a 48 GB card, or a 64 GB+ unified-memory machine.","zh":"显存 = 权重 + KV 缓存 + 运行时开销。权重是参数量 × 每参数字节数：70B 模型 4-bit 约 39 GB。8K 上下文再加约 2–4 GB KV 缓存与约 1 GB 开销，因此要规划 48 GB 显卡，或 64 GB 以上统一内存机器。"},"keywords":{"en":["how much vram for 70b model","local llm vram calculator","llm quantization vram","kv cache size calculator","run llama 70b locally"],"zh":["70B 模型需要多少显存","本地大模型显存计算","KV 缓存计算","量化显存占用","本地部署 Llama"]},"formula":[{"title":{"en":"Weights: parameters × precision","zh":"权重：参数量 × 精度"},"body":{"en":"At 16-bit each parameter takes 2 bytes; at 4-bit about 0.5 byte plus quantization overhead. That is why Q4 turns a 140 GB FP16 model into roughly 40 GB of weights.","zh":"16-bit 时每个参数占 2 字节；4-bit 时约 0.5 字节再加量化开销。所以 Q4 能把 140 GB 的 FP16 模型压到约 40 GB 权重。"}},{"title":{"en":"KV cache grows with context","zh":"KV 缓存随上下文增长"},"body":{"en":"KV cache = 2 × layers × KV heads × head dimension × context length × bytes per value. Grouped-query attention cuts KV heads sharply, which is why modern 70B models need far less cache than older architectures.","zh":"KV 缓存 = 2 × 层数 × KV 头数 × 头维度 × 上下文长度 × 每值字节数。分组查询注意力大幅减少 KV 头数，所以现代 70B 模型比旧架构省很多缓存。"}},{"title":{"en":"Leave room for overhead","zh":"预留运行时开销"},"body":{"en":"CUDA context, activations, the inference server and fragmentation typically need 0.8–1.5 GB. Multi-user serving multiplies KV cache by concurrent sequences, not by weights.","zh":"CUDA 上下文、激活值、推理服务与显存碎片通常需要 0.8–1.5 GB。多用户并发会按并发序列数放大 KV 缓存，权重不变。"}},{"title":{"en":"Pick the tier, then verify","zh":"选档位，再实测"},"body":{"en":"Choose a GPU with more VRAM than the estimate, then test your real prompt lengths. If you fall short, reduce context, use a lower-bit quant, or offload layers to CPU — each trades speed or quality.","zh":"选一档比估算值更大的显卡，再用真实提示词长度实测。不够就降低上下文、用更低比特量化，或把部分层卸载到 CPU，代价是速度或质量。"}}],"faq":[{"q":{"en":"Can a 70B model run on 24 GB of VRAM?","zh":"70B 模型能在 24 GB 显存上跑吗？"},"a":{"en":"Not fully in VRAM at usable speeds. At 4-bit the weights alone are about 39 GB. You can offload layers to system RAM, but throughput drops sharply and long contexts become impractical.","zh":"无法以可用速度完整放进显存。4-bit 权重本身就约 39 GB。可以把部分层卸载到内存，但吞吐会明显下降，长上下文基本不可用。"}},{"q":{"en":"How much does quantization hurt quality?","zh":"量化会损失多少质量？"},"a":{"en":"At 8-bit the difference is usually small. At 4-bit it is measurable but often acceptable for chat and drafting; reasoning-heavy or code tasks degrade first. Test on your own prompts instead of trusting a single benchmark.","zh":"8-bit 通常差异很小。4-bit 有可测量的损失，但对聊天与草稿往往可接受；推理密集与代码任务最先退化。用自己的提示词实测，不要只看单一榜单。"}},{"q":{"en":"Does a Mac with unified memory count as VRAM?","zh":"Mac 的统一内存算显存吗？"},"a":{"en":"It works like VRAM for inference: the GPU can address a large shared pool. A 64 GB Mac can hold a 70B Q4 model, but memory bandwidth is lower than a discrete GPU, so tokens per second will be lower.","zh":"推理时效果类似显存：GPU 可以访问大块共享内存。64 GB 的 Mac 能装下 70B Q4，但内存带宽低于独立显卡，每秒生成 token 数会更低。"}},{"q":{"en":"Why does the estimate differ from what my tool reports?","zh":"为什么和推理工具显示的不一样？"},"a":{"en":"Different runtimes reserve different workspaces, use different KV precisions and pre-allocate for the full context. The estimate is a planning number, not a guarantee; check the runtime’s own memory report after loading.","zh":"不同运行时会预留不同工作区、使用不同 KV 精度，并按完整上下文预分配。这里给的是规划值，不是保证值；加载后看运行时自己的显存报告。"}}],"sources":[{"label":"llama.cpp — GGUF quantization and memory behaviour","url":"https://github.com/ggml-org/llama.cpp"},{"label":"Meta Llama 3.1 70B model card (config)","url":"https://huggingface.co/meta-llama/Llama-3.1-70B-Instruct"},{"label":"Hugging Face — Quantization overview","url":"https://huggingface.co/docs/transformers/main/en/quantization/overview"}],"localized":{"en":{"url":"https://www.sogoh.com/tools/local-llm-vram-calculator/"},"zh":{"url":"https://www.sogoh.com/zh/tools/local-llm-vram-calculator/"}},"license":"Free to reuse with attribution and a link to the source page."}