Local Deployment of Large Language Models: A Practical Guide to Parameter Size, Quantization, and Hardware Selection
This article provides a practical framework for deploying open-source large language models locally. It covers how to estimate memory requirements based on parameter count and precision, explains the trade-offs of quantization, clarifies the difference between total and active parameters in MoE architectures, introduces key latency metrics, and outlines a reproducible benchmarking workflow. The goal is to help readers make informed decisions under real hardware constraints.
Defining the Problem: Can It Run, or Can It Be Used?
When a new open-source model is released, local deployers typically ask two questions: whether the model can be loaded on the hardware they have, and whether generation speed is acceptable once loaded. The answers depend on parameter size, numerical precision, inference framework, and hardware—not on the model’s advertised performance level.
It’s also important to distinguish between “models that can run” and “models that are usable.” A model that loads successfully does not necessarily offer acceptable interaction latency. A model generating only a few tokens per second may be suitable for offline batch processing, but not as a real-time conversational assistant. Therefore, the evaluation should begin by defining the use case, then determining acceptable memory usage and response speed.
Estimating Memory Usage
During local inference, memory is consumed by three main components: the model weights, the intermediate cache (commonly known as the KV Cache), and the framework’s runtime overhead. Model weights typically take up the largest share and can be estimated first.
The basic formula for weight memory usage is:
Weight Memory (GB) ≈ Number of Parameters (B) × Bytes per Parameter
The approximate number of bytes per parameter at common precisions:
| Precision | Bytes per Parameter | 9B Model Weight Estimate |
|---|---|---|
| FP16 / BF16 | 2 | ~18 GB |
| INT8 | 1 | ~9 GB |
| INT4 (4-bit quantization) | ~0.5 | ~4.5 GB |
In practice, an additional 10%–20% should be added for framework and runtime overhead, plus the KV Cache which scales with context length. The longer the context, the larger the KV Cache. When processing long documents, the cache can reach the same magnitude as the model weights, so it should not be overlooked.
A simple check can be implemented as follows:
def estimate_memory_gb(params_b, bytes_per_param, overhead=0.15, kv_cache_gb=1.0):weights = params_b * bytes_per_paramreturn weights * (1 + overhead) + kv_cache_gb# 9B model, 4-bit quantized, ~6 GB with an 8K contextprint(round(estimate_memory_gb(9, 0.5, kv_cache_gb=1.5), 1))
These figures are estimates only; actual measurements may vary. Since the operating system and other applications also consume memory, it is advisable to reserve at least 30% of available memory for them.
Quantization: Trading Precision for Size
Quantization converts weights from high-precision floating-point numbers into lower-bit integers. Lower bit widths reduce the model size and speed up loading, but also increase precision loss. The impact of quantization depends on the model architecture, the quantization method, and the specific task—there is no one-size-fits-all answer.
Three types of metrics are useful when evaluating a quantized model:
- Task Quality: Compare outputs across different quantized versions on your own business data, such as summarization accuracy, code pass rates, or QA correctness.
- Stability: Check for degradation in long-text handling, complex instructions, and multi-turn dialogue, such as repetitive outputs or formatting errors.
- Resource Usage: Record peak memory consumption, sustained temperature, and power draw.
A common rule of thumb is that 4-bit quantization preserves acceptable quality for most general-purpose tasks. Lower-bit quantization requires more careful validation. For tasks requiring strict accuracy, it is recommended to keep a higher-precision version as a baseline for comparison.
Mixture-of-Experts: Total Parameters vs. Active Parameters
Some models adopt a Mixture-of-Experts (MoE) architecture. These models contain a large number of parameters, but only a subset of experts is activated during each inference pass. It is therefore necessary to distinguish between “total parameters” and “active parameters.”
- Total parameters determine the storage required for the weights. Even if only a fraction is used per inference, the full set of weights typically needs to be loaded into memory.
- Active parameters determine the compute scale of each forward pass and mainly affect generation speed.
This means that an MoE model with a large total parameter count may have computational costs comparable to a much smaller dense model, while still requiring substantial memory. On personal computers, memory capacity is often the limiting constraint. Before choosing an MoE model, first confirm that the device can fit all the weights, then consider speed.
Latency Metrics: Time to First Token and Generation Speed
When evaluating inference speed, at least two metrics should be measured:
- Time to First Token (TTFT): The duration from request submission to the first generated token. It determines how fast the model appears to respond. Long prompts can significantly increase this metric.
- Tokens per Second: The number of tokens generated per second. It determines how quickly a long answer is completed.
During measurement, prompt length, output length, and temperature should be fixed, and the median of several runs should be taken to avoid misleading single-run fluctuations. System load should also be recorded, and other programs that use the GPU or memory should be closed.
A Reproducible Benchmarking Workflow
A repeatable local evaluation process can be structured as follows:
- Define the purpose: Determine the task type, such as writing, code assistance, document QA, or batch classification.
- Calculate the memory budget: Based on available memory and target context length, estimate feasible combinations of parameter size and precision.
- Prepare a test set: Collect 30–50 samples representative of real business use, covering short Q&A, long documents, and formatted outputs.
- Fix the environment: Record framework version, driver version, system version, and quantization method for reproducibility.
- Run benchmarks: Measure memory usage, speed, and quality separately, including peak memory, TTFT, tokens per second, and task quality.
- Compare and conclude: Use a table to record results and determine whether the model meets requirements, rather than relying on a single ranking.
The purpose of this workflow is to turn vague impressions like “fast” or “smart” into comparable numerical data.
Why Benchmark Scores Are Not Enough
Public leaderboards provide a rough reference but have several limitations. First, benchmark tasks may differ significantly from your specific use case. Second, some test sets may overlap with training data, leading to inflated scores. Third, leaderboards typically do not include memory usage or latency metrics, so they cannot directly guide hardware decisions.
Therefore, use public evaluations as an initial filter, then make final decisions based on your own data and local metrics. For organizational use, additional factors such as cost, privacy compliance, and maintenance effort should also be considered.
Conclusion: Decision-Making Recommendations
Deploying large language models locally is a trade-off under resource constraints. A practical decision sequence is:
- Set a memory ceiling first, eliminating model and precision combinations that cannot be loaded.
- Measure TTFT and generation speed, confirming that interactive experience meets requirements.
- Validate quality using your own test set, deciding whether a higher-precision version is necessary.
For most individual users, a mid-sized model with 4-bit quantization represents a balanced starting point. For enterprise scenarios, evaluation criteria should center on stability, auditability, and long-term maintenance costs. With this methodology in place, any newly released model can be reliably assessed for deployment within a short period.
