领域深度 · 本地模型Field guide · Local models

本地模型:你的显卡能跑多大的模型Local models: how big a model can your GPU actually run?

你下载了一个模型,聊天框能打开,但一提问就卡住,或者答到一半开始重复。本地跑模型,先别问“快不快”,先算清楚显存、量化、缓存和并发。跑不动,速度没有意义。You downloaded a model. The chat box opens, but the first question stalls, or the answer starts repeating halfway through. Before asking “how fast”, work out memory, quantisation, cache and concurrency. If it does not run, speed means nothing.

适合谁For 手里有一张显卡,想在本机跑模型的人Anyone with a GPU who wants to run a model locally 读完能拿到You leave with 一张判断“这台机器能跑多大模型”的配置表,和一条最小启动路径A configuration sheet for “how large a model this machine can run”, plus a minimum start path 大概多久Time 先读 10 分钟;照着做约 1–2 小时10 minutes to read; 1–2 hours to follow 最后核对 2026-11-25Last checked 25 Nov 2026

本页是 Specul 的本地部署判断框架,不是显卡或模型的排名。规格、许可与价格以所链页面和原始来源为准。This is Specul’s decision framework for local deployment, not a ranking of GPUs or models. Specifications, licences and prices remain with the linked pages and original sources.

如果你只有 5 分钟If you only have five minutes
  1. 先算四本账:权重、量化、KV 缓存、并发。Work out four ledgers first: weights, quantisation, KV cache and concurrency.
  2. 用“装得下、答得完、速度能接受”定义能跑。Define “it runs” as: it fits, it finishes the answer, and the speed is acceptable.
  3. 先跑单用户,再谈多人服务。Get one user working before talking about a multi-user service.

完整版从下面开始;表格是查的时候用,不用背。The full guide starts below. Use the tables for reference; you do not need to memorise them.

拿一个具体活走一遍One concrete job

拿一个具体活走一遍:你有一张 24 GB 显卡,想跑一个 30B 模型,要求一次能读 8,000 字、每秒至少出 10 个字。先看它装不装得下,再看答不答得完。Take one concrete job: a 24 GB GPU, a 30B model, 8,000 characters of input and at least 10 output tokens per second. First check whether it fits; then check whether it finishes.

先保证同一模型、同一量化、同一上下文能稳定复现,再比较速度。没有写清上下文和并发的 tokens/s,不能跨机器比较。First make the same model, quantization and context reproduce reliably; then compare speed. A tokens-per-second figure without context length and concurrency is not comparable across machines.

1 · 五本账:权重、量化、KV 缓存、运行时、并发1 · Five ledgers: weights, quantization, KV cache, runtime, concurrency

权重只是第一本账。一个 8B 模型用 4-bit 量化,权重约 4 GB。但这不等于整机只占 4 GB。运行时还有计算图、临时缓冲、框架开销,长上下文还会额外占 KV 缓存。把「权重体积」当成「显存需求」,是本地部署最常见的低估。Weights are only the first ledger. An 8B model at 4-bit is roughly 4 GB of weights, but that does not mean the whole process occupies 4 GB. The runtime also needs graphs, temporary buffers and framework overhead; long contexts add KV cache. Treating weight size as memory requirement is the most common local-deployment underestimate.

第二本账是量化。4-bit 不是「无损压缩」:它换的是精度、速度和显存。不同量化格式、不同校准数据、不同后端支持,结果会不同。先确认运行时真的支持这种量化,再用自己的任务样本比较,而不是只看一个困惑度数字。The second ledger is quantization. 4-bit is not lossless compression: it trades accuracy, speed and memory. Different formats, calibration data and backend support produce different results. Confirm the runtime actually supports the format, then compare on your own task sample instead of trusting one perplexity number.

第三本账是 KV 缓存,随上下文长度和并发增长。第四本账是运行时,决定同样的权重能不能被高效加载、卸载和批处理。第五本账是并发,单用户测出来的速度,不能直接当生产容量。五本账要一起算,缺一本就会在压力下翻车。The third ledger is KV cache, which grows with context length and concurrency. The fourth is the runtime, which determines whether the same weights can be loaded, offloaded and batched efficiently. The fifth is concurrency: single-user speed is not production capacity. Count all five together; miss one and the system fails under pressure.

账本Ledger要算什么What to calculate最容易漏掉Most often missed
权重Weights参数量 × 每权重比特数,再留加载余量Parameters × bits per weight, plus loading headroom把参数量的字节数当显存Treating parameter bytes as VRAM
量化Quantization格式、校准、后端支持、精度损失Format, calibration, backend support, accuracy loss默认 Q4 等于原模型Assuming Q4 equals the original model
KV 缓存KV cache层数、头数、上下文长度、并发Layers, heads, context length, concurrency只按短对话估Estimating from a short chat only
运行时Runtime加载、卸载、批处理、计算图开销Loading, offload, batching, graph overhead把框架开销当零Treating framework overhead as zero
并发Concurrency同时请求数、批大小、排队与超时Concurrent requests, batch size, queueing, timeouts用单用户速度估生产Using single-user speed for production

