GPU Selection for Local LLM Inference: The VRAM, Bandwidth, and Compute Trade-off
When people set up hardware for local large language models, the usual instinct is "buy the card with the most VRAM." That answers whether a model will start, but not what the experience feels like. Running LLM inference locally actually stresses a card across three jobs at once: holding the model (weights plus KV cache must stay resident in VRAM), generating tokens fast (decode is gated by memory bandwidth, not compute), and responding quickly (prefill is gated by compute). This article breaks down what actually consumes VRAM, explains why higher-capacity cards are often slower at generating text, and covers the software-stack and instruction-set compatibility pitfalls that spec sheets hide. It includes VRAM-estimation and throughput-probing scripts, a comparison of consumer 20GB and 24GB cards against data-center accelerators, a reusable selection workflow, and guidance on where local deployment beats the cloud in terms of marginal cost and benefit.
1. Reframing the Question: What Are You Really Choosing?
When people pick hardware for a local LLM for the first time, their reasoning usually starts with “buy the card with the most VRAM.” That direction isn’t wrong, but it only answers the question of whether a model will start, while ignoring what the experience actually feels like. If you break down the resource consumption of local inference, a consumer- or professional-grade accelerator card is really juggling three kinds of work at the same time:
- Holding the model. Weights and the KV cache must stay fully resident in VRAM. Any overflow degrades into constant swapping to host memory, and latency collapses to the point of being unusable.
- Generating tokens fast. During autoregressive decoding, every token generated requires reading almost the entire set of weights from VRAM. Speed here is governed by memory bandwidth, not compute.
- Responding quickly. The prefill phase between a user’s question and the first emitted token has to process all input tokens at once. This phase is governed by compute (and by the ratio of compute to bandwidth).
So the real question isn’t “which card has the highest numbers,” but “under a given budget, power budget, chassis, and cooling constraint, how do I configure a set of accelerators whose capacity–bandwidth–compute ratio is well matched, so that the target model’s measured experience clears the usability threshold?” The typical range this article focuses on is accelerator cards with 20GB to 24GB of VRAM. This tier earns the “sweet spot” label precisely because it sits at a reasonable point on both the capacity curve and the bandwidth curve.
2. The Capacity View: What Actually Eats Your VRAM
2.1 The weight floor is set by precision
The VRAM footprint of the weights is the easiest thing to estimate. The formula is approximately:
Weight VRAM ≈ Parameter count × Bytes per parameter
Take a 7B model as an example: 16-bit float weights occupy roughly 13–14GB. A 13B model takes about 25–26GB, which already exceeds the capacity of a single 20GB card. This is what the “20GB sweet spot” really means: at half precision it holds a 7B-class model with room to spare, and with 4-bit post-training quantization it can hold 13B or even 30B-class models. The advantage of the 24GB tier shows up mainly as headroom for longer contexts and larger batches, rather than simply “fitting one more size class.”
2.2 The KV cache everyone underestimates
The KV cache is a VRAM footprint that grows dynamically during inference. It depends on the number of layers, the key/value head dimensions, the context length, and the concurrent batch size, and can be approximated as:
KV cache ≈ 2 × num_layers × num_kv_heads × head_dim × seq_len × batch × bytes_per_element
For a model with 32 layers, 8 KV heads, and a head dimension of 128, at a 4K context and a single request, the KV cache is about 0.25–0.5GB, which looks like nothing. But push the context to 32K and the concurrency to 16 requests, and this term balloons to several GB or even ten-plus GB, blowing past a configuration where “the weights just barely fit.” That’s why VRAM capacity needs a 10%–20% margin.
The estimation script below can be used directly for capacity accounting before you buy:
def estimate_vram_gb(params_b, # number of parameters (in billions)bits=16, # weight precision (bits)ctx_len=4096, # context lengthlayers=32,kv_heads=8,head_dim=128,batch=1,kv_bits=16,overhead=0.15, # activations, framework buffers, fragmentation headroom):gib = 1024 ** 3weights = params_b * 1e9 * bits / 8 / gibkv = 2 * layers * kv_heads * head_dim * ctx_len * batch * kv_bits / 8 / gibtotal = (weights + kv) * (1 + overhead)return round(weights, 2), round(kv, 2), round(total, 2)for b in (4, 8):for bits in (16, 8, 4):w, k, t = estimate_vram_gb(b, bits=bits)print(f"{b}B @{bits}bit -> weights {w}G / KV {k}G / total ~{t}G")
2.3 Quantization is not a free lunch
Quantization buys capacity, but it also brings accuracy loss and operator-compatibility costs. A few pieces of practical experience are worth adding to your checklist:
- Prefer group-wise PTQ over whole-tensor scaling, keeping quantization error inside a smaller numerical range so the impact on perplexity is usually more controllable.
- The quantized matrix-multiply kernels must be correctly recognized by the inference framework and mapped onto a hardware-accelerated path. Otherwise execution falls back to dequantization plus a regular matmul, and it can end up slower than the original half precision.
- The KV cache can also be quantized, which is one of the most cost-effective capacity optimizations for long-context scenarios, though you still need to evaluate the impact on long-range dependency tasks.
- The calibration dataset should be close to your real business distribution. A model quantized against generic corpora can degrade noticeably on vertical-domain tasks.
3. Bandwidth vs. Compute: Why Big-Capacity Cards Are Often Slower at Generating Tokens
This is the most counterintuitive point in local deployment. Line up accelerator cards from different tiers, and the ones with larger VRAM capacity and wider buses don’t necessarily lead in decode speed — sometimes they’re even slower. The reason lies in the ratio the hardware is designed around: packing memory chips for capacity often crowds out the space reserved for compute units and bus width.
The Roofline model makes this clear. Each step of autoregressive decoding has extremely low arithmetic intensity (almost every weight participates in just one multiply-accumulate), so its performance ceiling is set by bandwidth:
def decode_tps_upper_bound(weights_gb, bandwidth_gbs, efficiency=0.8):"""Theoretical upper bound of decode throughput (tokens/s)"""return bandwidth_gbs / weights_gb * efficiency# A 7B model at 4-bit quantization is about 3.5-4GB, with bandwidth on the order of 700-900GB/sprint(decode_tps_upper_bound(3.8, 800)) # ~168 tokens/s (theoretical upper bound)print(decode_tps_upper_bound(3.8, 800, 0.5)) # ~105 tokens/s (closer to real measurements)
Real-world efficiency usually lands between 40% and 70% of the theoretical value, depending on the framework’s paged-attention implementation, batching strategy, and degree of kernel fusion. This formula leads to two important conclusions:
- Quantization speeds up decoding by reading less from VRAM, not by computing faster. Compressing a 7B model from 16-bit to 4-bit cuts the weight-read volume to a quarter, so decode speed can theoretically improve several-fold.
- The prefill phase is the opposite. Processing a long input is a classic compute-bound scenario, and here compute (low-precision matrix throughput) is the bottleneck. That’s exactly why “time to first token” and “token generation speed” must be measured separately — they often point to different hardware weaknesses.
To summarize the whole trade-off chain in one line: capacity decides which models you can run, bandwidth decides how fast they run, compute decides how fast they respond, and all three are carved out of the same card’s power and cost budget.
4. Software Stack and Instruction Sets: Where Spec Sheets Hide the Real Risks
A hardware spec sheet usually won’t tell you about compatibility, and that’s precisely where local deployment fails most often. Three capabilities need to be confirmed before you buy:
- Hardware support for low-precision float formats. BF16 has a larger dynamic range than FP16 and gives better numerical stability in training and inference. If the accelerator doesn’t support BF16 arithmetic in hardware, the framework falls back to FP32 or software emulation, and you lose both the performance and the memory gains.
- Availability of efficient attention kernels. Current mainstream inference frameworks generally rely on fused attention kernels that combine blocked computation with online softmax to reduce peak VRAM usage and improve speed. These kernels place explicit requirements on the card’s compute capability level. Older architectures usually can’t enable them, and VRAM usage under long context rises significantly as a result.
- Coverage of quantization operators and the compiler. Even if the hardware supports a given low-precision format, if the driver and inference runtime lack the corresponding operator implementation, execution still takes the generic fallback path.
Beyond that, non-reference “modified” cards carry several extra layers of risk to assess: VRAM chip capacity and bus width are set by the modifications, and a vendor’s custom firmware and cooling design may have compatibility issues with the official driver. On some card models, the power limit, number of power phases, and cooling capacity are trimmed from the original design, and sustained full-load inference (hours of continuous high load) is far more demanding than a short gaming burst. So stability validation must include a continuous full-load test, not just a benchmark run.
5. A Comparison Table: Positioning Three Tiers of General-Purpose Accelerators
| Dimension | Consumer 20GB-class | Consumer 24GB-class | Data-center professional compute card |
|---|---|---|---|
| VRAM capacity | 20GB-class | 24GB-class | Multiple options from 16GB to 80GB |
| VRAM bandwidth (order of magnitude) | ~700–800 GB/s | ~900 GB/s | 900 GB/s up to several TB/s |
| High-bandwidth memory (HBM) | No | No | Present on some models |
| Low-precision compute | Relatively high (designed for consumer graphics workloads) | Highest | Moderate, but supports a wider range of precision combinations |
| BF16 / efficient attention kernels | Supported | Supported | Supported |
| Typical power range | ~300W | ~350W | 250W–400W, often with passive cooling |
| Multi-GPU interconnect | Usually relies on the motherboard and host-side links | Same | Supports high-bandwidth GPU-to-GPU interconnect |
| Cooling and chassis | Can be installed directly in a PC; watch airflow | Same | Usually needs a server chassis and strong airflow |
| Used/modified hardware risk | Relatively high | Relatively high | Moderate (but mostly decommissioned cards) |
| Typical use cases | 7B–13B quantized models, single-machine inference and light fine-tuning | Long context, multi-concurrent requests, larger models | Large-scale concurrent serving, training and fine-tuning |
(Numbers in the table are illustrative orders of magnitude; refer to the published specs of the specific models you’re considering.)
6. A Reusable Selection Workflow
Turning the analysis above into a concrete decision sequence avoids most selection mistakes:
- Pick the model first, then the card. List the model sizes and quantization precisions you must support, and compute the weight VRAM. Add the target context length and concurrency for your workload, and compute the KV cache. Sum the two and multiply by a 1.15 headroom factor to get the VRAM floor.
- Define your experience target. Set an acceptable token-generation speed (interactive chat usually needs 20 tokens/s or more) and a ceiling for time-to-first-token. Work backward from the bandwidth formula to derive the bandwidth you need, then check whether the target card meets it.
- Confirm software-stack compatibility. Verify support for BF16, efficient attention kernels, and your target quantization format on the candidate cards and the inference framework version you’ll use.
- Account for whole-system constraints. The PSU’s rated power must cover the GPU’s peak draw with more than 20% headroom; the motherboard must provide enough slot spacing and lanes; and the chassis airflow must keep the GPU below its throttling threshold even in a hot summer environment.
- Set a fallback path. If the single-card budget tops out, consider “two mid-range cards + tensor parallelism” instead of “one high-end card,” at the cost of inter-card communication overhead and a more complex deployment.
In engineering practice, a simple health-check script turns these constraints into an automated pre-launch validation:
import json, time, urllib.requestdef probe(endpoint, prompt, max_new_tokens=256):"""Measure time-to-first-token (TTFT) and decode throughput (TPS)"""body = json.dumps({"prompt": prompt,"max_new_tokens": max_new_tokens,"stream": True,}).encode()req = urllib.request.Request(endpoint, data=body, headers={"Content-Type": "application/json"})t0 = time.perf_counter()ttft, tokens = None, 0with urllib.request.urlopen(req, timeout=300) as resp:for raw in resp:if not raw.startswith(b"data:"):continuepayload = raw[5:].strip()if payload in (b"", b"[DONE]"):continuejson.loads(payload) # validate the response structuretokens += 1if ttft is None:ttft = time.perf_counter() - t0total = time.perf_counter() - t0return {"ttft_ms": round((ttft or total) * 1000, 1),"decode_tps": round((tokens - 1) / max(total - (ttft or 0), 1e-6), 1),"total_s": round(total, 2),}print(probe("http://127.0.0.1:8000/v1/completions","Explain what GPU memory bandwidth is in three sentences."))
7. From Local to Cloud: The Inflection Point Between Marginal Cost and Marginal Benefit
The cost curve of local deployment has a feature that’s easy to underestimate: fixed costs come up front, and utilization determines the unit cost. Buying the whole machine is a large one-time expense, and the cost per token only gets diluted when the GPU sits in a high-load band most days. Conversely, if the workload has a pronounced tidal pattern — busy during the day, idle at night — or is only exploratory, then most of the local hardware’s time is spent depreciating while idle.
At the same time, there’s a curve of diminishing marginal returns. Once a configuration crosses from “it runs” to “it runs comfortably,” further investment yields rapidly shrinking improvements: going from 4-bit to 8-bit precision, or from 7B to 13B, still pays off clearly; but beyond that, chasing larger VRAM, more concurrency, and longer contexts makes the investment grow several-fold while the experience improves only marginally — marginal cost spikes and marginal performance fades. Recognizing this inflection point is more valuable for engineering than chasing the maximum number on a spec sheet.
So a sensible strategy is often a hybrid one:
- Put steady-state, high-utilization, data-sensitive, offline workloads on-premises, such as internal knowledge-base Q&A, code-completion assistance, and real-time captioning and summarization.
- Put elastic, bursty workloads, and workloads that need several model sizes validated in parallel, in the cloud — provisioning GPU compute instances on demand, using a container platform for environment isolation and fast scale-out, versioning model weights and datasets in object storage, and tracking time-to-first-token, throughput, VRAM usage, and error rate through logging and monitoring/alerting.
- Use the same inference interface and benchmarking scripts on both local and cloud, so that performance baselines can be compared directly when migrating and you avoid hard-to-diagnose problems like “the experience mysteriously dropped after switching environments.”
The cloud environment offers another value as well: a clear baseline to compare against. Measure the target model’s throughput and latency on standard hardware using a cloud instance first, then use that to judge whether your local configuration’s measured numbers fall within a reasonable range. This turns a lot of “is something wrong with the GPU?” arguments into a simple quantitative comparison.
8. Summary
Local LLM hardware selection can be compressed into a single chain of reasoning: first use the estimation formulas for weights and the KV cache to pin down the VRAM floor; then use the correspondence between bandwidth and perceived speed to pin down the speed ceiling; finally use precision support and attention-kernel compatibility to pin down software feasibility. Once all three pass, close it out with whole-system power, cooling, and stability testing.
The 20GB–24GB tier of accelerator cards has become a common choice for local deployment not because it wins on any single spec, but because it offers a relatively balanced solution across capacity, bandwidth, power, and whole-system cost. For the vast majority of individual developers and small teams, configuring hardware in this tier well, tuning quantization and the inference framework properly, and running load tests and monitoring in place usually delivers more real-world value than continuing to pour money into more hardware.
