Black Friday sale· 50% off first month
Rows of small glowing status lights on a server rack in a dark, hazy data centre
API

What AI models fit on a 48 GB GPU

Work out which LLMs fit on a 48 GB GPU with the weights plus KV cache formula, with worked examples at FP16, FP8 and 4-bit, and when to rent 2x, 4x or 8x.

KreatorFlow5 min read

Short answer

A 48 GB GPU holds a model whose weights, plus its KV cache and some headroom, fit in about 41 GB. Weights take parameters times bytes per weight: 2 at FP16, 1 at FP8, about 0.55 at 4-bit. That fits an 8B model at FP16, a 32B model at FP8 or, on 2 cards, a 70B model at 4-bit. Estimates.

Updated:

Check whether a model fits in four steps

  1. 1

    Work out the weights

    Multiply the parameter count in billions by the bytes per weight. FP16 is 2 bytes, FP8 is 1 byte and 4-bit is about 0.5 byte, and we use 0.55 to allow for scales and other overhead. A 70 billion parameter model is about 140 GB at FP16, 70 GB at FP8 and 38.5 GB at 4-bit.

  2. 2

    Add the KV cache

    For each sequence, the KV cache is 2 x layers x KV heads x head size x bytes per value x tokens. It grows with context length and with the number of requests you serve at once.

  3. 3

    Keep headroom

    We hold back 15% of each card for the CUDA context, activations and fragmentation, so one 48 GB card has about 41 GB to use. This is an assumption. Your software may need more or less.

  4. 4

    Pick the card count

    Choose the smallest size whose usable memory holds the weights and the KV cache you need. When a model spans cards, test the speed, because splitting a model across cards adds communication work.

Weights by model size and precision

Each cell is the weight memory, then the smallest number of 48 GB cards that holds it with 4 GB left for the KV cache, using the 15% hold back above. The sizes are generic: a "70B" row means any model of about 70 billion parameters. These are estimates, not benchmarks.

ParametersFP16 (2 bytes)FP8 (1 byte)4-bit (about 0.55 byte)
8B16 GB, 1x8 GB, 1x4.4 GB, 1x
14B28 GB, 1x14 GB, 1x7.7 GB, 1x
32B64 GB, 2x32 GB, 1x17.6 GB, 1x
70B140 GB, 4x70 GB, 2x38.5 GB, 2x
405B810 GB, more than 8x405 GB, more than 8x222.8 GB, 8x

The KV cache, with numbers

The KV cache stores the keys and values of every token so far. For a model with 32 layers, 8 KV heads and a head size of 128 (a shape common to 8B models) at FP16, one token costs 0.13 MB, so an 8,192 token sequence is about 1.1 GB. For a model with 80 layers, 8 KV heads and a head size of 128 (a shape common to 70B models), an 8,192 token sequence is about 2.7 GB, and a 32,768 token sequence is about 10.7 GB. Always read the real layer and head counts from your model's config file.

A KV cache stored at FP8 is about half of these figures, if your serving software supports it.

Worked examples

An 8B model at FP16 on 1x: the weights are 16 GB. Eight sequences of 8,192 tokens add about 8.6 GB, for 24.6 GB in total. That is inside the 41 GB we treat as usable.

A 32B model at FP8 on 1x: the weights are 32 GB, which leaves about 8.8 GB for the KV cache and activations. That is room for a few short sequences, so keep the context modest.

A 70B model at FP8 on 2x: the weights are 70 GB and two cards give about 82 GB usable, which leaves about 11.6 GB. At 2.7 GB per 8,192 token sequence, that is about 4 sequences at once.

A 70B model at FP16 on 4x: the weights are 140 GB and four cards give about 163 GB usable, which leaves about 23.2 GB, or about 8 sequences of 8,192 tokens.

A mixture of experts model keeps all of its experts in memory, so size it by its total parameter count, not by the parameters it uses for each token.

When to rent 2x, 4x or 8x

Use these as a first guess, then test.

  • 1x (48 GB): models up to about 8B at FP16, about 32B at FP8 or about 60B at 4-bit with short contexts.
  • 2x (96 GB): a 70B model at FP8, or a 32B model at FP16.
  • 4x (192 GB): a 70B model at FP16 with room for a long KV cache, or several copies of smaller models.
  • 8x (384 GB): the largest open models at FP8 or 4-bit, or many copies of a small model to serve more users.
  • More cards also help when you want to run separate copies of a model for more users at once, with no splitting at all.

Frequently asked questions

How much GPU memory do I need for an LLM?

Weights in GB are the parameters in billions times the bytes per weight (2 at FP16, 1 at FP8, about 0.55 at 4-bit). Add the KV cache and about 15% headroom.

Can a 70B model run on one 48 GB GPU?

Only at 4-bit with a very short context. The weights alone are about 38.5 GB and one card has about 41 GB usable on our estimate. Two cards are the safer choice.

What is the KV cache?

The stored keys and values of every token in a sequence, so the model does not recompute them. It grows with context length and with the number of requests served at once.

Is this a benchmark?

No. These are estimates from a formula. Real use depends on your software, batch size and context length, so test before you rent for a month.

How do I get a bigger GPU setup?

Rent 2x, 4x or 8x L20 servers. Each card is $749 per month. Choose your size in the GPU tab of the developer console, then email harry@kreatorflow.ai to be onboarded. We set the server up by hand and send you the access details.

Need more than 48 GB?

Rent 2x, 4x or 8x L20 servers by the month, at $749 per card.

More guides