↑ 回到目录↑ Back to contents

2 · 先定义「能跑」:四个必须同时成立的条件2 · Define “it runs”: four conditions that must all hold

「能跑」不是看到第一句话生成出来。它至少包含四个条件:不溢出显存。上下文能完整装下。输出在自己的样本上不离谱。首 token 和整段生成时间在可接受范围内。四个条件缺一个,这套配置就还不能拿来做下一步。“It runs” is not seeing the first sentence generated. It means four things at once: no VRAM overflow; the context fits; output is sane on your own sample; and time to first token plus total generation is acceptable. If one condition fails, the configuration is not ready for the next step.

先写一个固定样本:同一段输入、同一组问题、同一上下文长度、同一量化、同一运行时。每次只改一个变量。否则你无法判断变慢是量化、上下文、驱动还是散热造成的。这个固定样本也是后面算成本和验收的依据。Write a fixed sample first: same input, same question set, same context length, same quantization and same runtime. Change one variable at a time. Otherwise you cannot tell whether a slowdown comes from quantization, context, drivers or thermal throttling. This fixed sample also becomes the basis for cost and acceptance.

  • 显存:加载后留出足够余量,长上下文和并发峰值不溢出。VRAM: leave enough headroom after loading so long-context and concurrency peaks do not overflow.
  • 上下文:系统提示、对话历史、检索材料、输出预算都能装下,不被静默截断。Context: system prompt, history, retrieved material and output budget all fit without silent truncation.
  • 质量:在自己的任务样本上,关键字段、引用和拒答行为没有明显退化。Quality: on your own task sample, key fields, citations and refusal behaviour do not visibly degrade.
  • 时延:首 token 与整段生成时间能满足使用场景,而不是只看平均值。Latency: time to first token and total generation meet the use case, not just the average.
判断句:如果一套配置只能跑一次 demo,不能在同一输入上稳定复现,它还不算「能跑」。Rule of thumb: if a configuration only survives one demo and cannot reproduce on the same input, it does not yet count as “running”.

↑ 回到目录↑ Back to contents

3 · 运行时:单用户工具和多人服务不是一类东西3 · Runtime: a single-user tool and a multi-user service are different problems

llama.cpp、LM Studio、Ollama 和 vLLM 常被放在一张表里比较,但它们解决的不是同一个问题。前几类更偏单用户、桌面、快速验证和模型切换。vLLM 这类偏多人服务、连续批处理和吞吐。用桌面工具去扛生产并发,或用服务框架去调一个本地小实验,都会得到错误的结论。llama.cpp, LM Studio, Ollama and vLLM are often put in one comparison table, but they do not solve the same problem. The first group leans toward single-user desktop use, quick validation and model switching; vLLM-style servers target multi-user serving, continuous batching and throughput. Using a desktop tool for production concurrency, or a serving framework for a small local experiment, leads to the wrong conclusion.

选运行时先问四件事:模型格式支持吗。目标量化支持吗。需要 GPU 全量卸载还是部分卸载。是否需要批处理、并发和可观测性。四个问题里有一个是否定答案,就不要在速度上继续比较,先换运行时或换格式。Ask four questions before choosing a runtime: does it support the model format; does it support the target quantization; do you need full or partial GPU offload; do you need batching, concurrency and observability. If one answer is no, stop comparing speed and change the runtime or the format first.

场景Scenario更适合Better fit不太适合Poor fit先核对Check first
桌面试用、模型切换Desktop trials, model switchingLM Studio / Ollama 类工具LM Studio / Ollama-style tools高并发生产服务High-concurrency production格式、量化、内存占用Format, quantization, memory
单机深度调参Single-machine tuningllama.cpp 类后端llama.cpp-style backend完全不想碰命令行No command line at all编译选项、后端、卸载层数Build flags, backend, offload layers
多人 API 服务Multi-user API servingvLLM 类服务框架vLLM-style serving只想快速试一个模型Quick one-model trial批处理、并发、监控Batching, concurrency, monitoring
离线、断网环境Offline or air-gapped能本地加载权重的运行时Runtime that loads weights locally依赖云端鉴权Cloud-only auth许可、模型文件、更新方式Licence, model files, update path

↑ 回到目录↑ Back to contents

4 · 硬件:先看容量和带宽,再看型号4 · Hardware: capacity and bandwidth before model names

