Skip to content
ImagineWorld

Hardware and Infrastructure

node_idnode-book_llm-systems-engineering_module-12-hardware-and-infrastructure
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num12
chapter_titleHardware and Infrastructure
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

The choice of development pathway for a large language model determines much of the financial and scheduling profile of the project, and it also determines the shape of the infrastructure required to carry out the work. Hardware is the physical embodiment of that commitment, and every decision about compute and memory capacity sets real limits on what a team can accomplish within a given budget. Understanding the properties of graphics processing units and the supporting systems that keep them fed with data is essential for anyone scoping a serious training effort. The purpose of this module is to give you a working model of how these components interact and why certain configurations succeed where others fail. A clear view of the physical layer also clarifies why published model sizes and training budgets vary so widely across otherwise similar projects.

Graphics processing units began as specialized devices for rendering, and their underlying design, built around massive parallelism and high-throughput arithmetic, turned out to suit the dense linear algebra workloads that dominate neural network training. Large language models rely heavily on matrix multiplication inside attention layers and feedforward blocks, and a modern accelerator can perform these operations orders of magnitude faster than a general-purpose central processor. Efficient GPU clustering can sustain high arithmetic throughput during the training of language models with hundreds of billions of parameters, provided that memory traffic and cross-device communication are carefully orchestrated (Narayanan et al., 2021). The same workload placed on general-purpose processors would take decades or remain infeasible, which is why accelerator availability has become the central constraint in LLM project planning.

Two properties of a GPU matter most for training work. The first is arithmetic throughput, typically measured in floating-point operations per second, which determines how quickly a device can execute the underlying linear algebra. The second is memory capacity, which determines how large a model or how large a training batch can reside on a single device before a team is forced to adopt a distributed configuration. Partitioning transformer layers across several GPUs allows models far larger than any single device’s memory to be trained at practical speeds, establishing the baseline for scaled-out training architectures in widespread use today (Shoeybi et al., 2019).

For readers new to accelerators, a helpful frame is that a GPU behaves like a factory floor with thousands of small workstations that all perform the same kind of computation in lockstep. When the computation is regular and the data fits, this design delivers extraordinary efficiency. When the data does not fit, much of the factory sits idle while bytes are shuffled between devices, and overall throughput collapses. Specialized accelerators designed specifically for machine learning, such as Google’s Tensor Processing Units, push this idea further by dedicating more of the silicon area to matrix arithmetic and removing features unused during training (Jouppi et al., 2017). The common thread across these devices is that raw arithmetic speed has outpaced memory capacity for more than a decade, which has turned memory planning into one of the central activities in LLM infrastructure design.

Hardware generations also matter for project scheduling in ways that are easy to overlook. A cluster procured at the beginning of a multi-year development effort may face direct competition from substantially faster accelerators by the time its first major training run concludes, which means that procurement decisions effectively commit a team to a particular cost curve for the duration of the project.

For general comparison, a CPU core spends most of its silicon on cache and control logic in service of finishing one complicated thread of execution quickly. It has only a handful of arithmetic units, individually powerful. A GPU streaming multiprocessor inverts this balance with minimal control, a register file and shared memory fed directly by high-bandwidth memory, and the reclaimed area spent on roughly 128 simple cores that execute the same instruction across many data elements at once. Transformer training reduces to enormous batches of matrix multiplications with regular access patterns, which makes a GPU the superior fit.

