The Underlying Logic of LLM Training and Inference: From Hardware Topology to Cost Structure
This article explores the fundamental hardware mechanisms that dictate the architecture, pricing, and development speed of modern large language models. Examining four dimensions—communication bandwidth, parallel strategies, sparse activation, and batching economics—it reveals how hardware constraints (like the 8x bandwidth gap) shape MoE architectures, how batch sizes determine inference economics, and how over-training optimizes lifecycle costs. It provides actionable insights for developers to optimize deployment and cost structures.
The Underlying Logic of LLM Training and Inference: From Hardware Topology to Cost Structure
Understanding why today’s large language models (LLMs) look the way they do—their specific architectures, pricing, and pace of advancement—requires looking beyond the models themselves and diving into the hardware layer. Using a logical framework, this article systematically deconstructs the training and inference mechanisms of frontier large models across four dimensions: communication bandwidth, parallel strategies, sparse activation, and batching economics.
1. It All Starts with Hardware: The “8x Bandwidth Gap” Inside and Outside the Rack
Modern LLM training and inference run on accelerator clusters, and there is a stark physical dividing line in cluster communication capabilities:
- Inside the rack: Accelerators are directly connected via high-speed inter-chip interconnect technology, providing extremely high bandwidth and low latency. A single rack can typically house dozens of accelerators (around 72 is common in the industry), forming a “scale-up domain.”
- Across racks: Traffic must traverse the data center network (a switch-based scale-out network), where bandwidth drops sharply—industry experience suggests it is about 8x slower—and latency worsens concurrently.
This “8x gap” is not an engineering flaw but a trade-off of physics and cost. However, it has a decisive impact on LLM architecture design, with Mixture of Experts (MoE) models being the most prominent example.
2. MoE Architecture: The Allure of Sparse Activation and the Cost of Communication
2.1 The Basic Idea of Sparse Activation
The core concept of MoE is that instead of using a single dense network to process all inputs, the model prepares numerous “expert” sub-networks, activating only a small fraction during each inference pass. In a typical public configuration, a model might contain 256 experts, with each token routed to only about 32 of them per forward pass.
The benefits are significant: the total parameter count can be made very large (high knowledge capacity), while the single-pass compute volume is only proportional to the number of activated experts (low inference cost). The higher the sparsity, the more effective parameters per unit of compute, resulting in a better price-to-performance ratio.
2.2 Expert Parallelism and All-to-All Communication
The most natural deployment method for MoE is “expert parallelism,” where different experts are distributed across various accelerators. This means a token on any accelerator might be routed to an expert on any other accelerator, creating an all-to-all communication pattern.
The key insight is that the traffic pattern of all-to-all communication aligns perfectly with the topology of in-rack high-speed interconnects. Inside a rack, there are nearly equivalent high-bandwidth pathways between every pair of accelerators, allowing tokens to “jump” freely without creating noticeable bottlenecks.
2.3 The Rack Boundary is the Scale Boundary
Problems arise when the number of experts exceeds the capacity of a single rack. Once experts are forced to be distributed across two racks, theoretically half of the token routing traffic must traverse the 8x slower cross-rack network. Inference is a latency-sensitive task; the slowest path determines the overall speed, making the cross-rack link an immediate systemic bottleneck.
This leads to a crucial inference: the size of a single high-speed interconnect domain directly limits the deployable scale of the expert layer. Hardware systems with larger scale-up domains can maintain all-to-all communication efficiency across a broader range, thereby supporting MoE models with higher sparsity. This is a key physical reason behind the actual performance gaps between different hardware systems in the LLM race. Certain proprietary chip systems historically possessed larger scale-up domains, making it easier for them to successfully train large-scale sparse models early on. This is not magic; it is a direct result of communication topology.
3. The Economics of Inference: Batch Size is the True Cost Lever
3.1 Without Batching, Costs Can Be a Thousand Times Higher
Calculating inference costs reveals a counterintuitive property: when a single request exclusively occupies a forward pass, the accelerator’s compute utilization is extremely low. This is due to the arithmetic intensity of matrix multiplication—the time compute units spend waiting for weights to be read from memory far exceeds the actual computation time. By combining multiple requests into a batch, weights are loaded once and reused across all requests, significantly mitigating the memory bandwidth bottleneck.
Quantitatively, without batching, the effective cost of a single inference can be 100 to 1,000 times higher than with full batching. This is a gap dictated by hardware physics that software optimization cannot simply erase.
3.2 The Mathematical Explanation for “Fast Mode” Premiums
A common market phenomenon is that certain model services offer a “fast mode” priced about 6x higher, while only delivering end-to-end speeds roughly 2.5x faster. Why does the value proposition seem so poor?
The answer remains batching. Low-latency modes mean the system cannot wait to accumulate large batches; it must use small batches or even immediate scheduling, leading to lower memory bandwidth reuse and surging compute costs per token. The nonlinear price increase accurately reflects the nonlinear costs of small-batch inference—the resource investment required for a 2.5x speedup far exceeds a proportional increase.
This also answers a reverse question: Can a “slow mode” be used to secure lower prices? Theoretically, absolutely. Allowing the system to aggregate requests over a longer time window and run larger batches can significantly reduce costs. This is the underlying logic behind the lower pricing of offline batch inference and asynchronous task APIs. For developers, peeling latency-insensitive tasks (like data cleaning, batch summarization, and offline evaluation) from the online link to a batch processing link is one of the most direct methods for optimizing LLM costs. When using cloud model services, properly distinguishing between online inference and offline batch processing workloads, combined with elastic scheduling via container platforms, can often yield order-of-magnitude cost improvements.
4. Observations on the Training Side: Data Volume vs. Theoretical Optimality
There are also numbers worth analyzing on the training side. According to widely cited “compute-optimal” scaling theories, under a given compute budget, the model’s parameter count and training data volume should maintain a specific ratio. However, some analyses suggest that the pre-training data volume for certain frontier models is hundreds of times the theoretical optimum.
This deviation is not an error but a difference in objective functions. The theoretical optimum targets “training compute efficiency,” while labs are actually optimizing for “the ceiling of model capability.” When training compute is relatively abundant but high-quality model capability is scarce, “over-training” a relatively smaller model with far more data than the optimal ratio can yield lower inference costs and higher capability density. For products that need to serve massive request volumes, this is a superior lifecycle economic calculation.
5. Practical Insights for Developers
Synthesizing the above analysis, several actionable engineering principles emerge:
- Focus on deployment morphology when evaluating models: The ratio of sparsity, the number of experts, and the number of activated experts directly reflects a model’s inference cost structure, making it more meaningful than simply comparing total parameter counts.
- Combat costs with workload layering: Route real-time interactions through small-batch, low-latency links, and batch tasks through asynchronous, large-batch channels. Mixing the two is where waste is most severe.
- Understand the nonlinear relationship between latency and cost: Pursuing extreme low latency incurs super-linear penalties. SLA designs should leave windows for batching within the bounds of acceptable business latency.
- Monitor the evolution of hardware interconnect domains: The expansion of scale-up domains will continuously unlock models with higher sparsity, serving as an important leading indicator for predicting the capability trajectory of next-generation models.
Conclusion
Many “industry mysteries” surrounding large models—why MoE has become mainstream, why fast modes are prohibitively expensive, why different labs progress at different rates—do not have their answers in algorithm papers. They lie in the communication topologies and memory bandwidth curves of chips. Once the deduction chain of “hardware constraints -> parallel strategies -> architecture choices -> cost structures” is established, why AI is the way it is today makes complete sense.