本地推理先被显存容量卡住,再被显存带宽和互联卡住。容量决定「能不能装下」。带宽决定「生成时等多久」。互联决定多卡是不是真的更快。只比较 TFLOPS 或只比较显存数字,都会漏掉另一半。Local inference is limited first by VRAM capacity, then by memory bandwidth and interconnect. Capacity decides whether it fits; bandwidth decides how long generation waits; interconnect decides whether multiple cards are actually faster. Comparing only TFLOPS or only VRAM misses half the problem.

笔记本、桌面和工作站又是三种约束。笔记本要看功耗墙、散热和是否支持独显直连。桌面要看电源、风道和长时负载。工作站要多看 ECC、通道和远程管理。把「峰值规格」当「持续能力」,是本地硬件选型里最贵的误判。Laptops, desktops and workstations are three different constraints. A laptop has power limits, cooling and direct-GPU-output support; a desktop has PSU, airflow and sustained load; a workstation adds ECC, lanes and remote management. Treating peak specifications as sustained capability is the most expensive mistake in local hardware selection.

多卡不是默认更快。模型能单卡装下时,多卡带来的切分、通信和同步开销可能吃掉收益。只有当容量必须扩、或吞吐必须提,才值得进入多卡。先测单卡,再决定要不要跨卡。Multiple GPUs are not automatically faster. When the model fits on one card, partitioning, communication and synchronisation can eat the gain. Go multi-GPU only when capacity must expand or throughput must rise. Measure one card before crossing cards.

判断句:先问「这个模型在这张卡上能不能完整装下」,再问「这张卡跑这个模型有多快」。顺序反了,就会买到一张跑分高但装不下的卡。Rule of thumb: ask whether the model fits on the card before asking how fast the card runs it. Reverse the order and you may buy a high-scoring card that cannot hold the model.

↑ 回到目录↑ Back to contents

5 · 速度:把 prefill 和 decode 分开看5 · Speed: separate prefill from decode

生成速度不是单一数字。prefill 处理输入,通常更吃算力。decode 逐 token 生成,通常更吃显存带宽。长提示会拉高首 token 时间,长输出会拉高总时长。量化和批处理又会改变两者的比例。只报一个 tokens/s,等于把两段不同的瓶颈混在一起。Generation speed is not one number. Prefill processes the input and is usually more compute-bound; decode produces tokens one by one and is usually more memory-bandwidth-bound. Long prompts raise time to first token; long outputs raise total time; quantization and batching change the ratio. A single tokens-per-second figure merges two different bottlenecks.

要得到可比较的数字,至少同时记录:模型、量化、上下文长度、输入长度、输出长度、批大小、硬件、运行时版本和散热状态。少一项,数字就只能在原地参考,不能拿去跨机器下结论。To get a comparable number, record at least: model, quantization, context length, input length, output length, batch size, hardware, runtime version and thermal state. Miss one and the number is only a local reference, not a cross-machine conclusion.

指标Metric主要受什么影响Mainly affected by怎么测How to measure别拿它做什么Do not use it for
首 token 时间Time to first token输入长度、prefill 算力、批处理Input length, prefill compute, batching固定输入,重复多次取分布Fixed input, repeat and take a distribution推断长对话体验Inferring long-chat experience
decode 速度Decode speed显存带宽、量化、批大小Memory bandwidth, quantization, batch size固定输出长度,记录每 token 间隔Fixed output length, record inter-token intervals代表整段生成时间Representing total generation time
整段时延End-to-end latency输入 + 输出 + 排队 + 重试Input + output + queueing + retries从请求到完整结果计时Time from request to complete result代表吞吐容量Representing throughput capacity

↑ 回到目录↑ Back to contents

6 · 成本:把闲置、电费和重试算进去6 · Cost: include idle time, electricity and retries

本地成本不是「显卡价格 ÷ 使用天数」。它至少包括:硬件折旧、电费、散热、运维时间、模型和依赖的更新、失败重试,以及闲置。只算满载运行时间,会把本地部署算得比实际便宜。Local cost is not “GPU price divided by days used”. It includes hardware depreciation, electricity, cooling, operator time, model and dependency updates, retries and idle time. Counting only full-load hours makes local deployment look cheaper than it is.

和 API 对比时,要把两边放在同一个任务量上:同样的请求数、同样的上下文、同样的重试率、同样的可用性要求。API 的单价容易看见,本地的人力、闲置和失败成本不容易看见。看不见的部分最容易让预算失真。When comparing with an API, put both on the same workload: same request count, same context, same retry rate, same availability requirement. API unit prices are visible; local labour, idle time and failure costs are not. The invisible part distorts budgets most.

