AI Hardware Architecture: Cost & Speed of LLMs
In this article
This guide explains how the physical design of AI hardware—chips, memory, and interconnects—directly determines both the cost of running large language models (LLMs) and how fast they respond. You'll learn the key architectural choices that matter, how to reason about their trade-offs, and how to apply this knowledge when selecting or configuring hardware for inference or training.
What You'll Need
- Basic familiarity with LLM concepts (parameters, tokens, inference).
- No hardware is required—this is a conceptual guide.
Step-by-Step
- Understand the two main workloads: training and inference. Training requires massive parallel compute across many GPUs for weeks. Inference (generating a response) is latency-sensitive and often memory-bound. The hardware that optimizes one may be poor for the other.
- Identify the memory bottleneck for inference. During inference, the model weights must be loaded from memory for each token generated. The key metric is memory bandwidth (GB/s). A larger model or a longer context means more data to move, so higher bandwidth directly reduces time-to-first-token and tokens-per-second.
- Calculate the minimum memory required. Model weights are stored in a specific precision (e.g., FP16 uses 2 bytes per parameter). For a 70B-parameter model in FP16, you need 140 GB just for weights, plus extra for activations and KV cache. If the hardware doesn't have enough memory, you must use quantization or model sharding, which affects speed.
- Evaluate compute throughput (FLOPS). For training and for processing large batches of prompts, the raw compute capacity (teraflops or petaflops) matters. Higher FLOPS means faster matrix multiplications. However, for single-stream inference, memory bandwidth usually dominates—compute is often idle.
- Consider the interconnect topology. When a model is too large for one chip, it is split across multiple GPUs. The speed of the connection between them (e.g., NVLink, PCIe, InfiniBand) determines how quickly they can exchange intermediate results. A slow interconnect turns a distributed inference into a latency nightmare.
- Factor in power and cooling. High-end accelerators consume hundreds of watts each. Data center power delivery and cooling costs are a large part of the total cost of ownership. A chip that is 20% faster but uses 50% more power may not be cost-effective at scale.
- Choose the right precision for the job. Using lower precision (e.g., INT8, FP8) halves memory usage and often doubles throughput on modern hardware. However, it may degrade model quality. The hardware's support for mixed precision determines how aggressively you can use this lever.
- Account for memory capacity vs. bandwidth trade-off. Some chips have huge memory (e.g., 80 GB HBM) but lower bandwidth per byte. Others have less memory but faster access. For a given model size, you want just enough memory to hold the model plus a comfortable margin—excess capacity that goes unused is wasted cost.
- Look at real-world benchmarks, not just specs. A chip's theoretical peak FLOPS is rarely achieved. Look for published tokens per second for the specific model you care about, at the batch size you plan to use. Vendors often quote numbers for ideal conditions that don't reflect your workload.
- Understand the cost per token. The total cost of running an LLM is (hardware cost + power + cooling) divided by the number of tokens you can generate over the hardware's lifetime. Faster hardware may generate more tokens per hour, reducing the cost per token even if the upfront price is higher.
Common Mistakes
- Focusing only on FLOPS. For inference, memory bandwidth is often the true bottleneck. A chip with half the FLOPS but double the bandwidth can generate tokens faster for a single user.
- Ignoring the KV cache. As context length grows, the memory required to store key-value tensors grows linearly. A 200K-token context can eat tens of gigabytes, forcing you to use a smaller batch size or a smaller model.
- Assuming more GPUs always help. If the interconnect is slow, adding GPUs can actually hurt latency due to communication overhead. The scaling efficiency drops sharply beyond a certain point.
- Mixing up precision units. A model in FP16 (2 bytes/param) vs. INT8 (1 byte/param) halves memory. Always check the precision when comparing hardware requirements.
- Overlooking power delivery. A rack of 8 GPUs can draw 10+ kW. If your facility can't supply that, the hardware is unusable regardless of its specs.
Tips
- Use the "memory bandwidth rule of thumb": For a single-stream inference, tokens per second ≈ memory bandwidth (GB/s) / model size (GB). For a 70B model in FP16 (140 GB) on a chip with 2 TB/s bandwidth, you get ~14 tokens/s. This gives a quick sanity check.
- Consider quantization carefully. Running a 70B model in INT8 (70 GB) on the same chip gives ~28 tokens/s, but quality may drop. Test with your specific prompts.
- Look for hardware with dedicated tensor cores. These accelerate the matrix multiplications that dominate LLM workloads. Most modern accelerators have them, but their efficiency varies.
- For training, prioritize interconnect over raw FLOPS. A cluster with slower GPUs but a fast, low-latency network often trains large models faster than one with faster GPUs and a slow network.
- Plan for the largest context you'll need. The KV cache grows with context length. If you need 128K context, ensure the hardware has enough memory to hold weights + KV cache + activations.
Troubleshooting
- Your inference is slow but GPU utilization is low. This is a classic sign of memory-bandwidth saturation. Check if you're using the highest memory bandwidth mode (e.g., HBM vs. GDDR). Reduce model precision or use a smaller model.
- Out-of-memory (OOM) errors. Reduce batch size, enable gradient checkpointing (for training), or use quantization. If the model still doesn't fit, you need to shard it across multiple devices, which may slow things down.
- Distributed inference is slower than single-GPU. The interconnect is likely the bottleneck. Try to keep the model within one node if possible, or use a model-parallel strategy that minimizes communication (e.g., tensor parallelism with high-speed links).
- Tokens per second vary wildly. This can be due to variable batch sizes or power throttling. Ensure your cooling is adequate and that you're using a consistent batch size for benchmarking.
- Costs are higher than expected. Look at idle time. If GPUs are idle waiting for data (e.g., from slow storage), you're paying for nothing. Use faster storage or prefetch data.
Frequently Asked Questions
Q: Why is memory bandwidth more important than compute for inference?
A: Because generating each token requires reading the entire model weights from memory. The compute units can multiply matrices faster than the memory can feed them, so the memory becomes the bottleneck.
Q: What is the KV cache and why does it matter?
A: The KV cache stores the key and value tensors for all previous tokens in the conversation. It grows with context length and consumes memory, reducing the space available for the model and batch size.
Q: How does quantization affect speed and cost?
A: Quantization (e.g., from FP16 to INT8) halves memory usage, so the model fits in smaller or fewer chips, and memory bandwidth is used more efficiently—often doubling tokens per second. The trade-off is potential quality loss.
Q: Is it better to buy one big GPU or several smaller ones?
A: It depends on the model size. If the model fits on one GPU, that's usually simpler and faster. If not, several GPUs with a high-speed interconnect can work, but communication overhead may reduce efficiency.
Q: Does the type of memory (HBM vs. GDDR) matter?
A: Yes. HBM offers much higher bandwidth (several TB/s) compared to GDDR (hundreds of GB/s). For LLM inference, HBM is strongly preferred.
Q: How do I estimate the cost per token?
A: Divide the total cost of the hardware (purchase/rental + power + cooling) over its useful lifetime by the total number of tokens it can generate in that time. This gives a rough per-token cost.