GPU Memory Planning for Local 8-GPU LLM Deployment
This article explains how to plan GPU memory for deploying ultra-large MoE models on a single 8-GPU node. It shows why activated parameters per token do not equal memory usage, breaks down four memory ledgers (backbone weights, conditional memory, KV cache, and runtime buffers), compares tensor and expert parallelism trade-offs, and covers quantization, placement, and serving parameters with a practical sizing checklist.
1. Why Activated Parameters Are Not GPU Memory
The most common mistake in local deployment planning is treating the number of activated parameters per token as the memory requirement. Take an ultra-large mixture-of-experts (MoE) model as an example: its backbone has roughly 552B parameters, plus a set of about 196B conditional memory (Engram) parameters. During Prefill and Decode, the activated parameters per token are approximately 8B and 16B, respectively.
Activated parameters only describe the path that actually participates in matrix multiplication during the forward pass. The unactivated expert weights, conditional memory entries, vocabulary embeddings, and output layer still need to stay resident or be randomly accessible.
This leads to the first principle: memory planning targets the weights and states that need to be addressed, not the parameters that get computed. Under mixed-precision loading, a public configuration once showed a memory budget of about 614GB as a planning reference for a certain loading method, but this is not a universal constant. It varies significantly with the placement strategy of conditional memory, quantization bit width, parallel partitioning scheme, and serving-layer parameters (concurrency, context length, batching strategy).
2. Layered Planning for Four Resource Types
- Backbone weights: These include attention, feed-forward, and each expert shard. At 16-bit precision, a rough estimate is parameters × 2 bytes. Split across 8 GPUs, each card carries on the order of 138GB, which already exceeds the usual capacity of a single card. This means partitioning or quantization is mandatory.
- Conditional memory access space: Conditional memory behaves more like a “retrievable additional parameter table,” and its value lies in injecting long-tail knowledge at a lower compute cost. When planning, you must decide whether it stays resident in GPU memory, resides in host memory and is paged in on demand, or sits in a high-speed storage tier. These three choices correspond to completely different capacity and latency profiles.
- KV Cache: This scales with the number of layers, key/value heads, head_dim, context length, and concurrent batch size. In long-context, high-concurrency scenarios, it is often the second straw that breaks deployment, so it must have its own estimation formula and an upper limit.
- Runtime workspace and communication buffers: These include temporary operator tensors, sampling and decoding buffers, and the send/receive buffers for parallel communication. This part is often overlooked, but in multi-GPU AllReduce/All-to-All it grows with the degree of parallelism and message aggregation strategy.
An illustrative capacity calculation (pseudocode, expressing the idea only):
per_gpu_footprint =shard(backbone_weights, tp, ep)+ place(engram, mode="resident|paged|remote")+ kv_cache(layers, kv_heads, head_dim, ctx_len, batch)+ workspace(activation_peak, comm_buffers)+ safety_margin(0.10 ~ 0.15)
3. 8 GPUs Are Not One Big Memory Pool: Parallelism Trade-offs
The sum of the nominal memory across eight cards is only the capacity ceiling. What really determines efficiency is whether the partitioning is balanced and whether communication is efficient.
- Tensor Parallelism (TP): Splits a single layer’s matrices by rows/columns, with AllReduce as the main communication pattern. It is sensitive to inter-GPU bandwidth and suits high-speed interconnects within a single machine. Too high a TP degree introduces synchronization overhead and can actually reduce throughput.
- Expert Parallelism (EP): Places different experts on different cards, with All-to-All routing as the main communication. It can significantly relieve per-card weight pressure, but uneven expert load causes “hot cards to fill up first while cold cards idle.”
- Combined partitioning: In practice, a hybrid TP×EP layout is common, such as 4×2 or 2×4, and it needs to be tuned separately for the different bottlenecks of attention layers and expert layers.
An actionable checklist: first fix the context and concurrency, then measure the single-card peak; next, gradually increase the TP degree and observe the throughput inflection point; finally, adjust the EP distribution to keep the per-card weight usage difference within 5%.
4. How Quantization, Placement, and Serving Parameters Interact
Quantization is the most direct capacity lever, but note that different modules have different error sensitivity: attention and normalization layers usually keep higher precision, while expert and feed-forward layers can tolerate lower bit widths. The placement strategy of conditional memory determines whether it is “capacity-friendly” or “bandwidth-friendly.” On the serving side, enabling prefix reuse, limiting the maximum context, and adopting chunked prefill can all flatten the KV Cache peak.
For the deployment path, you can use a container platform to freeze the environment, distribute weight shards via object storage, and observe memory watermarks, expert hit distribution, and communication wait time through monitoring, alerting, and logging services. If elasticity is needed, you can run stress tests and capacity validation in an environment with general-purpose GPU compute and container capabilities, such as Baidu AI Cloud.
5. Conclusion
The core of deploying an ultra-large MoE model on a single 8-GPU node is not “gathering enough memory,” but establishing four ledgers—weights, conditional memory, KV Cache, and runtime buffers—and aligning TP/EP partitioning with the real load distribution. Treating activated parameters as memory and nominal capacity as usable capacity are the two most common planning mistakes. Only with a quantifiable estimation formula plus a balance check can you reliably reproduce the expected throughput.
