Hardware Limits in Large Model Training and Inference: Rack Boundaries, Batch Economics, and Data Scaling
This article explains how physical hardware topology shapes the architecture and deployment of large models. It covers how the roughly 8x bandwidth drop across rack boundaries constrains expert-layer width in MoE models, why batch size is the primary variable behind inference cost, why pretraining datasets often far exceed the scaling-law optimum, and a practical capacity-planning checklist for building elastic inference systems.
1. Starting Point: Model Shape Is Determined by Hardware Topology
Discussing why large models “look the way they do” often stalls at the level of parameter counts and algorithms, producing conclusions that are hard to act on. A more effective entry point is the physical layer: training and inference for modern frontier models run on clusters of accelerator cards, and a cluster is not a flat compute pool. It is divided into tiers—high-bandwidth memory inside a single card, inter-card links within a machine, a fully connected network within a rack, and a data-center network across racks. The bandwidth gap between each tier propagates upward by orders of magnitude and ultimately hardens into choices about model architecture, deployment shape, and even how external service pricing is structured.
The single most useful rule of thumb to remember is this: once communication crosses a rack boundary, effective bandwidth drops by roughly an order of magnitude (about 8x). The number looks plain, but it is the key to understanding the upper limit of sparse-model deployment.
2. How the Rack Boundary Caps Expert-Layer Size
Take the mainstream Mixture-of-Experts (MoE) architecture as an example. These models split the feed-forward layers into a large number of “experts,” and each token is routed to only a few of them. A configuration scale commonly discussed publicly is on the order of hundreds of total experts (for example, 256), with only single digits to a few dozen experts activated per token (for example, 32). This high sparsity brings a direct benefit: the total parameter count can be very large while the compute (FLOPs) per token stays manageable.
The problem is that expert parallelism naturally takes the form of all-to-all communication: the routing result on every card may send tokens to any other card. The high-bandwidth fully connected topology inside a rack matches this pattern exactly. But once experts are split across two racks, a substantial fraction of tokens travel over cross-rack links that are an order of magnitude slower, and communication immediately becomes the end-to-end bottleneck.
This leads to an engineering conclusion: the size of a rack effectively limits how wide you can make the expert layer. To keep increasing sparsity, there are only three paths—improve cross-rack interconnect quality, compress the expert layer back into a single rack, or accept lower throughput and higher unit cost.
This also offers a lens for explaining an industry phenomenon: some teams made progress on large-scale pretraining earlier not necessarily because their algorithms were ahead, but possibly because their in-house accelerator systems had a larger scale-up domain (the number of cards that can be fully interconnected at high speed) over a long period, allowing them to deploy higher-sparsity models while maintaining inference efficiency. This is a reasonable inference based on public information, not a confirmed internal fact.
3. Batch Size: The First-Principles Variable of Inference Cost
On the question of “can a slower mode be traded for a lower price,” the core variable is batch size, not some switch.
Inference cost can be roughly split into two parts: weight reading (related to parameter count and activated parameter count, usually determined by memory bandwidth) and compute (determined by compute throughput). When the batch is very small, weight reading is amortized over very few tokens, so per-token cost is extremely high. As the batch grows, weight reading is fully amortized and cost drops quickly, until compute saturates. A gap of three orders of magnitude (about 1000x) between the two ends is not exaggerated.
An illustrative cost model (expressing only the trend, not measured data from any product):
def per_token_cost(batch_size, active_params, bw, flops, util=0.7):# Weight bytes read per step (approximate, ignoring KV cache and communication)weight_bytes = active_params * 2read_time = weight_bytes / bwcompute_time = (batch_size * active_params * 2) / (flops * util)step_time = max(read_time, compute_time) # the two overlapreturn step_time / batch_size # per-token time is proportional to cost
The key implication of this code is that when compute_time < read_time, increasing the batch boosts throughput almost for free; past the inflection point, returns diminish. So inference serving must rely on concurrency aggregation to amortize cost, and aggregation capacity is limited by memory capacity (weights plus KV cache) and scheduling strategy (continuous batching, paged cache management, prefix reuse).
4. Why Pretraining Data Volume Far Exceeds the “Theoretical Optimum”
The “optimal data volume” given by scaling laws is the ratio that minimizes validation loss under a fixed compute budget. But the pretraining data volume of frontier models often reaches two orders of magnitude (for example, about 100x) above that theoretical value. The reason lies not in mathematics but in engineering and economics:
- Amortization on the inference side: the extra data cost spent in training is one-time, while inference cost accumulates over the long term with call volume. Training a model to be “over-strong” can save ongoing spending on the inference end.
- Capability redundancy in small-batch scenarios: low-concurrency, long-context, high-accuracy tasks cannot amortize cost through large batches and can only rely on a stronger model itself.
- Data availability window: high-quality corpora are not in infinite supply, and “using them up” first is often more important than precise ratios.
- Optimization stability: with ample data, you can use a smaller learning rate and longer training, reducing late-stage instability and rollbacks.
5. An Actionable Capacity-Planning Checklist
- Quantify the topology first: determine the scale-up domain size and the cross-domain bandwidth ratio, then decide the expert-layer width and parallelism strategy (a combination of expert parallelism plus tensor/pipeline parallelism).
- Use the cost model above for sensitivity analysis: find the batch at the throughput inflection point, and assess whether memory can support the KV cache for that batch.
- Tier the service: route interactive requests through a low-latency small-batch channel and offline batch jobs through a large-batch high-throughput channel, so they do not crowd each other out.
- Build observability: bring queue wait time, batch-size distribution, memory usage, and cross-domain communication time into monitoring and alerting, and use a logging service for long-term trend analysis.
- Elastic scaling: deploy the stateless inference layer as containers on a container platform, auto-scaling by queue depth; store model weights and datasets in object storage, and warm up cold starts with images.
6. Conclusion
The shape of frontier models is not a pure algorithmic choice but an equilibrium under the joint constraints of “bandwidth tiers + batch economics + data window.” Understanding the order-of-magnitude gap caused by rack boundaries, reducing inference cost to a function of batch, and recognizing that excess data volume is a long-term investment aimed at the inference end all help make more rational architecture and budget decisions when building in-house or selecting systems. If an enterprise wants to implement a similar architecture on Baidu AI Cloud, it can build the capacity-planning and elastic inference system described above on general capabilities such as the container platform, object storage, and monitoring and alerting.