CPU Core │ GPU Streaming Multiprocessor
│
┌──────────────────────────────┐ │ ┌──────────────────────────────────────┐
│ System DRAM │ │ │ High-Bandwidth Memory (HBM) │
└──────────────┬───────────────┘ │ └────────┬───────┬───────┬───────┬─────┘
↓ │ ↓ ↓ ↓ ↓
┌──────────────────────────────┐ │ ┌──────────────────────────────────────┐
│ Large multi-level cache │ │ │ Shared memory / register file │
└──────────────┬───────────────┘ │ └────────┬───────┬───────┬───────┬─────┘
↓ │ ↓ ↓ ↓ ↓
┌──────────────────────────────┐ │ ┌──────────────────────────────────────┐
│ Complex control │ │ │ Warp scheduler │
└──────────────┬───────────────┘ │ │ Minimal control logic │
↓ │ └────────┬───────┬───────┬───────┬─────┘
┌──────────────────────────────┐ │ ↓ ↓ ↓ ↓
│ Few, powerful ALUs │ │ ┌──────────────────────────────────────┐
│ ┌─────┐┌─────┐┌─────┐┌─────┐ │ │ │ Compute grid │
│ │ ALU ││ ALU ││ ALU ││ ALU │ │ │ │ ~128 simple cores │
│ └─────┘└─────┘└─────┘└─────┘ │ │ │ ▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢ │
└──────────────────────────────┘ │ │ ▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢ │
│ │ ▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢ │
│ │ ▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢▢ │
│ └──────────────────────────────────────┘

Figure 2-11. Architectural Comparison of a CPU Core and a GPU Streaming Multiprocessor

The memory required to train a large language model comes from several sources beyond the parameters themselves. The raw weights of a model make up only a fraction of what must reside on a device during training, since the optimizer state and the activation tensors retained for backpropagation also consume substantial capacity. Rajbhandari and colleagues documented that in standard training configurations, the optimizer state alone can occupy several times the memory of the model parameters, which makes naive scaling impractical even on the largest available accelerators (Rajbhandari et al., 2020).

The precision format chosen for computation also shapes memory demand in immediate and predictable ways. Mixed precision training, in which lower precision is used for most operations while a higher precision master copy of the weights is retained, preserves convergence while dramatically reducing memory pressure (Micikevicius et al., 2018). This approach has become standard practice in large-scale training and is often the difference between a configuration that fits on available hardware and one that does not.

Batch size introduces another dimension to the memory calculation. Larger batches improve the statistical quality of gradient estimates and increase utilization of the accelerator, yet each additional sample in the batch requires its own activation memory during the forward and backward passes. Attention layers in particular store tensors whose size grows with the square of the sequence length, which has motivated specialized implementations of the attention computation itself. Dao and colleagues introduced FlashAttention as a reorganization of that computation that dramatically reduces activation memory and wall-clock time by making better use of the GPU’s memory hierarchy (Dao et al., 2022).

lse-fig-2-12-gpu-memory-composition.png

Figure 2-12. GPU Memory Composition as a Function of Batch Size

When a model and its associated training state cannot fit on a single accelerator, practitioners turn to distributed configurations that spread the work across many devices. Data parallelism replicates the model on each device and divides the input batch among them, which scales throughput while leaving per-device memory usage unchanged. Model parallelism takes a different approach and splits the model itself across devices, allowing larger networks to be trained at the cost of increased communication traffic during every training step. Techniques that combine these strategies have allowed trillion-parameter models to be trained using commercially available hardware (Rajbhandari et al., 2020).

One further technique that deserves mention is gradient checkpointing, in which certain intermediate activations are discarded during the forward pass and recomputed during the backward pass. This trades additional computation for a substantial reduction in activation memory, which allows larger batches or longer sequences to fit on the same device at the cost of a longer training step. Combined with mixed precision training, gradient checkpointing has become a routine element of the memory planning toolkit for teams working at the frontier of model scale.

A cluster of accelerators is effective only when every other part of the system keeps up with it. Training data must be read quickly enough to keep the accelerators busy, which means that storage systems capable of sustaining very high sequential throughput are a prerequisite for any serious training effort. A single training run for a frontier-scale model may pass through trillions of tokens, and token volume is one of the primary determinants of final model quality (Hoffmann et al., 2022). At these volumes, even modest inefficiencies in the data pipeline can leave expensive accelerators partially idle for significant fractions of the run.

