Will another graphics card actually help?

Local models keep bringing me back to a practical question: would adding a graphics card remove the constraint that is actually holding me back? In LLM Calculator, I wanted to follow that calculation from memory capacity all the way to the time for a single token. It separates two questions: will the model fit in memory, and what limits the speed of generating the next token? More combined VRAM can answer the first while leaving the second unchanged.

The calculator runs as a static JavaScript page in the browser. It does not run a model or require an account, inference server or API key.

Capacity first, then time

An additional GPU might, for example, accommodate layers that previously had to run on the CPU. That changes both where their weights are stored and the memory bandwidth serving their computation. If the model already fit on one card, however, more total VRAM does not by itself make the next token arrive sooner. Work placement and interconnect costs also matter.

That is why I separated capacity checks from timing estimates. When device dd is assigned a set of complete layers LdL_d, it must fit their weights and their share of the KV cache:

Md=Mweights(Ld)+MKV(Ld,S)≤Musable,d.M_d = M_{\mathrm{weights}}(L_d) + M_{\mathrm{KV}}(L_d, S) \le M_{\mathrm{usable}, d}.

SS is the context length, and Musable,dM_{\mathrm{usable}, d} is the device’s available capacity. For a GPU, it is installed VRAM minus the configured reservation; for the CPU, it is RAM available to layers after other host allocations. I account for runtime and activation-buffer overhead in that reservation, so I do not add it again to MdM_d. The calculator does not automatically determine additional allocations required by a particular inference engine.

Every layer has to fit completely on its assigned device. When no placement satisfies this condition for all devices, the useful result is the amount of missing capacity. A tokens-per-second figure for an impossible placement would obscure the answer.

Inputs and outputs

Start with model parameters: parameter count, quantized storage size, layers and KV cache requirements. For MoE (Mixture of Experts) models, parameters stored in memory are distinguished from parameters active during token generation.

Model parameters and each card’s settings can be changed independently, including after loading an example. This lets you compare your current machine with hardware you are considering.

Then describe each GPU: VRAM capacity, memory bandwidth, effective compute and its PCIe connection. CPU and RAM settings describe offload capacity when part of the model does not fit on the GPUs.

The output estimates tokens per second, per-token latency, and memory, compute and transfer constraints. Each GPU has its own VRAM reservation, and CPU offload is limited by usable RAM. If complete layers do not fit, the calculator reports the missing capacity instead of producing a throughput number.

Your model and its context budget

You can start with the Llama 3.1 8B/70B architecture presets or illustrative Dense/MoE examples. Weight profiles include a stated storage allowance for quantization metadata. Independent hardware examples configure one or two GPUs or a CPU-only setup; their bandwidth and compute values remain editable and are not measured benchmarks.

The KV cache planner uses the number of layers LL, KV heads (nKVn_{\mathrm{KV}}), head dimension dheadd_{\mathrm{head}}, context tokens SS and bytes per element bKVb_{\mathrm{KV}}. For one sequence with the same cache shape in every layer and the complete context retained, the factor of 22 accounts for key KK and value VV tensors:

MKV(S)=2 L nKV dhead S bKV.M_{\mathrm{KV}}(S) = 2 \, L \, n_{\mathrm{KV}} \, d_{\mathrm{head}} \, S \, b_{\mathrm{KV}}.

It distinguishes decimal GB from binary GiB (2302^{30} bytes). For example, L=32L = 32 layers, nKV=8n_{\mathrm{KV}} = 8 KV heads, a head dimension of dhead=128d_{\mathrm{head}} = 128 and S=8192S = 8192 tokens at FP16 (bKV=2b_{\mathrm{KV}} = 2) require exactly 2302^{30} bytes, or 1 GiB (about 1.074 GB), for one sequence’s key/value data. The formula counts cache data; any metadata and memory alignment need a separate allowance.

A table compares contexts from 2K to 128K tokens: cache storage, estimated decode speed and layer placement. It shows where longer context exhausts memory and which device becomes the constraint.

How multiple GPUs are modeled

The computation model assigns consecutive blocks of uniform layers to individual cards (layer split). During single-stream token generation, activations pass sequentially through this device chain. In the Roofline approximation, each block takes the greater of its memory-traffic and operation-count times, while total decode step latency sums block execution and activation transfers:

tstep=∑dmax⁡ ⁣(Dactive,dBeff,d, Factive,dCeff,d)+∑ℓttransfer,ℓ,TPS=1tstep.t_{\mathrm{step}} = \sum_{d} \max\!\left(\frac{D_{\mathrm{active}, d}}{B_{\mathrm{eff}, d}},\, \frac{F_{\mathrm{active}, d}}{C_{\mathrm{eff}, d}}\right) + \sum_{\ell} t_{\mathrm{transfer}, \ell}, \qquad \mathrm{TPS} = \frac{1}{t_{\mathrm{step}}}.

For each block dd, Dactive,dD_{\mathrm{active}, d} is the number of bytes read per token from active weights and KV cache, Beff,dB_{\mathrm{eff}, d} is effective memory bandwidth in bytes per second, Factive,dF_{\mathrm{active}, d} counts floating-point operations, and Ceff,dC_{\mathrm{eff}, d} is effective compute in those operations per second. The index ℓ\ell runs over connections between consecutive blocks; times are in seconds, so TPS\mathrm{TPS} means tokens per second. Offload adds a corresponding CPU block with RAM bandwidth and CPU compute. Stored cache size and effective reads per token are separate inputs: reuse or repeated reads can change memory traffic without changing occupied capacity.

The live visualization shows the exact layer ranges in execution order, the weights and KV cache stored on each device, and activation payloads crossing each link. Step controls expose processing and transfer stages, their bottlenecks and cumulative elapsed time. It also makes the distinction visible: weights and KV cache stay with their assigned layers while activations move between blocks.

An example layer split across GPU 1, GPU 2 and CPU. Arrows represent activations; weights and KV cache remain on their assigned devices. Enlarge illustration ↗
An example token path with layer splitting. Device order and offload depend on the configuration; the calculator sums block processing and transfer times.

I wanted the result to be inspectable stage by stage. One final number does not reveal whether VRAM reads, CPU computation or a PCIe transfer dominates. The block-by-block view lets me trace a number back to the assumption that produced it. Costs and placement rules are documented in the calculator methodology.

This distinction matters: layer splitting differs from splitting the tensors of one layer across several cards. Communication specific to tensor parallelism is not fully modeled here. The calculator’s built-in guide explains these assumptions.

Using the estimate

A practical comparison keeps the model and quantization fixed, then tries one GPU, two GPUs, and a configuration with some layers in RAM. It shows whether extra VRAM removes offload and whether the connection between cards becomes the next constraint.

Configurations can be saved, compared and shared by link. The report includes results, assumptions and inputs so the calculation can be reproduced later.

The result is an estimate rather than a measurement of a particular computer. Effective bandwidth, compute and KV cache size can be calibrated against your benchmarks. The inference engine, drivers, quantization format and connection topology affect actual performance.

The application runs at llm-calculator.piotrzmudadev.com as a separate Cloudflare Worker with static assets. The GitHub repository remains public and contains the complete source, README, methodology and tests. Runtime calculations run locally in the browser without external scripts or API calls.