Local LLM Deployment: A Practical Guide to VRAM and Workload Assessment
This guide explains why GPU count cannot be derived from active parameter count alone when deploying large models locally. It covers how to estimate VRAM for full weights, runtime overhead, and KV Cache, how to work backward from context length, concurrency, workload type, and acceptance targets, and how to build meaningful baselines, avoid common pitfalls, and follow a repeatable deployment workflow.
1. The Bottom Line: Deployment Is Not Just “How Many GPUs Do I Need?”
When teams face a native multimodal model with 320 billion total parameters and roughly 18 billion active parameters, the first instinct is often to do a division: convert active parameters into VRAM, divide by single-GPU capacity, and call that the GPU count. This approach does not hold up in engineering practice.
A more sound decision path is to first settle on the precision and how weights will be placed, then check whether a single node can hold the full weights plus runtime space. If the business genuinely requires ultra-long context (for example, a million-token window), prioritize node configurations with higher per-GPU VRAM and bandwidth and stronger inter-GPU interconnect. Even with such a reference path, however, it is only a starting point, not the answer.
What actually determines the final configuration are four business-side variables: context length, concurrency, request type, and response targets (the trade-off between time to first token and sustained throughput). Any GPU count derived without these four items is nearly impossible to put into practice.
2. Why Active Parameters Cannot Be Used to Calculate VRAM
The defining feature of large-scale MoE (Mixture of Experts) models is sparse activation: each token is routed to only a few experts for computation, so compute consumption per inference is far lower than that of a dense model with the same total parameters. But VRAM usage and compute consumption are two different accounts.
- Weights must be resident in full. All expert weights need to stay ready in VRAM; otherwise every routing step would swap them in and out from host memory or storage, making latency uncontrollable.
- Runtime space cannot be ignored. The framework’s own buffers, communication buffers, temporary tensors, and quantization metadata all consume a noticeable amount of VRAM.
- KV Cache grows linearly with context and concurrency. It is not determined by parameter count but jointly by the number of layers, attention heads, sequence length, and concurrent requests, and it is often the largest VRAM consumer in long-context scenarios.
- Multimodal inputs further amplify Prefill overhead. Image, audio, and video inputs are encoded into large numbers of visual or audio tokens, effectively equivalent to an ultra-long prompt.
The correct estimate is therefore: full weights + framework and communication overhead + KV Cache (based on target context × concurrency) + safety margin.
3. Four Questions to Work Backward from Business Needs
- Context: Is the real daily requirement 32K, 128K, or genuinely 256K and even million-level? Every doubling of the window noticeably changes both KV Cache and time to first token.
- Concurrency: Single-user validation, shared lab use by multiple people, or an externally offered API service? Concurrency determines batching strategy and peak VRAM usage.
- Workload: Which is the primary scenario—intelligent conversation, intelligent coding tools, retrieval-augmented generation, or long-document analysis? Different scenarios have completely different sensitivity to latency and throughput.
- Acceptance: Is it enough for the service to start, or are there explicit targets for time to first token, sustained throughput, and long-run stability? Testing without acceptance criteria cannot converge.
Write these four items as concrete numbers, then work backward to the node count and the memory-to-storage ratio, and configuration turns from “guessing” into “calculating.”
4. How to Build Baselines That Are Actually Useful
Build a baseline on a single node with tensor parallelism and a fixed context length, and disable all acceleration features first to obtain clean comparison data. Typical observed patterns are:
- With short requests, different inference frameworks each have advantages in time to first token and output throughput.
- As the prompt grows longer, the implementation responsible for scheduling and cache reuse often performs better on time to first token, while another implementation has slightly higher sustained output throughput.
This shows there is no universally “faster” option. The right approach is to run A/B tests with the real prompt distribution and real concurrency, with metrics including at least time to first token, per-user output rate, overall throughput, tail latency on long requests, and error rate.
Illustrative load-testing pseudocode:
# Pseudocode: illustrates the load-testing flow only, not tied to any specific framework APIfor concurrency in [1, 4, 16, 64]:for prompt_len in [2_000, 32_000, 128_000]:stats = run_benchmark(prompts=sample_real_prompts(prompt_len),concurrency=concurrency,duration="10min",)report(stats, metrics=["ttft", "tpot", "throughput", "p99", "error_rate"])
5. Common Pitfalls
- Maxing out context on the first launch. First run the window commonly used in business stably, then scale up step by step, recording VRAM and latency changes at each step.
- Not locking versions. Model weights, inference framework, compute libraries, drivers, kernel, and custom operators should be version-locked as a whole; otherwise troubleshooting falls into mutual blame.
- Treating multi-GPU deployment as “adding up total VRAM.” In practice it is also constrained by inter-GPU interconnect topology, collective communication efficiency, host memory and PCIe bandwidth, and local storage read/write capability; if any link becomes the bottleneck, adding GPUs loses its meaning.
- Turning on all optimizations at once. Speculative decoding, prefix caching, quantization, and parallelism strategy adjustments should be enabled one by one, each with a baseline comparison, so problems can be located quickly.
- Lacking monitoring. At minimum, collect VRAM usage, batch size, queueing time, cache hit rate, and tail latency, and form a closed loop with logging services and monitoring alerts.
6. A Reusable Implementation Workflow
- Define business metrics: context, concurrency, primary workload, and acceptance thresholds.
- Estimate resources: full weights + runtime overhead + KV Cache + margin.
- Establish a minimal baseline: disable optimizations, get it running, and keep records.
- Optimize item by item: change only one variable at a time, recording benefits and costs.
- Re-validate under load: verify with a real traffic model and observe long-run stability.
- Lock down the environment: version the image, versions, and parameter templates together for easy reproduction and scaling.
7. Conclusion
“Can it start on a single node” and “can this configuration support the business” are two questions at different levels. The former can be answered by one successful startup; the latter requires bringing real requests, context length, concurrency, and acceptance targets into testing together. In practice on cloud platforms such as Baidu AI Cloud, it is also advisable to use general capability categories (such as container platforms, object storage, logging services, and monitoring alerts) to carry environment lockdown and observability, so that capacity planning is built on reproducible data rather than inference from model specifications.