The network that connects accelerators is the second element of the supporting stack, and its properties often determine whether a distributed training strategy can actually be realized at scale. During each optimizer step, devices must exchange gradient tensors whose total size can approach that of the full model, and the latency and bandwidth of the interconnect directly shape training speed. Narayanan and colleagues showed that achieving high utilization on clusters of thousands of GPUs depends on careful layout of the parallelism strategy relative to the physical network topology, including the use of high-bandwidth intra-node links alongside dedicated fabric for communication between nodes (Narayanan et al., 2021).

Checkpoints (Module 25) form a third element that often receives less attention than it deserves. During a long training run, the state of the model and its optimizer must be saved frequently enough that a hardware failure does not erase days of progress. Each checkpoint for a large model can occupy hundreds of gigabytes of storage, and writing such a checkpoint without stalling the training loop requires careful coordination between the compute and the storage subsystems. The wall-clock time spent on checkpointing and recovery can represent a meaningful fraction of the overall training budget at the largest scales, which makes efficient checkpoint handling a genuine engineering concern.

Beyond these core elements, practical infrastructure must also provide reliable power and cooling capable of sustaining a long training run without interruption. Monitoring and scheduling services then keep the work on track across the unavoidable hardware incidents that occur in any cluster of this size. A system that cannot sustain its peak power draw for weeks at a time, or that cannot maintain thermal conditions within specification, will experience failures that appear as software errors or as silent corruption in the training output. The reliability of these support systems has become a defining characteristic of modern AI data centers and a primary reason why frontier training runs are concentrated in a small number of facilities.

The choice between owning hardware and procuring cloud compute is one of the most consequential decisions a team makes when planning a training effort, and its outcome depends heavily on the chosen development pathway. For fine-tuning, where the compute requirement can be measured in days on a handful of accelerators, cloud procurement is usually the simpler option because the commitment is small and the work is finite. For a full from-scratch training run, where thousands of accelerators must be available for weeks or months, the economics and the operational demands change entirely, and the correct answer is far less obvious.

Cloud compute offers immediate access and elastic capacity, which matches the needs of teams whose workloads are sporadic or whose requirements evolve as research progresses. A team that needs a hundred accelerators for two weeks, and nothing after that, can obtain the capacity without committing to the capital expense of building a cluster. Patterson and colleagues observed that major cloud providers often operate their accelerator fleets at higher average utilization than private clusters, which translates into lower effective cost per unit of useful compute when workloads are well-matched to the provider’s offerings (Patterson et al., 2021). The pricing premium that cloud providers charge reflects the value of that elasticity and the cost of the operational staff who keep the infrastructure healthy.

Owned hardware becomes the more sensible option when usage is continuous and predictable over a horizon long enough to amortize the purchase. Organizations running multiple training projects back-to-back, or supporting large-scale inference workloads alongside experimental training work, frequently find that dedicated clusters repay their initial cost within a year or two. The savings come in part from avoiding the margin built into cloud pricing and in part from eliminating the unpredictable data transfer costs associated with moving terabytes between a local environment and a provider’s systems. Data residency requirements may also make cloud placement impractical for certain regulated industries, while the operational complexity of running a high-availability training cluster may exceed what a small team can absorb without dedicated infrastructure staff.

A useful planning heuristic is to compare the amortized cost of owned hardware over a realistic lifespan against the corresponding cloud commitment for the same workload, while giving explicit weight to the flexibility that cloud procurement preserves. Teams that overestimate their future utilization routinely discover that their owned cluster spends substantial time idle, which erases much of the supposed advantage of ownership. Teams whose usage grows beyond what they planned for find themselves paying a premium for emergency cloud capacity when their owned systems are fully booked. The correct answer for any given project is seldom obvious at the outset, and revisiting the decision as the work progresses is a normal part of responsible infrastructure planning. Continued pretraining projects, which sit between fine-tuning and from-scratch work in scale, frequently benefit from a hybrid approach in which an initial exploration phase runs on cloud infrastructure and the final long-running training uses reserved or owned capacity.

This book includes additional resources to support and continue your AI journey. Scan the QR code below (or go to ashford-publishing.com/materials) and enter the book code found at the back of this book.