Local LLM Selection and Deployment: A Practical Guide to Usable Speed, VRAM, and Quantization
This guide explains how to choose and deploy a local open-source LLM based on its usable decoding speed rather than parameter count alone. It covers a simple benchmarking method, how to convert parameter size into a VRAM budget, the trade-offs between sparse (Mixture-of-Experts) and dense architectures, choosing between 4-bit and 6-bit quantization, and the impact of context length on throughput. It also lists key runtime settings and a three-step decision path, then outlines when to move heavier workloads to the cloud.
1. The Real Problem: Local Deployment Is About the Usable Range, Not Just Whether It Runs
When developers first try to run an open-source LLM locally, the first question is usually “how large a model can my GPU handle.” But what actually determines the experience is not whether the model loads successfully; it is whether the decoding speed falls within an acceptable range. A common rule of thumb in the field is: below 10 tokens per second, interactive conversation feels noticeably laggy and long-form generation is nearly unusable; above 20 to 30 tokens per second, the reading experience approaches smooth; beyond 40 tokens per second, most people feel the model can “keep up with their thinking.”
So selection should work backward from the usable speed range, not forward from parameter count. Below is sample code for local benchmarking, so you can measure different configurations with a consistent methodology:
import timedef benchmark(generate, prompt, n_tokens=128):start = time.perf_counter()out = generate(prompt, max_new_tokens=n_tokens)elapsed = time.perf_counter() - startprint(f"tokens={len(out):d}, time={elapsed:.2f}s, "f"speed={len(out)/elapsed:.1f} token/s")
One point needs emphasis: a benchmark must hold three variables fixed—quantization precision, context length, and batch/concurrency settings. Change any one of them and the conclusion is no longer transferable.
2. VRAM Budget: Converting “Parameter Count” into “Bytes”
The first principle of local inference is simple: the VRAM occupied by model weights is roughly the parameter count multiplied by the number of bytes per parameter. Take 4-bit quantization as an example: each parameter is about 0.5 bytes, so a 30B-class model’s weights theoretically land near 15GB. Add the runtime overhead of the inference framework and the KV cache, and a 12GB GPU must rely on tiered “VRAM + system memory” loading, placing part of the weights in memory and having the CPU participate in computation.
This explains a common phenomenon: on a 12GB-class GPU, a 30B-class model at low-to-medium quantization precision can reach tens of tokens per second, while a dense model of roughly 27B may run at only single-digit speed. The difference is not parameter count, but architecture and the computation path.
3. Architecture Differences: The Divide Between Sparse Activation and Dense Computation
Two main architectures exist among current open-source models. One is sparse activation (Mixture-of-Experts), with a large total parameter count, but each token activates only a small subset of experts, so the actual computation is small. The other is dense, where every token passes through all parameters.
In scenarios where VRAM is constrained and memory bandwidth becomes the bottleneck, the advantage of sparse architectures is amplified: less weight reading, higher decoding speed, and smooth performance even with a larger total parameter count. Dense architectures are the opposite—every increase in parameter count causes speed to drop almost linearly.
But speed does not equal capability. In practice, a pattern can be observed: medium-scale sparse models perform well on general question answering, code snippet generation, and instruction rewriting, and they are indeed fast; but on tasks such as summarizing very long documents, maintaining cross-paragraph logical consistency, and demanding narrative coherence, they are often less stable than a smaller dense model in the same series, and their instruction-following consistency is more prone to fluctuation. The reason is not hard to understand: sparse activation calls only part of the parameters each time, so the path for integrating information across long distances is shorter, and the ability to model long-range dependencies is limited.
4. Quantization Trade-offs: The Value Proposition Between Q4 and Q6
Quantization is the technique of compressing floating-point weights into a low-bit representation. A common approach uses two tiers, 4-bit and 6-bit: the 4-bit option is smaller and faster, while the 6-bit option loses less precision and produces more stable generation quality.
The empirical conclusion is this: at the 12GB VRAM tier, running a 30B-class sparse model at 6-bit high-precision quantization can stay above 40 tokens per second with short context; switching to 4-bit can boost speed by about another 30 percent and still hold near 50 tokens per second with long context. If the task demands high format correctness and long-form structure, spending a bit more VRAM for 6-bit is usually worth it; if you prioritize interactive speed or need a longer context, 4-bit is the better fit.
5. Context Length: The Underrated Performance Variable
The impact of context length on speed comes from the KV cache: the longer the context, the larger the cache, and the more VRAM pressure and bandwidth consumption rise together. The measured pattern is roughly that stretching from a few thousand tokens to the 20,000-token level causes a 10% to 20% drop in decoding speed, but not a cliff-like collapse—provided the quantization precision is chosen conservatively enough.
This also leads to a counterintuitive conclusion: in very-long-context tasks, a dense model with fewer parameters is sometimes more reliable, because it performs more stably on long-range consistency and its speed decays more gently under long context. When selecting a model, treat “the context distribution of the main task” as a hard requirement, rather than looking only at peak speed under short prompts.
6. Key Runtime Configuration Points
- Turn off unnecessary thinking/reasoning modes. Some models output a chain of thought by default, which significantly increases token generation and latency; in scenarios that pursue response speed, this can be disabled via a switch field in the prompt template.
- Set the context window reasonably. Do not max it out at once; configure it in tiers according to task needs, to avoid the KV cache squeezing out weight space.
- Keep batch and thread parameters consistent. When the CPU participates in tiered computation, thread count and memory frequency have a clear impact on speed; it is recommended to fix the configuration before making comparisons.
- Build a reproducible evaluation set. Use a fixed set of 20 to 30 real tasks for regression, recording speed and output quality, to avoid switching models based on gut feeling.
7. Decision Path: Three Steps to Pick the Right Model
Step one, test a large dense model first. If your GPU can run it above 10 tokens per second at the target quantization, prefer it, since it has the highest capability ceiling.
Step two, if the speed is not adequate, do not force it; fall back to a medium-scale sparse model, which usually outperforms a smaller dense model on general tasks and offers sufficient speed.
Step three, if your main work is long-document summarization and analyzing large blocks of material, prioritize a small-parameter dense model, which is more reliable on long-context consistency and instruction stability.
8. When Local Is No Longer Enough
The value of local inference lies in keeping data on-device, being available offline, and having zero marginal cost. But when tasks require longer context, higher concurrency, or more stable quality, you can consider moving the workload to the cloud: use a container platform from a cloud provider to host a custom inference service, use object storage to archive models and datasets, and use logging and monitoring/alerting services to track latency and throughput metrics. In these scenarios, Baidu AI Cloud provides general cloud infrastructure capabilities, and enterprises can adopt a hybrid deployment according to their own compliance and cost requirements—keeping sensitive data local and placing heavy workloads in the cloud—forming a sustainable, evolving inference architecture.
