GPU Memory for AI Workloads: How Much You Need and How to Use It Well

GPU Memory for AI Workloads: How Much You Need and How to Use It Well

GPU memory for AI workloads is the high-bandwidth memory on an accelerator that holds the model weights, the working state of a request, and the intermediate results of a computation while it runs. It is the first constraint most AI teams hit, because a model that does not fit in GPU memory cannot run at all, and a model that only just fits will run slowly as the system swaps data in and out. The central question is how much GPU memory your workload needs, and the answer is to add up the weights, the key-value cache for your longest context, and a margin for the framework, then choose the accelerator whose memory covers that total.

That calculation matters because GPU memory is the most expensive memory in the data centre, and it cannot be expanded after purchase. Unlike system memory, you cannot add another stick later; the capacity is fixed on the chip package. This guide explains what uses GPU memory, how to calculate what you need, and the techniques that stretch it further.

Key takeaways

  • GPU memory for AI workloads is fixed at purchase, so calculate the need before choosing an accelerator.
  • Model weights take about two bytes per parameter in 16-bit precision, and the key-value cache grows with context length and batch size.
  • Quantisation to 8-bit or 4-bit precision roughly halves or quarters the weight memory, with a small quality trade-off.
  • Memory bandwidth, not just capacity, decides inference speed, because each token requires reading the whole model.
  • When a model does not fit on one GPU, tensor and pipeline parallelism split it across several.

What GPU memory actually holds

GPU memory holds four things, and each grows differently. The weights are the model itself, and they are the largest fixed cost: a model in 16-bit precision needs about two bytes per parameter, so a 70-billion-parameter model needs roughly 140 GB of weights. The key-value cache, or KV cache, stores the attention state of each request in progress, and it grows with the number of tokens in the context and the number of concurrent requests.

Activations are the intermediate results of a computation, and they matter most during training, where they are kept for the backward pass. The framework and the serving engine also reserve memory for their own use, and that overhead is easy to forget in a calculation.

Training uses memory very differently from inference. Training stores the weights, the gradients, and the optimiser states, and a common optimiser keeps two extra copies of the model state, so training a model can need several times the memory of serving it. That is why fine-tuning a large model needs far more memory than running it, and why techniques such as LoRA exist to train with far less.

Inference, by contrast, is dominated by the weights and the KV cache, and the cache is the part that grows without warning as context lengths and batch sizes rise. For the optimisation side of this problem, see our guide to GPU memory optimisation, which explains the techniques that make real workloads faster.

Bandwidth matters as much as capacity. An H100 SXM reads its 80 GB of HBM3 at 3.35 TB/s, while a B200 reads 192 GB of HBM3e at 8 TB/s, and that speed is what sets the pace of token generation, because each token requires reading the whole model once. A GPU with plenty of memory but slow bandwidth will serve a model correctly and slowly, which is why capacity alone is a poor way to compare accelerators.

Best for: inference teams, because bandwidth, not arithmetic, usually sets the speed users feel.

How to calculate what you need

Start with the weights. Multiply the parameter count by the bytes per parameter for your precision: two bytes for 16-bit, one byte for 8-bit, and half a byte for 4-bit. A 70-billion-parameter model in 16-bit needs about 140 GB, the same model in 8-bit needs about 70 GB, and in 4-bit about 35 GB.

These are approximate figures, because the framework adds overhead and some layers use different precisions, but they are close enough to choose a GPU.

Then add the KV cache. The cache grows with the model size, the context length and the batch size, and long-context serving is where it surprises teams. A model that fits comfortably with short prompts can run out of memory entirely when users send long documents, because every token of context adds cache entries for every layer.

For the specific problem of fitting long contexts into limited memory, see our guide to KV cache optimisation, which covers the techniques in detail.

Then add a margin. Reserve room for the framework, for activations, and for growth in context length and traffic, because a server running at the edge of its memory will fail on the first unusual request. A margin of ten to twenty percent is a reasonable starting point, and it is cheaper than an outage.

Best for: anyone sizing a server, because this three-step calculation replaces a guess with a number.

Stacked high-bandwidth memory chips on a graphics processor circuit board
High-bandwidth memory stacks hold the weights and cache that AI workloads need.

Quantisation: fitting bigger models into less memory

Quantisation reduces the precision of the weights, and it is the single most effective way to fit a model into limited memory. Moving from 16-bit to 8-bit halves the weight memory, and moving to 4-bit halves it again, so a 70-billion-parameter model that needs 140 GB in 16-bit needs about 35 GB in 4-bit. The cost is a small loss of accuracy, and for many tasks that loss is negligible, while for tasks that need exact arithmetic it can matter.

