How to choose a GPU server for AI
Start from the model you will run and what you will do with it. GPU memory decides what fits; the rest of the server has to feed, power and cool the GPUs.
- Track
- GPU and AI servers
- Module
- 1 of 1
- Level
- Practitioner
- Time
- About 14 minutes
Before you start
You will be able to
- Calculate the GPU memory a model's weights need at 16-bit, 8-bit and 4-bit precision.
- Estimate the KV cache for a number of users and add it to the weights.
- Choose between inference, LoRA or QLoRA fine-tuning and full training by their memory and GPU-link needs.
- Check a server's power, cooling, PCIe lanes, system memory and network against the GPU count.
Which server do you need to run an AI model?
The short answer
Work out the GPU memory your model needs: about 2 GB per billion parameters at 16-bit precision for the weights, plus the KV cache, which grows with users and prompt length. Then choose GPUs that provide it with room to spare. Running a model (inference) needs far less memory than training or fully fine-tuning it, and the server's power, cooling, PCIe lanes, system memory and network matter as much as the GPU.
By the KComputers Team
Published
In plain words
- What this is
- Picking the server that runs an AI model, such as a chatbot or a document reader, on graphics cards (GPUs).
- Who needs it
- Teams that want to run or adapt a model on their own hardware.
- If you get it wrong
- A model that does not fit in graphics-card memory runs very slowly or not at all, and a server that cannot power or cool its cards wastes them.
GPU memory decides what fits.
A model runs at full speed only when it fits in GPU memory. Its weights take a fixed amount per parameter, set by the precision you run it at.
On top of the weights, inference needs memory for the KV cache, which holds the context of every request in flight. It grows with the number of simultaneous users and the length of their prompts and replies, and it does not shrink when you quantize the weights. For a model with 70 billion parameters, such as Llama 3 70B, it takes about 0.33 MB per token at 16-bit: 20 users with 4,000 tokens each need about 26 GB, and long documents or many more users need far more.
Quantizing to 8-bit or 4-bit shrinks the weights so a larger model fits on fewer GPUs, usually with a small loss in output quality. Test it on your own tasks before you size the server around it.
| 16-bit | 8-bit | 4-bit | |
|---|---|---|---|
| 7 billion parameters | 14 GB | 7 GB | 3.5 GB |
| 13 billion parameters | 26 GB | 13 GB | 6.5 GB |
| 34 billion parameters | 68 GB | 34 GB | 17 GB |
| 70 billion parameters | 140 GB | 70 GB | 35 GB |
Weights only: parameters × 2 bytes at 16-bit (FP16, BF16), 1 byte at 8-bit (FP8, INT8), half a byte at 4-bit. Common 4-bit formats come out up to about 20% larger, because they keep scales and some layers at higher precision.
Inference, fine-tuning and training need different servers.
What you do with the model changes the memory, the GPU count and how the GPUs connect to each other.
| Inference | Fine-tuning with LoRA or QLoRA | Full fine-tuning and training | |
|---|---|---|---|
| GPU memory | Weights plus KV cache | Weights (4-bit with QLoRA) plus small adapters and activations | About 16 bytes per parameter, plus activations |
| Typical server | One server, one to several PCIe GPUs | One server, one to several PCIe GPUs | Several GPUs; eight-GPU servers for large models |
| Links between GPUs | PCIe is usually enough | PCIe is usually enough | High-bandwidth GPU links such as NVLink |
| Network | 25 or 100 GbE to users | 25 or 100 GbE | A dedicated fabric between servers |
Most enterprise projects start with inference and parameter-efficient fine-tuning, which trains small adapter layers on a frozen model. Both run well on PCIe GPU servers, and both can start with one or two GPUs. Training large models from scratch is a different class of system: GPU modules on a shared baseboard, joined by high-bandwidth links, in racks built around their power and cooling.
The 16 bytes per parameter for full fine-tuning covers the weights, gradients and optimizer state of the common Adam optimizer in mixed precision, before activations. A model with 7 billion parameters needs about 112 GB, so it is spread across several GPUs.
The rest of the server has to keep up.
A GPU sits idle when the server cannot feed it data, power it or cool it.
- Power
- A data-centre GPU can draw several hundred watts, and a four- or eight-GPU server several kilowatts. Check the rack's power feed and cooling before you choose the GPU count, and use redundant power supplies that carry the full load with one failed.
- Cooling
- Data-centre GPUs are passively cooled and depend on the server's airflow. Use GPUs the server maker has qualified for that model, with the matching risers, power cables and fan kit.
- Processors and PCIe
- Give each GPU a full x16 PCIe link, and enough processor cores to prepare data and run the serving software. An entry-level processor can leave four GPUs waiting.
- System memory
- A common starting point is at least as much system memory as total GPU memory, and twice as much for training.
- Storage
- Fast NVMe drives hold models, datasets and checkpoints, so models load and checkpoints save quickly.
- Network
- 25 or 100 GbE serves users. A dedicated fabric, InfiniBand or RoCE Ethernet, matters mainly when GPUs in different servers work on one model together, as in multi-server training.
Compare GPUs, power supplies, risers, server memory, NVMe drives and network adapters, or let the configurator check what fits a given server.
Worked example: serving a model with 70 billion parameters.
An example with assumed inputs, not a quotation or a customer case. The figures show the method, not a recommendation. Test your own model, precision and user load.
Weights
70 billion parameters at 16-bit: 70 × 2 = 140 GB.
KV cache and runtime
Allow 35 GB: the KV cache for 20 users with 4,000 tokens each, about 26 GB, plus the runtime. 140 + 35 = 175 GB.
GPUs
Four GPUs with 48 GB each give 192 GB, so the model fits with 17 GB spare. Two 80 GB GPUs give 160 GB and fall 15 GB short.
Or quantize
At 4-bit the weights take about 40 GB in a common format, but the KV cache does not shrink with them: for the same 20 users the KV cache and runtime still take 35 GB, so plan about 75 GB. Two 48 GB GPUs give 96 GB, 21 GB spare. One 48 GB GPU falls 27 GB short; it holds the 4-bit model for only one or two users with short prompts. Test output quality first.
The rest of the server
System memory of at least 192 GB, or 384 GB if it will also fine-tune. Power, assuming 350 W per GPU for this example: 4 × 350 W = 1,400 W, plus about 800 W for the rest of the server, roughly 2.2 kW at full load.
| GPU memory | Result | |
|---|---|---|
| Four 48 GB GPUs, 16-bit | 192 GB | Fits, 17 GB spare |
| Two 80 GB GPUs, 16-bit | 160 GB | Does not fit, 15 GB short |
| Two 48 GB GPUs, 4-bit | 96 GB | Fits, 21 GB spare, if quality holds |
| One 48 GB GPU, 4-bit | 48 GB | Does not fit, 27 GB short: the KV cache does not shrink |
The example model needs 175 GB of GPU memory at 16-bit, or about 75 GB at 4-bit.
Prove it on one server before you scale.
GPU sizing is an estimate until your own model runs on real hardware.
- Pilot with real work. Run your model, prompts and expected number of users on one server, and measure tokens per second and response time.
- Rent the pilot if the project is new. GPU server rental on monthly, 3-month, 6-month or annual terms lets you measure before you commit. Rental pricing is quoted separately from purchase; to weigh the two, see renting or buying a server.
- Leave room to grow. A chassis with free GPU slots and spare power lets you add GPUs later instead of replacing the server.
- Check the software stack. The GPU driver, the CUDA or ROCm version your framework needs and the operating system must all be supported on the server you choose.
See how we plan AI and machine learning infrastructure, from one inference server to a rack of them.
Engineer's notes.
Before you order: check, and avoid these mistakes.
Decision checklist
Common mistakes
-
Sizing from the weights alone.
- Why it hurts
- The KV cache grows with users and prompt length. A server sized on weights can run out of memory once real users arrive.
- Do this instead
- Add the cache for your busiest hour, with a margin.
-
Assuming 4-bit makes everything four times smaller.
- Why it hurts
- Quantizing shrinks the weights, not the KV cache.
- Do this instead
- Size the cache separately, and test output quality before you rely on 4-bit.
-
Buying an eight-GPU baseboard system to run one model.
- Why it hurts
- It draws far more power and costs far more, and its fast GPU-to-GPU links go unused for inference.
- Do this instead
- Start with one or two PCIe GPUs, pilot, then scale.
-
Choosing the GPU count before checking the rack.
- Why it hurts
- Several kilowatts per server can exceed the feed or the cooling.
- Do this instead
- Check the rack's power and cooling first.
Check what you learned.
Check your understanding
How much GPU memory do the weights of a 34-billion-parameter model need at 8-bit?
Show the answer to question 1
34 × 1 byte = 34 GB for the weights. The KV cache and runtime come on top, so plan more than 34 GB.
In the worked example, why do two 80 GB GPUs fail for the 70-billion-parameter model at 16-bit?
Show the answer to question 2
The model needs 140 GB of weights plus 35 GB of cache and runtime, 175 GB. Two 80 GB GPUs give 160 GB, 15 GB short.
Which workload needs fast GPU-to-GPU links such as NVLink, and why?
Show the answer to question 3
Full training of large models. The model is spread across several GPUs that exchange data constantly. Inference and parameter-efficient fine-tuning usually run well over PCIe.
What do the 16 bytes per parameter for full fine-tuning cover, and what does a 7-billion-parameter model need?
Show the answer to question 4
The weights, the gradients and the optimizer state of Adam in mixed precision, before activations. For 7 billion parameters that is 7 × 16 = 112 GB, so the model is spread across several GPUs.
Key takeaways
- GPU memory decides what fits: weights plus KV cache, with a margin.
- Quantizing shrinks the weights but not the KV cache.
- Inference and LoRA or QLoRA fine-tuning start on one or two PCIe GPUs; full training is a different class of system.
- Power, cooling, PCIe lanes, system memory and network must keep up with the GPUs.
- Pilot on real work, or rent first, before you scale.
Sources and standards
- Hugging Face (public copy of Meta's file), Meta Llama 3 70B model configuration (config.json), read . 80 layers, 8 key-value heads, hidden size 8,192 with 64 attention heads (head size 128), 16-bit. KV cache per token: 2 × 80 × 8 × 128 × 2 bytes = 327,680 bytes, about 0.33 MB.
- Rajbhandari et al., Microsoft, ZeRO: Memory Optimizations Toward Training Trillion Parameter Models, read . Mixed-precision training with Adam: 2 bytes of weights, 2 of gradients and K = 12 of optimizer state, 16 bytes per parameter.
- Dettmers et al., QLoRA: Efficient Finetuning of Quantized LLMs, read . Fine-tuning adapters on a frozen model quantized to 4-bit.
- Hu et al., LoRA: Low-Rank Adaptation of Large Language Models, read . Training small adapter layers on a frozen model.
Questions about GPU servers for AI.
How much GPU memory does a model with 7 billion parameters need?
About 14 GB for the weights at 16-bit precision, 7 GB at 8-bit and about 4 GB at 4-bit, plus memory for the KV cache, which grows with the number of users and the length of their prompts. A single 24 GB GPU runs it comfortably for a small number of users.
PCIe GPUs or an eight-GPU baseboard system?
PCIe GPU servers suit inference and fine-tuning, and let you start with one or two GPUs. Eight-GPU baseboard systems join the GPUs with much faster links and suit training large models, at a much higher power draw per server.
Can we add GPUs to a server we already have?
Only if that model supports them: the right risers, power supplies, cables and fan kit, plus enough power and cooling in the rack. Send us the server model and the GPU you have in mind and we check what fits.
Do we need InfiniBand?
Usually only when GPUs in different servers work on one model together, as in multi-server training. Inference and single-server fine-tuning run well on standard 25 or 100 GbE networking.
Can we rent a GPU server first?
Yes. We rent GPU servers on monthly, 3-month, 6-month and annual terms, priced separately from purchase, so you can measure your workload before you buy.
What to tell us
- The model you want to run, its size and the precision you can accept
- How many people use it at the same time, and how long their prompts and replies are
- Whether you will only run it, adapt it with your own data, or train one
- The power and cooling available where the server will sit
- Whether you would rent a server first to measure
Tell us the model you want to run.
A server specialist sizes the GPUs, power and cooling, then sends a formal quotation.