GPU Selection and VRAM Planning for Local LLM Deployment

    This guide explains how to select compute and plan VRAM when deploying large sparse (MoE) models locally. It shows why peak FLOPS is rarely the main bottleneck, how memory capacity, bandwidth, and interconnect determine feasibility, throughput, and concurrency, and how high-concurrency serving and low-concurrency interactive workloads impose different demands. It also covers quantization trade-offs, a reusable VRAM estimation script, layered hardware pools, parallelism strategies, monitoring, and common sizing mistakes.

    1. Reframing the Problem: Sparse LLM Deployment Is Not Bound by Peak Compute

    When a mixture-of-experts (MoE) model with hundreds of billions of parameters moves into a private deployment, many teams reach for more compute first. But looking at how inference actually consumes resources, peak floating-point throughput is rarely the primary constraint. MoE routing activates only a small fraction of the total parameters per token, so the actual matrix multiply-add work per token is far lower than in a dense model. At the same time, every layer’s routing and every attention computation must move weights and context state from VRAM into the compute units. As a result, VRAM capacity decides whether the model fits, VRAM bandwidth decides how fast it runs, and interconnect and scaling capability decide how many users it can serve.

    Three typical scenarios stress hardware in completely different ways:

    • Long-context inference (16K to 128K): the KV Cache grows roughly linearly with sequence length, so VRAM usage expands quickly.
    • Multi-user concurrent serving: batching combines multiple requests, raising throughput while intensifying contention for VRAM and bandwidth.
    • Routing and expert switching: expert weights do not all need to stay resident, but swapping them in and out depends on high bandwidth and enough spare capacity.

    The evaluation order should therefore be: VRAM capacity → VRAM bandwidth → inter-GPU interconnect and single-node scalability → engineering stability of driver and framework support → and only then peak compute.

    2. Evaluation Logic for Two Workload Types: Throughput First or Latency First

    1. High-Concurrency Online Serving: Bandwidth and Capacity Dominate

    Online inference services are usually measured by output tokens per second and the number of concurrent users that still meet an SLA. In this regime, high-bandwidth VRAM becomes more valuable: the more requests in a batch, the more fully weight reads are amortized, and bandwidth becomes the direct ceiling on throughput. Large VRAM capacity also holds more KV Cache blocks, supporting longer contexts and larger batches while reducing the jitter caused by preemption and recomputation.

    What matters most in engineering is tail latency. Batch scheduling, preemptive reclamation, and context swapping can push P99 latency far away from the mean. This is exactly why capacity headroom matters: leaving spare room gives the scheduler space to maneuver.

    2. Low-Concurrency Interactive Applications: Latency and Perceived Responsiveness Dominate

    Scenarios such as coding assistants and personal agents have very low concurrency, and users directly perceive time-to-first-token and the smoothness of token-by-token output. Here the bottleneck returns to memory access efficiency and kernel efficiency on the single-request path. One key prerequisite is that the low-latency advantage only holds when the model weights and the current context are fully resident in VRAM; once swapping across devices or nodes is triggered, latency degrades sharply. So low-concurrency selection cannot be based only on how fast a card is; it must also consider whether a single card can cover the target model size.

    3. VRAM Gaps and Quantization Strategy

    Quantization is the main way to fit a large model into limited VRAM, but it is “compression at a cost”:

    • Lower bit widths significantly reduce weight footprint and free up room for the KV Cache.
    • Compressing weights does not compress activations, so under long contexts the KV Cache can still be the dominant consumer.
    • Different layers vary in sensitivity to quantization error; attention and key projection layers usually need higher precision.
    • Dequantization and mixed-precision kernels add overhead, so real speedup must be measured and cannot be extrapolated linearly from theoretical bandwidth.

    A practical rule: estimate the KV Cache from the target context length and concurrency first, then work backward to the VRAM available for weights, and only then choose a quantization scheme, rather than picking quantization first and hoping it fits.

    3. A Reusable VRAM Estimation Method

    The sketch script below gives a starting point for capacity planning (the numbers are placeholders and should be replaced with measured values):

    1. def estimate_vram(params_b, bytes_per_param, layers, kv_heads,
    2. head_dim, ctx_len, batch, kv_bytes=2):
    3. weights = params_b * 1e9 * bytes_per_param # Weight footprint
    4. kv_per_token = 2 * layers * kv_heads * head_dim * kv_bytes
    5. kv_cache = kv_per_token * ctx_len * batch # KV Cache footprint
    6. overhead = (weights + kv_cache) * 0.15 # Runtime/activation/fragmentation headroom
    7. total = weights + kv_cache + overhead
    8. return total / 1e9
    9. # Example: low-bit quantization + medium context + small batch
    10. print(estimate_vram(671, 0.5, 61, 8, 128, 32768, 4))

    Three points need emphasis. First, for MoE the “total parameters” and “parameters activated per token” must be accounted for separately: the former determines VRAM, the latter determines compute demand. Second, results should reserve 15%–25% runtime headroom. Third, any estimate should be calibrated with measured data from real business text.

    4. Deployment Recommendations: Layered Selection and Elastic Scaling

    • Build layered pools: use high-bandwidth, large-VRAM devices for the main path of high-concurrency and long-context workloads; use devices with ample single-card VRAM and fast response for low-concurrency interaction and development/debugging; use general compute nodes for data cleaning, evaluation, and canary validation.
    • Frameworks and parallelism strategy: prefer inference frameworks that support continuous batching, paged KV Cache, and prefix reuse; tensor parallelism suits high-bandwidth interconnect within a node, pipeline parallelism suits cross-node scaling, and expert parallelism requires evaluating communication overhead and routing balance.
    • Stability engineering: set up monitoring and alerts for four categories—throughput, TTFT, P99 latency, and VRAM level—and use logging services for request-level tracing; when the capacity level stays above threshold for a long time, trigger scaling or a degradation strategy.
    • Elasticity and cost: a private cluster can pair a container platform with object storage for model version management and fast rollback; if traffic peaks are pronounced, a hybrid form of “resident baseline + cloud elastic peak” can absorb bursts using general containers and monitoring capabilities on platforms such as Baidu AI Cloud.
    • Unify acceptance criteria: run load tests with the real input-length distribution and concurrency curve of the business, and avoid overly optimistic conclusions drawn from idealized short prompts.

    5. Common Mistakes Checklist

    1. Looking only at peak compute while ignoring bandwidth and capacity, causing throughput to collapse under high concurrency.
    2. Estimating compute from total parameters and VRAM from activated parameters, mixing the two.
    3. Ignoring the KV Cache, so long-context scenarios overflow as soon as they go live.
    4. Assuming quantization always gives linear speedup without evaluating dequantization and kernel efficiency.
    5. Forcing a single card to handle an oversized model with no parallelism or degradation plan, so a failure takes down the whole site.

    In summary, local deployment of very large sparse models is essentially a three-way trade-off among capacity, bandwidth, and stability. Doing the estimation up front, running load tests for real, and completing monitoring and elasticity are what yield a truly deployable inference infrastructure within budget constraints.