The choice of format matters. INT8 is widely supported and well tested, FP8 is the native format of recent NVIDIA hardware and runs efficiently on Hopper and Blackwell chips, and 4-bit formats such as INT4 and NF4 are used when memory is the binding constraint. The right choice depends on the hardware, the framework and the accuracy the task needs, and it should be tested on the team’s own evaluation set rather than assumed.

For a comparison of the two most common low-precision options, see our article on INT4 versus INT8 quantisation, which sets out the memory, speed and accuracy trade-offs.

Quantisation is not the only lever. Pruning removes weights that contribute little, distillation trains a smaller model to imitate a larger one, and model sharding splits a model across GPUs. Each has its own cost, and they can be combined, but quantisation is the first step for most teams because it is the simplest and the most widely supported.

Best for: teams whose model nearly fits, because a one-step precision change can be the difference between one GPU and two.

Comparing current accelerators by memory

Accelerator Memory Memory type Bandwidth Power draw
NVIDIA H100 SXM 80 GB HBM3 3.35 TB/s 700 W
NVIDIA H200 SXM 141 GB HBM3e 4.8 TB/s 700 W
NVIDIA B200 192 GB HBM3e 8 TB/s 1,000 W
NVIDIA B300 288 GB HBM3e 8 TB/s 1,400 W
AMD MI300X 192 GB HBM3 5.3 TB/s 750 W
AMD MI325X 256 GB HBM3e 6.0 TB/s 750 W

The table shows the real trade-off in the current generation. The H100 remains a capable card, but its 80 GB limits it to smaller models or to quantised versions of larger ones, while the B200 and the MI300X both offer 192 GB and open up models that simply cannot run on an H100. The B300’s 288 GB is the current ceiling for a single GPU, and it exists for the largest models and the longest contexts.

Note that the B200 in an eight-GPU HGX board exposes about 180 GB per GPU in practice, with the remainder reserved, so plan on the usable figure, not the headline.

When one GPU is not enough

When a model does not fit on one GPU, the standard answer is to split it. Tensor parallelism divides each layer across several GPUs, so each chip holds part of every layer and the chips exchange partial results. Pipeline parallelism divides the model by layer, so each GPU holds a set of whole layers and passes activations along.

Both need a fast interconnect between GPUs, because the chips must communicate constantly, and both are easier inside one server, where NVLink or Infinity Fabric links the chips, than across servers.

Offloading is the fallback when splitting is not possible. It moves part of the model to system memory or even to disk, and loads it on demand, which lets a large model run on a small GPU at the cost of speed. It is useful for occasional use and for testing, but it is not a production strategy, because the transfer time dominates the response.

The honest answer for a model that does not fit is usually a bigger GPU, a quantised model, or a split across GPUs, in that order.

Batch size is the other lever that interacts with memory. Larger batches improve throughput, because the weights are read once for many requests, but each request in the batch needs its own KV cache, so the batch size is limited by the memory left after the weights. The serving engine manages this trade-off automatically in most setups, and the right setting is the one that keeps latency acceptable while using the memory well.

Best for: teams running large models, because the split decision is the one that shapes the whole server design.

GPU memory for AI workloads checklist

  • Calculate weight memory from the parameter count and the precision you will use.
  • Add the KV cache for your longest context and your largest batch size.
  • Add a ten to twenty percent margin for the framework and for growth.
  • Test quantisation on your own evaluation set before deciding it is safe.
  • Compare bandwidth as well as capacity when choosing between accelerators.
  • Plan the split strategy before buying, if the model needs more than one GPU.
  • Monitor memory use in production, and alert before it reaches the limit.
  • Revisit the calculation when the model, the context length or the traffic changes.

Frequently asked questions

How much GPU memory do I need to run a 70B model?

In 16-bit precision, about 140 GB for the weights alone, plus memory for the KV cache, so a single 80 GB GPU cannot hold it. In 8-bit it needs about 70 GB, and in 4-bit about 35 GB, which is why quantisation is so common. Always add the cache for your longest context before deciding.

What is the KV cache and why does it matter?

The KV cache stores the attention state of each request in progress, so the model does not recompute it for every token. It grows with context length and with the number of concurrent requests, and it is the part of memory use that grows without warning when users send longer prompts.

Does more GPU memory make inference faster?

Not directly. More memory lets you run larger models, longer contexts and larger batches, and larger batches improve throughput. But the speed of token generation is set mainly by memory bandwidth, so a GPU with faster memory can be quicker than one with more memory.

Is 4-bit quantisation safe for production?

For many tasks, yes, and it is widely used in production serving. The accuracy loss is small for most language tasks, but it can matter for tasks that need exact arithmetic or precise reasoning. Test it on your own evaluation set rather than trusting a general claim.

What happens when GPU memory runs out?

The request fails, usually with an out-of-memory error, and the serving engine may need to restart. That is why memory should be monitored in production with an alert set before the limit, and why the calculation should include a margin for unusual requests.

Latest articles

Scroll to Top