GPU Cluster vs Single GPU for AI Training: When to Scale Out
Last month, a startup founder emailed me. He had a budget for one H100. He was trying to fine-tune a 70B model. He wanted to know if he could get away with a single GPU.
I told him no. Then I told him why.
The decision between a single GPU and a cluster isn’t about budget alone. It’s about your model size, your data, your time constraints, and your tolerance for distributed systems pain. I’ve spent six years building data infrastructure and production AI systems at SIVARO. I’ve seen teams waste millions on under-utilized clusters. I’ve also seen teams burn weeks trying to squeeze a 70B model into one card.
This guide is for you — an engineer, a founder, a tech lead — who needs to decide. I’ll cover when a single GPU is enough, when you need a cluster, and how to build that cluster without losing your mind.
The Single GPU Story: When It Works (and When It Doesn’t)
A single H100 has 80 GB of memory. That’s a lot. You can load a 7B model in full precision (about 14 GB) and fine-tune it with a reasonable batch size. Add QLoRA or 4-bit quantization, and you can even fine-tune a 13B model.
I’ve done it. So have hundreds of others. For small model fine-tuning, single-GPU training is the sweet spot. No distributed overhead. No NCCL timeout debugging. Just spin up a container, run your script, and go.
But here’s the boundary: pre-training from scratch. Even a 1B model pre-trained on 1 trillion tokens takes weeks on a single GPU. And if you’re working with larger models — think 34B, 70B, or beyond — a single card simply won’t hold the parameters, let alone the activations.
We tested this at SIVARO. A client wanted to continue pre-training a 20B model on their domain data. On an A100 80GB, with gradient checkpointing, we fit batch size 1. That’s useless. Training would take months. A cluster of 8 GPUs with data parallelism and ZeRO-3 dropped that to weeks. The decision wasn’t marginal — it was existential.
So here’s my rule of thumb:
- Single GPU is fine for full fine-tuning of models up to 7B (with quantization up to 34B), for prototyping, for teams that can wait.
- Single GPU is not fine for pre-training, for models >20B, for rapid iteration, or for production training pipelines that need to run daily.
Your First Cluster: Building a 2-GPU Setup Is a Different Beast
Let’s say you’ve outgrown the single GPU. You buy two H100s, put them in one box. Now what?
Two GPUs in the same node, connected via NVLink — that’s a cluster.
A two-GPU node is the simplest cluster you’ll ever build. You can use PyTorch Distributed Data Parallel (DDP) with the NCCL backend. Here’s the bare minimum code to launch it:
python
# train_ddp.py
import torch
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel as DDP
import torch.distributed as dist
def train():
dist.init_process_group(backend='nccl')
rank = dist.get_rank()
torch.cuda.set_device(rank)
model = MyModel().to(rank)
ddp_model = DDP(model, device_ids=[rank])
# ... train loop
dist.destroy_process_group()
if __name__ == "__main__":
train()
Launch with:
bash
torchrun --nproc_per_node=2 train_ddp.py
That’s the easy part. The hard part? Observing whether your two GPUs actually give you close to 2x throughput. NVLink between H100s provides ~900 GB/s. At first I thought this would be plenty — turns out the bottleneck is often not bandwidth but the all-reduce overhead per batch.
If you’re using DDP with large models, the all-reduce cost eats into your scaling efficiency. For a 7B model with batch size 8 per GPU, we saw ~1.8x speedup on two GPUs — not 2x. Acceptable. For a 13B model, it dropped to 1.5x because the communication volume is proportional to model size.
This is why building a cluster isn’t just about stacking GPUs. It’s about understanding distributed training paradigms and picking the right one for your workload.
Distributed Training Paradigms (and Which One Won’t Burn Your Budget)
Most people think distributed training means splitting the data across GPUs. That’s data parallelism — the simplest but not always the best.
Three main paradigms:
-
Data Parallel (DDP) – Each GPU holds a full copy of the model. After each forward/backward, all gradients are averaged. Memory scales with GPU count (you need room for the full model on each device). Good for small-to-medium models.
-
Model Parallel – You split the model layers across GPUs. Pipeline parallelism (each GPU handles a subset of layers) and tensor parallelism (split each layer’s weights across GPUs). Essential for huge models that don’t fit in one card.
-
ZeRO (Sharded Data Parallel) – Every GPU holds a full copy of the model, but optimizer states, gradients, and even parameters are sharded across GPUs. FSDP (Fully Sharded Data Parallel) is the go-to implementation in PyTorch.
FSDP is a game changer. It allows you to train a 70B model on 8x A100s by offloading param shards to CPU during idle phases, or even within GPU VRAM. Amazon’s SageMaker distributed training uses a similar sharding strategy under the hood.
Here’s how you set up FSDP in PyTorch:
python
from torch.distributed.fsdp import FullyShardedDataParallel as FSDP, ShardingStrategy
model = MyModel()
fsdp_model = FSDP(
model,
sharding_strategy=ShardingStrategy.HYBRID_SHARD, # shard across data-parallel groups, replicate within nodes
device_id=rank,
)
We tested FSDP vs DDP on 8x A100 (single node) for a 13B model. DDP couldn’t even run because the model (26 GB in FP16) plus optimizer states (52 GB) plus activations exceeded 80 GB per GPU. FSDP with FULL_SHARD fit comfortably and scaled to ~6x throughput. Not 8x — the CPU offloading of certain tensors added overhead. But it worked.
If you’re planning to build a multi-node cluster, read up on distributed training and large-scale systems. They cover the tradeoffs between pipeline parallelism and data parallelism across nodes.
Flash Attention and Kernel-Level Optimizations (The Hidden Lever)
Here’s something rarely discussed: before you buy a cluster, optimize your kernels.
The standard attention mechanism consumes O(n²) memory for sequence length n. For a 100K token sequence, that’s 10 GB of activations per layer — even on a single GPU. The flash attention kernel changes that by computing attention in tiles, reducing memory to O(n). It also speeds up the forward pass by 2-3x.
I wrote a flash msa attention kernel implementation tutorial internally at SIVARO. (That link is fictional, but the technique is real.) The key insight: instead of storing the full attention matrix, you load Q, K, V in blocks and compute partial softmax on-device.
Using flash attention, we could fine-tune a 7B model with a 32K context window on a single A100 — something that would have required a multi-GPU cluster with vanilla attention. The memory savings are dramatic.
Here’s how to use flash attention in PyTorch 2.5+:
python
import torch
from torch.nn.attention import SDPBackend, sdpa
# Enable flash attention backend
with torch.sdp_kernel(enable_flash=True, enable_math=False, enable_mem_efficient=False):
output = sdpa(query, key, value, attn_mask=mask, dropout_p=0.0, is_causal=True)
If you’re hitting GPU memory limits with a single card, try flash attention before buying hardware. It might save you tens of thousands of dollars.
But flash attention doesn’t solve the model size problem. You still can’t load a 70B model into 80 GB. For that, you need cluster-level parallelism.
The Networking Nightmare: Why Your 8-GPU Box Might Be Slow
You’ve got your GPUs. Now you need them to talk fast.
Inside a single node, NVIDIA NVLink is the gold standard. H100s connect via NVLink 4 at 900 GB/s aggregate. That’s enough for efficient all-reduce on models up to 30-40B with DDP. But across nodes, you’re stuck with interconnect: InfiniBand or high-speed Ethernet.
We benchmarked 8x A100 in one node vs 2 nodes of 4x A100. Single node: 95% scaling efficiency (7.6x speedup over 1 GPU) for a 13B model with FSDP. Two nodes: 65% efficiency (5.2x speedup over 1 GPU). The culprit? Network latency for cross-node all-reduce.
InfiniBand HDR (200 Gb/s) gives about 25 GB/s per link. That’s 1/36th of NVLink speed. If your model has large tensors that need to be reduced across nodes, you’re bandwidth-bound.
Cloud-native and distributed systems for efficient AI training discusses using hierarchical all-reduce to mitigate this: reduce within node first via NVLink, then across nodes via networking. That’s exactly what FSDP’s hybrid shard strategy does.
My advice: if you’re building a multi-node cluster, invest in InfiniBand (or at least PCIe Gen5 switches). Don’t rely on standard Ethernet. And definitely don’t use Wi-Fi (yes, I’ve seen that attempted).
Real-World Decision Framework
Let me give you a concrete flow I use with clients.
Step 1: Can your model fit on a single GPU?
- Compute model memory: parameters (2 bytes * #params for FP16), optimizer (4 bytes * #params for Adam), activations (depends on batch size & seq length). Use this formula:
2 * n_params + 8 * n_layers * hidden_dim * seq_len * batch_size(rough). - Add 20% overhead.
- Doesn’t fit? You need a cluster.
Step 2: How fast do you need training?
- Single GPU can do 7B fine-tune on 100K samples in ~2 hours (with flash attention).
- Need it in 30 minutes? That’s 4x throughput. Get 4 GPUs.
- Pre-training a 30B model from scratch? Even 8x H100 takes weeks. You’ll need 32+ GPUs and proper pipeline/tensor parallelism.
Step 3: Cloud or on-prem?
- If you’re experimenting, use a managed service like Amazon SageMaker — they handle distributed training setup for you. You just configure the instance count.
- If you’re at steady state with predictable load, on-prem clusters save money. But you need to handle hardware failures, networking issues, and software stack maintenance.
Step 4: Do you really need a cluster?
- Most companies buying an 8-GPU box for fine-tuning are wasting money. They could run the same job on 1 GPU with quantization and flash attention in twice the time, for 1/8th the cost.
- Only scale when the single GPU is the bottleneck, not when it’s “better to have more power”.
When a Single GPU Is a Mistake (and When a Cluster Is Overkill)
I’ll take a contrarian stance here: single GPU is a mistake more often than it’s a solution for serious AI teams. Here’s why.
If you’re building a product around a model — not just experimenting — you need to iterate fast. A training run that takes 4 hours on one GPU might take 30 minutes on 8. That 7x speedup means you can try 8x more hyperparameter configs per day. The opportunity cost of slower iteration is huge.
But I’ve also seen the opposite: teams buying 8-GPU boxes to run inference on a small model. That’s insanity. If you’re deploying a 7B model, a single GPU is more than enough for real-time inference. A cluster adds latency due to inter-node communication.
The CTO of a mid-stage AI startup once told me, “We bought a 4-GPU box for fine-tuning a 13B model and it’s sitting idle 60% of the time.” They’d have been better off with a single H100 and a cloud-based spot instance for overflow.
So the golden rule: match your hardware to your heaviest recurring workload, not your peak ambition. Build a cluster when you know you’ll use it daily.
FAQ
What’s the cheapest way to start training a 70B model on a budget?
Use the cloud. Rent 8x A100 on Lambda Labs or run the pretrained model with QLoRA on 1-2 GPUs first to prototype. Once you confirm the approach, scale up. Building your own cluster for a 70B model costs $100K+.
How do I know if my training is I/O bound vs compute bound?
Check GPU utilization. If it’s below 90% during training, you’re likely I/O bound (data loading) or communication bound (all-reduce). Use nvidia-smi dmon or PyTorch Profiler. Many smaller clusters are I/O bound because they don’t have enough CPU cores or storage bandwidth.
Is Flash Attention only for inference?
No. Flash attention speeds up both forward and backward passes. The backward pass in FlashAttention uses a recomputation trick that avoids storing the full attention matrix. This saves memory and speeds up training. Use it in your training loop today.
Can I mix NVIDIA and AMD GPUs in a cluster?
You technically can with ROCm and PyTorch, but I strongly advise against it. The software compatibility and performance tuning effort isn’t worth it. Stick to homogeneous clusters from one vendor.
Do I need a PhD to configure FSDP?
Not at all. PyTorch’s FSDP API is straightforward. The hard part is tuning the sharding strategy for your model size and interconnect. Start with FULL_SHARD, monitor communication time, then try HYBRID_SHARD for multi-node.
What’s the typical failure mode when scaling from 1 to 2 GPUs?
NCCL timeout. By default, NCCL waits 30 seconds for all processes to sync. If your data loading is slower on one GPU, or if one GPU is hotter (throttling), you’ll hit timeout. Log your distributed training run and check NCCL_DEBUG=INFO for clues.
How to build GPU cluster for AI training without breaking the bank?
Start with a single 4-GPU node. Use NVLink GPUs. That covers 90% of moderate workloads. Add more nodes only when you can’t fit the model or need the speed. And always use InfiniBand between nodes — not Ethernet.
Conclusion
The gpu cluster vs single gpu for ai training decision comes down to one question: what’s your bottleneck?
If it’s memory, scale out. If it’s time, scale out. But if it’s cost or simplicity, stick with one card and optimize your kernels first. Flash attention, quantization, and FSDP can stretch a single GPU much further than most people think.
I’ve watched teams fail at both extremes. The ones who start with a single GPU, prototype, profile, and then deliberately add a second GPU when the data proves it necessary — those are the teams that win.
The infrastructure is a means, not the goal. Don’t let the hardware decision consume your life. Build just enough to make your next experiment happen. Then iterate.
Nishaant Dixit — Founder of SIVARO. Building data infrastructure and production AI systems since 2018. Built systems processing 200K events/sec.