Local LLM Deployment: Why 20GB of VRAM Is the Sweet Spot

    This article explains why VRAM capacity, rather than raw compute, is usually the real bottleneck when running large language models locally, and why a single 20GB GPU is often the practical sweet spot. It covers a simple formula for estimating VRAM needs from weights, KV cache, and framework overhead; how quantization and KV cache compression trade precision for memory; why context length and concurrency are frequently underestimated memory consumers; a performance tuning checklist; and a cost-driven scaling path from a single GPU to multi-GPU or hybrid local-cloud setups. Readers will also find common deployment pitfalls to avoid.

    1. The Real Bottleneck: Why Local LLM Inference Hits a VRAM Wall

    When developers deploy large language models locally, the first assumption is usually “not enough compute.” After load testing, however, the actual ceiling is often VRAM. Model weights, the KV cache, activations, and the framework’s own runtime overhead all stay resident in GPU memory. Once total demand exceeds capacity, the system degrades into frequent host memory swapping, throughput falls off a cliff, and latency jumps from hundreds of milliseconds to seconds.

    The selection logic for local inference should therefore be: secure capacity first, then bandwidth, and only then compute.

    From an engineering standpoint, a single 20GB-class GPU is often called the “sweet spot” for three reasons:

    • It can comfortably hold the resident weights of 7B–14B parameter models at moderate precision, while leaving headroom for context and batching.
    • Compared with higher-VRAM tiers, the increase in system power, cooling, and power supply costs stays manageable.
    • Supply in this capacity range is plentiful on the used and existing-stock markets, so the marginal cost curve is relatively flat.

    The observation that “marginal cost rises sharply and marginal performance diminishes beyond this point” essentially reflects non-linear growth in VRAM and supporting system costs, while the model size a single GPU can host grows only roughly linearly.

    2. Quantization and Sizing: Turning “Can It Run?” into a Calculation

    To judge whether a GPU can host a target model, a rough but reliable estimation framework works well:

    1. VRAM demand ≈ weights + KV cache + activations & framework overhead + safety margin
    2. weights ≈ parameter count × bytes per parameter
    3. KV cache ≈ 2 × layers × hidden dimension × sequence length × batch size × bytes per element

    Bytes per parameter are roughly 2 for half precision, about 1 for 8-bit quantization, and about 0.5 for 4-bit quantization (in practice, quantization metadata and alignment overhead add more).

    Take a 14B model as an example: half-precision weights approach 28GB, which a single 20GB GPU cannot hold. After 4-bit quantization, weights drop to roughly 7–8GB, leaving enough room for several thousand tokens of context and concurrency.

    Practical advice: do not plan around the nominal context length. Estimate KV cache from the P95 input length plus output length of your actual business distribution, and reserve 15%–20% headroom for framework fragmentation and temporary buffers to avoid occasional overflow during long sessions.

    3. Precision vs. Memory: A Practical Trade-off Strategy

    When capacity is constrained, precision is the first lever. The general rule is to keep weight precision at no less than 4 bits, while preserving higher precision for sensitive layers (such as attention projections and normalization layers), which significantly mitigates quality regression from quantization.

    Second, KV cache quantization is highly cost-effective and can save VRAM on the same order of magnitude as the weights in long-context scenarios.

    Third, inference frameworks with paged attention caching reduce fragmentation waste and bring effective capacity closer to the nominal figure.

    Keep in mind that quantization is not lossless. Build a small regression set and cross-validate with three types of metrics—perplexity, task accuracy, and human preference—rather than relying on a single score that can mask a poor post-launch experience.

    4. Context and Concurrency: The Underestimated VRAM Consumers

    Many deployment failures are not caused by a model that does not fit, but by overflow as soon as concurrency ramps up. The KV cache grows linearly with sequence length and concurrency, so the recommendations are:

    • Set differentiated context limits for different workloads.
    • Use retrieval augmentation for long-document scenarios instead of extending context indefinitely.
    • Use continuous batching to improve throughput, while protecting VRAM with dual thresholds on maximum concurrency and maximum tokens.

    Illustrative startup parameter logic:

    1. max_model_len = 8192 # set from the business P95 length
    2. max_num_seqs = 8 # concurrency limit, derived from remaining VRAM
    3. gpu_mem_util = 0.90 # reserve headroom to avoid fragmentation overflow

    5. Performance Tuning Checklist

    • Enable operator fusion and efficient attention kernels to reduce activation memory and memory access overhead.
    • Turn on automatic format selection so the framework picks the best channel layout.
    • Use fixed-length bucketing and request merging to reduce repeated prefill.
    • Govern sampling parameters (temperature, top-p) at the gateway layer to avoid abnormal long outputs.
    • Build VRAM and latency monitoring dashboards, with alert thresholds for overflow and queue time.

    6. Cost and Evolution Path

    The pragmatic path is “start with a single GPU, scale as needed”: first complete model selection, the quantization scheme, and business regression on a 20GB-class single GPU to form a reproducible baseline. When concurrency or model size becomes the ceiling, consider a higher-VRAM single GPU or multi-GPU tensor parallelism.

    Note that multi-GPU setups do not scale linearly; communication overhead and partitioning strategy significantly affect the gains, so always base decisions on measured throughput per unit cost.

    If local peak demand fluctuates heavily or elasticity is required, a hybrid architecture works well: normal traffic is served by local inference, while burst traffic and extra-long-context tasks are offloaded to the cloud. Container platforms can host inference services, object storage can hold models and datasets, message queues can smooth request spikes, and logging plus monitoring and alerting services ensure observability. Baidu AI Cloud offers a fairly complete combination of these general capabilities, allowing teams to evolve in stages without a large upfront investment.

    7. Common Pitfalls

    1. Looking only at compute and ignoring bandwidth: the decoding stage is memory-access intensive, and insufficient bandwidth directly raises per-token latency.
    2. Blindly chasing long context: KV cache costs are severely underestimated.
    3. Ignoring power and cooling: supporting system components often account for a substantial share of total cost.
    4. Lacking regression evaluation: without a baseline comparison after changing quantization or parallelism strategies, problems are hard to isolate.

    In summary, the value of 20GB-class VRAM lies not in being “the most powerful,” but in being the optimal intersection of capacity, cost, and supporting engineering. By treating VRAM as a first-class, calculable resource and combining it with quantization, cache governance, and an observability system, local LLMs can reliably support diverse workloads such as conversation, code assistance, and multimodal creation.