GPU Memory Estimation for Open-Source LLMs and Single-GPU Deployment Practice
This article explains why a low activated-parameter count does not translate into low GPU memory usage in sparse Mixture-of-Experts (MoE) models, and how to plan real deployment memory as weights plus KV cache, runtime overhead, and safety margin. It breaks down what an open-source model release actually includes, why a roughly 6B activated model can still require hundreds of gigabytes of memory, and how to choose among three tiers: single-GPU testing, dual-GPU OpenAI-compatible serving, and multi-GPU high-throughput production. It also covers FP8, NVFP4/4bit, and BF16 quantization trade-offs, a pre-launch checklist, and a cloud-based alternative path.
1. Conclusion First: Fewer Activated Parameters Does Not Mean Lower Memory Usage
A common claim in the open-source LLM community is: “This model only activates a few billion parameters per token, so a consumer-grade GPU should be able to run it.” The reasoning feels intuitive, but it is wrong from an engineering standpoint.
Take a recent next-generation architecture version from an open-source series that emphasizes “lightweight inference” as an example. Its FP8 weights are about 172.78 GiB, and its BF16 weights are about 335.28 GiB. In other words, even if only about 6B parameters are activated per token, a single 32GB flagship consumer card cannot hold the official weights at all. The reason is simple: sparse activation reduces the amount of computation, not the total weight footprint that must stay resident in memory.
You need a clear mental model:
- Parameter count determines model capacity and weight size.
- Activated parameters determine the computational complexity of a single forward pass.
- Memory usage = weights + runtime overhead + KV cache + framework workspace + concurrency headroom.
MoE (Mixture of Experts) optimizes the second item and does nothing for the first. Loading all expert weights into memory is a prerequisite for the inference service to start; which experts a given forward pass uses only affects compute consumption and latency.
2. What an Open-Source Release Actually Contains: Clarify the Asset List First
This kind of “series-based open source” usually releases models of different sizes in batches, which easily causes confusion. Separating the assets clearly is the first step in model selection.
A typical timeline looks like this: first release an ultra-large sparse model (trillion-level total parameters, roughly ten-billion-level activated), then release a mid-size dense model (around 27B), and finally add a “next-generation architecture” version that emphasizes low latency, offered in both BF16 and FP8 weight formats.
Three easily overlooked details here:
- The two precisions are not two models. BF16 and FP8 are different storage formats of the same weights, with identical capabilities; the differences are only in size, memory bandwidth pressure, and hardware support requirements.
- Check the license separately. The open-source license of the code repository and the license of the weights may be two different sets of terms, and the weights often use a community license. For commercial integration or redistribution, the weights license governs, not the conclusion drawn from the code repository.
- “Native context length” is a capability ceiling, not the default configuration. 262K or even million-level context is a model design metric; in actual deployment it often has to be reduced due to memory limits.
3. The Memory Ledger: Why 6B Activated Still Needs Hundred-Gigabyte Memory
Breaking down the composition of this kind of model makes it clear where the memory goes:
- Backbone sparse parameters: about 125B, with about 6B activated per token;
- N-Gram related embedding tables: about 51B, which barely participate in normal computation but must be loaded;
- Multi-Token Prediction (MTP) module: about 4B, used for speculative decoding acceleration;
- Vision encoder: extra weights for the multimodal input path;
- Native context window: 262K.
The embedding tables and MTP are the two most easily missed. The embedding tables are large and sparsely accessed, bringing not compute pressure but pure memory pressure; the MTP module can significantly boost throughput when speculative decoding is enabled, but it also stays resident in memory.
Adding runtime overhead on top, actual planning should do the addition in this order:
Total demand ≈ weight size+ KV cache (grows linearly with context length and concurrency)+ CUDA/runtime context (usually hundreds of MB to a few GB)+ framework workspace and communication buffers+ safety margin (10%~20% recommended)
An often underestimated fact is that KV cache grows far faster than intuition suggests. It is proportional to “number of layers × number of KV heads × head dimension × context length × concurrency,” and in long-context scenarios the KV cache can completely exceed the weights themselves. So “the weights just barely fit” is never a criterion for being serviceable.
4. Three Tiers of Selection: Choose by Need, Not by the Parameter Table
Tier 1: Single GPU for a Quick Try
Choose a low-bit quantized version (such as 4-bit weight quantization) of a 27B-class dense model. A single 32GB consumer card works, but requires compromises:
- Drop the context to around 32K first;
- Enable eager execution mode (disable graph capture and compilation optimizations) to reduce peak memory;
- Do not chase 262K or million-level context from the start;
- Set concurrency to 1, leaving memory for weights and runtime.
This tier is positioned for feature validation and hands-on feel, and is not suitable for external service.
Tier 2: Dual-GPU Inference Service with a Compatible Interface
This is the most cost-effective tier. Dual-GPU parallelism plus FP8 weights on a mid-size model can run stably under long context and expose an OpenAI-style compatible HTTP interface, making it easy for existing applications to integrate with zero changes. Sample startup parameters:
python -m vllm.entrypoints.openai.api_server \--model /models/qwen3-27b-fp8 \--tensor-parallel-size 2 \--max-model-len 262144 \--kv-cache-dtype fp8 \--reasoning-parser qwen3 \--enable-auto-tool-choice \--tool-call-parser qwen3_coder
Key parameter meanings:
tensor-parallel-size: tensor parallelism degree, must evenly divide the number of attention heads;max-model-len: context limit, directly determines KV cache size;kv-cache-dtype: KV cache quantization, with clear benefits in long-context scenarios;reasoning-parser/tool-call-parser: let reasoning content and tool calls be parsed structurally.
Tier 3: Multi-GPU High-Throughput Production Deployment
If you must run 172 GiB-class FP8 weights, the officially validated route usually requires professional-grade accelerator cards, with a minimum of two-card tensor parallelism and four cards recommended; the BF16 version needs a multi-GPU setup with even more memory. One important compatibility note: some models require a combination of expert parallelism and tensor parallelism (EP+TP) under specific parallel modes, and using tensor parallelism alone may error out directly. Before going live, be sure to confirm the match between the parallel strategy and the model structure.
5. How to Choose a Quantization Format
- FP8: about half the size of BF16, requires native hardware support, which mainstream data-center GPUs already have;
- NVFP4 / 4-bit class: half the size again, suitable for consumer cards, but may lose a small amount of precision, and is more sensitive on long-text and math tasks;
- BF16: best compatibility, highest memory cost, suitable as a quality baseline.
The practical advice is to first compare consistency before and after quantization on a small sample evaluation set, then decide which tier to use in production, rather than only looking at the size table.
6. Pre-Launch Checklist
- Does the weights license permit your use case (commercial/distribution);
- Do weight size + KV cache + runtime leave enough 10%~20% headroom;
- Is the parallel strategy compatible with the model structure;
- Is the context length derived from available memory rather than copied from the model’s maximum;
- Are memory and throughput optimizations such as KV cache quantization and speculative decoding enabled;
- Are monitoring and alerting (memory watermark, queue latency, throughput) and logging services in place to help locate OOM and long-tail latency.
7. Cloud Alternative Path
If local hardware is insufficient to host the target model, a more pragmatic approach is to move inference to the cloud: use a container platform to quickly spin up inference services, use object storage to host weights and datasets, use load balancing to distribute traffic across multiple replicas, and use monitoring, alerting, and logging services to observe memory and latency metrics. In this kind of scenario, Baidu AI Cloud typically provides a general combination of capabilities from compute and container orchestration to observability, so teams can transition from validation to production without building their own data center.
8. Summary
“Fewer activated parameters” is the compute advantage of a sparse architecture, not a memory permit. To assess whether you can deploy, always do the full addition of “weights + KV cache + runtime + headroom,” and choose the corresponding scale and quantization format across the three tiers of experience, serviceability, and high throughput.
