Frequently Asked Questions
Does the weights figure change with context length?
No. Weights depend only on the number of parameters and the bits per parameter. The default 70 billion parameter model at 4 bits takes 35 GB whether it serves one short prompt or several long ones. Context length and batch size act only on the KV cache, which is why the cache, not the weights, decides how many users a deployment can hold.
Why does the total exceed parameters times bytes?
Because a running model needs more than its weights. On the default, 35 GB of weights sit alongside 10.69 GB of KV cache and 5.4 GB of runtime overhead, giving 51.09 GB. Loading weights alone may succeed, but the first long request will fail if no memory is left for the cache and activations. Always plan with the total, not the weights line.
Why can I not enter 4.5 bits?
The calculator accepts only the precisions that formats commonly use: 2, 3, 4, 5, 6, 8, 16 or 32 bits. Fractional rates come from the scaling values that quantized formats store with each group of weights. If you need that extra precision in your estimate, take the size of the quantized weight files instead, since it already includes those scales, and add the cache and overhead lines from the calculator.
Is it better to serve more users or longer contexts?
The memory cost is identical, because the KV cache depends on tokens per sequence times the number of sequences. Four sequences of 8192 tokens use the same cache as one sequence four times as long. The choice depends on your workload. Chat services usually favour more short sequences, while document analysis favours fewer long ones, but either way the cache budget is shared.
Does this calculator cover fine-tuning?
No. It sizes inference only: weights, the KV cache for generation and runtime overhead. Training also needs gradients, optimizer states and stored activations for the backward pass, which can add several times the weight memory. Even adapter-based fine-tuning on a frozen base model needs extra memory for activations. Use a training-specific estimate for that.
How accurate is the KV-cache line?
It is an estimate for a typical grouped-query model with a 16 bit cache, scaled from parameter count, tokens and batch. It does not know your model's layer count or head sizes. The exact cache is 2 times layers times stored width times bytes times tokens times batch. For any real deployment, compute that from the model's configuration and plan with the larger of the two figures.
How do I see the memory needed before any request arrives?
Add the weights and overhead lines and ignore the cache. On the default model that is 35 GB plus 5.4 GB, about 40.4 GB, which is the floor once the model is loaded. Context and batch both need to be at least 1, so the calculator always includes some cache; setting both to 1 shows how small a single short request's share is.
Are the results in GB or GiB?
Decimal gigabytes, a thousand million bytes each. GPU memory is often reported by tools in binary units, where one GiB is about 7% larger than one GB. So the same 35 GB of weights shows as roughly 32.6 GiB. When comparing the calculator's total with a figure from a monitoring tool, convert one of them first so you are not misled by the difference.
Why does going from 8 to 16 bits add so much memory?
Weights scale directly with bits, and the overhead is 12% of the weights plus a fixed amount, so both grow when precision doubles. Moving the default model from 8 to 16 bits doubles the 70 GB of weights and raises the overhead with them, while the KV cache stays at 10.69 GB. Weight precision is the single biggest lever on total memory.
Does splitting the model across GPUs divide the total evenly?
Only roughly. With tensor parallelism the weights and KV cache are split between cards, but every GPU still pays for its own CUDA context and working buffers, and some layers or embeddings may be duplicated. Expect each card to need a little more than an even share of the calculator's total, and leave headroom on each one rather than only in aggregate.
Three buckets of memory in the 51.09 GB default
GPU memory for running a language model goes into three separate places, and the calculator reports each one. The default is a 70 billion parameter model stored at 4 bits per weight, serving 4 sequences at once with 8192 tokens of context each. The total comes to 51.09 GB.
The largest share is the model weights: 35 GB. Those are fixed. They are loaded once and stay the same size whether the model is answering one short question or many long ones.
The second share is the KV cache, 10.69 GB on the default. This grows with every token held in context and with every sequence served at the same time. It is the part that changes most from one deployment to another, and the part people most often underestimate. Here it is already almost a third the size of the weights.
The third share, 5.4 GB, is the runtime overhead: the CUDA context, temporary activation buffers and the memory the serving framework keeps for itself. The sum of the three is the figure to compare with the memory on your card, with some room left over.
Weights: parameters times bits divided by 8
The weights line is the easiest to check. Each parameter is stored in a certain number of bits, and 8 bits make a byte, so the weights take parameters multiplied by bits divided by 8 bytes. For the default that is 70 billion multiplied by 4 over 8, or 35 billion bytes, shown as 35 GB.
Precision is therefore a direct multiplier. The same model at 8 bits needs 70 GB for weights, and the total rises to 90.29 GB. At 16 bits, the precision most models are released in, the weights alone are four times the default 35 GB, and the total is more than three times the 4 bit figure. Quantizing from 16 to 4 bits is what makes a model of this size practical on a single large card at all.
Parameter count is the other multiplier. The lower preset, a 42 billion parameter model at 4 bits, needs 21 GB of weights and 33 GB in total. The higher preset at 105 billion parameters needs 52.5 GB of weights and 73.1 GB in total.
The bits field accepts the precisions that quantized formats actually use: 2, 3, 4, 5, 6, 8, 16 or 32. Anything else, such as a fractional value, returns an error. Real 4 bit formats also store small scaling factors alongside the weights, so a file on disk is often a little larger than parameters times 4 over 8. If you want the exact figure, the size of the quantized weight files is the best guide. Note too that the GB here are decimal, a thousand million bytes; tools that report binary gibibytes will show the same weights as roughly 7% smaller.
Checking the KV cache with 2 × layers × hidden × bytes × tokens × batch
During generation the model stores a key vector and a value vector for every token, in every layer, so it does not have to recompute them for each new token. That store is the KV cache. Its exact size follows from the model's architecture: 2, for keys and values, multiplied by the number of layers, the width of the stored vectors, the bytes per number, the tokens per sequence and the number of sequences.
To see how large it can get, take an illustrative model with 80 layers and a hidden size of 8192, keeping the cache at 2 bytes per number. If every layer stored keys and values at the full hidden width, that is 2 times 80 times 8192 times 2 bytes per token, about 2.6 MB. For the default 4 sequences of 8192 tokens, the cache would be about 86 GB, far more than the weights.
Most recent large models shrink this with grouped-query attention: many query heads share a smaller set of key and value heads, so the stored width is only a fraction of the hidden size. If the stored width were one eighth of the hidden size, the same example would need about 0.33 MB per token and about 10.7 GB for the default workload.
The calculator has no inputs for layers or head width, so it uses an estimate for a typical grouped-query model at 16 bit cache precision. It works out roughly 0.039 MB per token for each unit of the square root of the parameter count in billions, then multiplies by context and batch. For a 70 billion model that is about 0.33 MB per token, giving the 10.69 GB on the default, close to the grouped-query example above. Treat it as an estimate. For a real deployment, read the layer count, the number of key and value heads and the head size from your model's configuration file and work the formula by hand: stored width equals key and value heads times head size. A model with full-width attention can need several times the estimate.
Context length and batch size trade one for one
In both the exact formula and the calculator, the KV cache depends on tokens per sequence multiplied by the number of sequences. Four sequences of 8192 tokens cost exactly the same as one sequence four times as long. The calculator confirms it: both give 10.69 GB of KV cache and the same 51.09 GB total.
That makes batch size and context length a single budget. Dropping the default to one sequence cuts the KV cache to 2.67 GB and the total to 43.07 GB. Raising it to 16 sequences quadruples the cache to 42.77 GB and lifts the total to 83.17 GB, while the weights do not move at all. At that point the cache is larger than the weights, which is normal for busy serving.
In practice the context length you enter should be what each sequence actually holds at its longest, prompt plus generated tokens, not the model's maximum supported context. A model that supports very long contexts but serves short chat turns needs far less cache than its maximum suggests. Serving frameworks that allocate cache in small pages only use memory for tokens that exist, so the peak, not the theoretical maximum, is what matters. Both fields take whole numbers of 1 or more.
Cache precision is separate from weight precision
Change the weights from 4 bits to 8 or 16 and the KV line stays at 10.69 GB. That is deliberate. Weight quantization and cache precision are separate settings, and a model whose weights are stored at 4 bits usually still keeps its keys and values in 16 bit numbers.
So a 4 bit model saves memory on the weights only. On the default, quantizing from 8 to 4 bits halves the weights from 70 GB to 35 GB but leaves the cache untouched, which is why the cache's share of the total grows as you quantize harder.
Some serving frameworks can also store the cache at 8 bits. The calculator does not model that option, but the exact formula shows the effect: at 1 byte per number the cache is half the 16 bit size. On the default that would bring the cache to roughly half of 10.69 GB, a real saving on long contexts, and it is independent of how the weights are stored.
Runtime overhead: 12% of weights plus a fixed 1.2 GB
The third line covers memory that is neither weights nor cache. The CUDA context takes a fixed amount as soon as a process touches the GPU. The forward pass needs scratch space for activations. Serving frameworks keep buffers and memory pools of their own.
The calculator models this as 12% of the weights plus a flat 1.2 GB. For the default 35 GB of weights that gives 5.4 GB; for the 42 billion preset it gives 3.72 GB; for the 105 billion preset, 7.5 GB. The formula shown on the page writes the overhead as a simple 1.15 multiplier on the weights instead. The two land close together for the default, but the calculator's own figures come from the 12% plus 1.2 GB rule.
Real overhead varies by framework and settings. Some serving engines reserve a fixed fraction of the whole card up front and then fill it with cache pages, which makes the memory reported by monitoring tools look full even when the model itself needs less. Leave a margin beyond the calculator's total rather than sizing to the last gigabyte.
Fitting a model onto your hardware
Compare the calculator's total with the usable memory on your GPU, not the number printed on the box, since the driver and display take some. If the total fits with a comfortable margin, you have room to raise the batch or the context. If it does not fit, you have four levers, and the calculator shows the effect of each.
Lower precision shrinks the weights fastest. Fewer concurrent sequences or a shorter context shrinks the KV cache. A smaller model reduces everything. Splitting the model across several GPUs divides the weights and cache between them, but each GPU pays its own CUDA context and some buffers, so the per GPU total is a little more than the single GPU total divided by the number of cards.
Then check the KV cache by hand against your model's real layer and head counts. The calculator's estimate assumes a grouped-query design, so a model with more key and value heads than that, or a deployment with longer real contexts than you entered, can run out of memory once traffic fills the cache. Of the three lines, the cache is the one to verify before you commit.