一个实用做法:先算「每天必须跑多少小时」和「峰值必须支持多少并发」。如果每天只用两小时,本地硬件的闲置成本会很高。如果数据不能出本地,成本就不是唯一决策因素,但仍要把溢价写清楚。A practical approach: calculate how many hours per day the machine must run and how much concurrency the peak must support. If it runs only two hours a day, idle hardware is expensive. If data cannot leave the premises, cost is not the only factor, but the premium still needs to be written down.

↑ 回到目录↑ Back to contents

7 · 失败分支:先看现象,再看原因7 · Failure branches: symptom first, cause second

本地部署的失败很少是「模型不行」一个原因。显存溢出、上下文截断、量化退化、后端不匹配、散热降频和驱动问题,表现可能都像「答得不好」。先按现象分层排查,能避免把工程问题误判成模型问题。Local deployment failures are rarely just “the model is bad”. OOM, context truncation, quantization degradation, backend mismatch, thermal throttling and driver issues can all look like “bad answers”. Triage by symptom to avoid mistaking an engineering problem for a model problem.

加载就失败
先查什么:格式、量化支持、显存余量
常见处理:换格式或降量化,减少卸载层数
Fails on load
Check first: Format, quantization support, VRAM headroom
Common fix: Change format or lower quantization; reduce offload layers

跑一会就崩
先查什么:长上下文 KV、并发峰值、散热
常见处理:限上下文、限并发、改散热
Crashes after a while
Check first: Long-context KV, concurrency peak, thermals
Common fix: Cap context, cap concurrency, improve cooling

答非所问或重复
先查什么:量化退化、模板、采样参数
常见处理:换量化档,固定模板,降低随机性
Irrelevant or repetitive output
Check first: Quantization degradation, template, sampling
Common fix: Change quant tier, fix template, reduce randomness

越聊越慢
先查什么:上下文增长、缓存重算
常见处理:裁剪历史、启用缓存、分段总结
Slows down as chat grows
Check first: Context growth, cache recomputation
Common fix: Trim history, enable cache, summarise in segments

突然降速
先查什么:功耗墙、温度、驱动、后台占用
常见处理:查温度与功耗,回滚驱动,隔离负载
Sudden slowdown
Check first: Power limit, temperature, driver, background load
Common fix: Check temperature and power, roll back driver, isolate load

↑ 回到目录↑ Back to contents

8 · 最小落地路径8 · A minimum path to deployment

不要先买卡再找模型,也不要先装一个 70B 再想办法。按下面顺序走,任何一步不通过就停在那一步,不要带着未知往下堆。Do not buy a card before choosing a model, and do not install a 70B model and then improvise. Follow the order below; if a step fails, stop there instead of stacking unknowns.

  • 写清任务:输入是什么、输出是什么、失败时能不能重试、数据能不能出本地。Write the task: what goes in, what comes out, whether retries are allowed, whether data may leave the premises.
  • 选一个模型和一个量化档,先用最小可运行配置跑通,不追求最大参数。Pick one model and one quantization tier; get the minimum configuration running before chasing the largest model.
  • 用固定样本测四项:不溢出、上下文够、质量可接受、时延可接受。Test four things on a fixed sample: no overflow, enough context, acceptable quality, acceptable latency.
  • 记录模型、量化、上下文、批大小、硬件、运行时版本和散热状态。Record model, quantization, context, batch size, hardware, runtime version and thermal state.
  • 在真实并发下再测一次。如果排队或超时,先限流再扩硬件。Measure again under real concurrency; if queueing or timeouts appear, limit load before buying hardware.
  • 算三年账:折旧、电费、运维、重试、闲置,与同任务量 API 对比。Run a three-year sum: depreciation, electricity, operations, retries, idle time, against the same workload on an API.
  • 写失败分支:溢出、截断、降频、量化退化各自怎么处理,谁来判断。Write failure branches: overflow, truncation, throttling and quantization degradation, and who decides each.
  • 上线前留回滚:保留上一版模型、量化、运行时和配置,能一键退回去。Keep a rollback before launch: previous model, quantization, runtime and configuration, restorable in one step.
四个常见误区:只看参数量不看量化。把 Q4 当无损。拿单用户 tokens/s 当生产容量。把峰值规格当持续能力。Four common mistakes: looking only at parameter count; treating Q4 as lossless; using single-user tokens/s as production capacity; treating peak specs as sustained capability.

↑ 回到目录↑ Back to contents

来源与延伸阅读Sources and further reading

以下链接用于核对事实、许可证与官方口径。外部页面可能更新;引用时以原文与核验日为准。These links are for checking facts, licences and official scope. External pages may change; cite the original text and check date.

下一步Next

如果你照着做时卡住了,先回到对应主题路线,不要从头重读。If you get stuck while following it, go back to the matching route instead of rereading the whole guide.

← 回到首页← Back to home 发现错误?提交纠错Spot an error? Send a correction