Matrix Multiplication Complexity: What Really Bounds the LLM Parameter Race
This article explains why parameter count alone does not determine a model's capability or sustainability in the large language model scale race. It separates the two metrics that are often confused—parameter count and training tokens—then walks through scaling laws and compute-optimal training, works out concrete compute and cost estimates, breaks down the three separate accounting dimensions of Mixture-of-Experts (MoE) models, and traces the complexity history of matrix multiplication from the naive O(n³) implementation through Strassen's algorithm and recent asymptotic improvements. It closes with practical guidance on measuring, optimizing, and reproducing large-scale training.
Matrix Multiplication Complexity: What Really Bounds the LLM Parameter Race
Summary: Parameter count is not the same as training data volume, nor does it equal model capability. What truly constrains model scale is the compute budget and engineering efficiency, and matrix multiplication is the core operation running through that entire line.
1. The Misread Premise: Parameter Count and Training Tokens Are Not the Same Thing
A discussion about model scale made the rounds recently. Its central claim was that “a leading overseas closed-source large model has reached 25T parameters, while the largest publicly disclosed models from domestic vendors are only around 1T; the former is an unsustainable, aggressive approach that will eventually run into problems, while the latter is more rational on this dimension.”
Parts of this judgment are worth affirming: skepticism toward “infinitely stacking parameters” is reasonable, and confidence in domestic models has grounds. But the “25T” figure itself likely conflates two metrics that are easy to mix up:
- Parameters (N): The number of trainable weights in the model. This determines the model’s capacity ceiling and the storage required for weights, gradients, and optimizer states.
- Training tokens (D): The total number of text units the model actually “reads” during training. This determines how much data the model has seen.
Considering only the weight matrices, a dense Transformer’s forward pass costs roughly 2N per token (N being the parameter count), and backpropagation costs about twice the forward pass. So the training cost for a single token is roughly 6N. Parameter count and token count are related multiplicatively, not compared on the same axis.
From public information, mainstream large models have long been in the “trillion” range: many models in published papers and model cards have trained on more than 10 trillion tokens, and a few projects have reported training data approaching 30 trillion tokens; several vendors have also released Mixture-of-Experts (MoE) models with total parameter counts in the trillions. Therefore:
- If “25T” refers to parameters, it lacks a reliable public basis. Mainstream closed-source labs typically do not disclose parameter counts, and this number is closer to an exaggerated rumor from early discussions.
- If “25T” refers to training data, it falls within the reasonable range of public reports—but then it is no longer a conclusion about “parameter count.”
Moreover, MoE models have both a total parameter count and an activated parameter count, and different vendors use different conventions. Comparing figures with different conventions directly is like comparing “vehicle curb weight” against “engine displacement”—the conclusion is naturally unreliable. As we will see later, the claim that “domestic models top out at 1T” also needs to be reinterpreted in a sparse-model context.
2. Scaling Laws and the Compute Budget: Why Stacking Parameters Hits a “Cost Wall”
2.1 Compute-Optimal: Parameters and Data Should Grow Proportionally
Research represented by the GPT-series scaling laws (2020) found that a model’s cross-entropy loss L on a test set approximately follows a power-law relationship with parameters N, data D, and compute C:
L(N) ≈ (N_c / N)^α_N (α_N ≈ 0.076)L(D) ≈ (D_c / D)^α_D (α_D ≈ 0.095)
The core implications are two:
- Smooth and predictable: Loss decreases as a power law with scale. Fitting a curve at small scale allows fairly reliable extrapolation of larger models’ performance.
- Diminishing returns: Each fixed multiple increase in scale yields a narrowing gain.
The Chinchilla study (DeepMind, 2022) further corrected the tendency to believe “bigger is always better.” Its conclusion: with a fixed compute budget, parameters and training tokens should be scaled up roughly proportionally—about 20 tokens per parameter—for the best training outcome. In earlier practice, many models were undertrained, with parameter counts too large relative to too little data. Later research also found that extending the training objective from next-token prediction to predicting multiple tokens across multiple positions can train smaller models with the same compute, shifting the parameter-data balance point.
2.2 Running the Numbers
From the relationship above, we can derive an estimate of training compute at compute-optimal settings, where “parameters × training tokens” governs cost:
C ≈ 6 × N × D
With N in billions (B) and D in trillions (T), this simplifies to:
C ≈ 6 × N × D × 10^21 (FLOPs)
From this we can build a “compute bill”:
| Total parameters | Compute-optimal tokens (~20 tokens/param) | Training compute estimate (C≈6ND) |
|---|---|---|
| 7B (dense) | ~0.14T | ~5.9×10^21 FLOPs |
| 70B (dense) | ~1.4T | ~5.9×10^23 FLOPs |
| 405B (dense) | ~8.1T | ~2.0×10^25 FLOPs |
| 1T | ~20T | ~1.2×10^26 FLOPs |
| 25T | ~500T | ~7.5×10^28 FLOPs |
The B, T, and FLOPs units here are all standard. The second-to-last row corresponds to the “1T parameters” scale. The last row is projected from “25T parameters”: even ignoring whether 500T tokens of high-quality data could be assembled, the compute alone is roughly 625× that of the trillion-parameter plan, and training time would scale by the same factor.
2.3 Converting Compute into GPUs and Electricity
Using a rough assumption of “about 100 TFLOPs sustained effective compute per card” (i.e., 1e14 FLOP/s):
- 1T parameters / 20T tokens: about 1.2e12 card-seconds, or roughly 38,000 card-years. Training with 10,000 cards would take about 3.8 years.
- 25T parameters / 500T tokens: about 7.5e14 card-seconds, or roughly 24 million card-years. Even with 100,000 cards training simultaneously, it would theoretically take about 238 years.
Real engineering must also account for:
- Fault recovery: Hardware failures and job interruptions are unavoidable in large-scale clusters, and effective compute utilization is typically well below peak.
- Communication overhead: Communication among data parallelism, tensor parallelism, pipeline parallelism, and expert parallelism further erodes compute.
- Recomputation overhead: Activation recomputation, used to save memory, adds extra forward computation.
Using a rough estimate of 0.7 kW power per card, training a 1T-parameter model (1.2e12 card-seconds) consumes about 8.4e11 Wh—roughly 840 million kWh. And that is the cost of just one pretraining run. A 25T dense-parameter model, if put into real use, would keep accumulating marginal inference costs over time. This is precisely why the industry consensus is that, under real-world constraints on data, power, and hardware, stacking parameters must follow a “cost-performance curve”—diminishing marginal returns are a hard constraint. In this sense, the original author’s worry about “unsustainability” is justified.
2.4 You Cannot Simply Conclude That “Smaller Models Are Smarter”
But we must guard against over-extrapolation: scaling laws describe “how to configure optimally under a given compute budget,” not “bigger is dumber.”
- Trillion-scale flagship models are usually not trained in isolation. They emerge from the combined effect of massive data, better data mixtures, longer training schedules (far beyond the compute-optimal point), post-training (RLHF, reinforcement learning with verifiable rewards, etc.), and extra inference-time computation.
- Conversely, a MoE model with 1T total parameters might activate only billions of parameters per token, and its compute efficiency is not necessarily better than a 70B dense model; the final capability gap stems more from data quality, training recipe, and post-training strategy.
- What truly determines the gap is often the architecture, data, and training methods—not just “how many parameters you turned on.”
3. From Dense to Sparse: MoE Models Need Three Separate Accounts
3.1 Basic Structure
The basic idea of MoE is to replace the feed-forward network (FFN) layers with several parallel “expert” subnetworks, and let a routing network (gating) select a few experts to participate in computation for each token. If there are E experts and each token activates k of them, the parameters and compute of the feed-forward portion scale up by roughly E times and k times, respectively. Let a dense model’s single-layer parameters be p; then:
Total parameters ≈ p × E, per-token activated parameters ≈ p × k
For example, with E=64 and k=2, the feed-forward parameters are 64× those of the dense model, while compute is only 2×. This is the source of “large in total, but light per token.”
3.2 Three Conventions for Parameter Count
When discussing “how big” an MoE model is, there are at least three distinct conventions:
- Total parameters: The sum of all weights; determines memory footprint and the deployment threshold.
- Activated parameters: The weights that actually participate in computation for a single token; determines per-token compute.
- Sparsity: The ratio of total to activated parameters; reflects the degree to which compute is traded for capacity.
If “domestic models top out at 1T” refers to total parameters, it is closer to a dense model’s capacity ceiling; but using dense-model compute as the denominator for comparison leads to the erroneous conclusion that “sparse models have astonishing compute.”
3.3 The Three Accounts Must Be Calculated Separately
Memory, bandwidth, and communication are three accounts that MoE training must tally separately:
- Memory: In mixed-precision training, each parameter needs—beyond a weight copy—its gradient and Adam-type optimizer state such as momentum and variance; per-parameter overhead often reaches ten-plus bytes. For a model with 1T total parameters, parameter-related state alone may occupy ten-plus TB of memory, which must be partitioned using a combination of data, tensor, pipeline, and expert parallelism.
- Bandwidth and compute: MoE routing is data-dependent; the distribution of tokens to experts within the same batch cannot be predetermined, and typically requires All-to-All communication between devices. Under load imbalance, some experts are overloaded while others sit idle, and overall speed is dictated by the slowest expert. Engineering practice introduces load-balancing loss, capacity factors, and dropping or rerouting mechanisms to mitigate this—but these mechanisms themselves add overhead.
- Storage and deployment: A sparse model’s total weights are large, but a single inference reads only the activated portion. When memory is ample and concurrency is high, the compute cost of a single inference is relatively manageable; but when memory is tight or concurrency is low, weight movement and cache management become the bottleneck.
In other words, MoE trades “compute” for “parameter storage and communication.” It lets total parameters grow substantially while keeping compute moderate, at the cost of significantly increased system complexity. Whether this trade-off pays off in engineering terms depends on hardware conditions and load characteristics, and cannot be generalized.
3.4 Comparison with Dense Models
| Dimension | Dense model | MoE sparse model |
|---|---|---|
| Parameter convention | Total = Activated | Total ≫ Activated |
| Per-token compute | Proportional to parameters | Only proportional to activated parameters |
| Memory footprint | Proportional to parameters | Proportional to total parameters; heavier burden |
| Training communication | Data/tensor/pipeline parallel | Adds expert-parallel All-to-All |
| Load balancing | Naturally uniform | Depends on routing and balancing strategy |
| Deployment threshold | Proportional to parameters | High memory threshold, but lighter per-request compute |
4. Back to the Algorithm: A Brief History of Matrix Multiplication Complexity
Behind the “compute bill” above, the most fundamental operation is matrix multiplication. Whether in fully connected layers, attention projections, or the expert feed-forward in MoE, the essence is batched matrix multiplication. So any discussion of model scale cannot avoid the complexity of matrix multiplication.
4.1 The Naive Implementation: O(n³) and 2n³ Floating-Point Operations
The definition of multiplying two n×n matrices is:
C[i][j] = Σ_{k=1}^{n} A[i][k] · B[k][j]
Element-by-element computation requires n² elements, each needing n multiplications and n−1 additions—about 2n³ floating-point operations, with time complexity O(n³). In real systems, multiplication is usually executed as fused multiply-add (FMA), where one instruction completes one multiply-add; some literature therefore counts the work as n³ “multiply-adds,” which differs from 2n³ FLOPs only in counting convention.
4.2 The Performance Bottleneck of the Naive Implementation
Under a naive implementation, matrix multiplication often fails to “max out” the hardware. Let the cache line size be B elements, and use the common i-j-k loop order on n×n matrices:
for i in range(n):for j in range(n):for k in range(n):C[i][j] += A[i][k] * B[k][j]
Every row repeatedly reads the full row data of A and B, so memory accesses number roughly Θ(n³/B), giving a low compute-to-memory ratio. As n grows, performance becomes memory-bound rather than compute-bound. The classic blocked matrix multiply reduces memory accesses to the asymptotically optimal Θ(n²·n/B) level, i.e., an I/O complexity of Θ(n² + n³/B). The idea is to cut the matrices into sub-blocks that fit the cache, so that each loaded data block can be reused repeatedly.
Real high-performance implementations layer on multiple optimizations: loop interchange (i-k-j order), register blocking, SIMD vectorization, multi-level cache blocking, multithreaded parallelism, and hardware-specific micro-kernels. The following is illustrative code only:
import randomimport timedef matmul_benchmark(n):# Generate two n×n random matricesA = [[random.random() for _ in range(n)] for _ in range(n)]B = [[random.random() for _ in range(n)] for _ in range(n)]# Naive triple loop: i-k-j order (friendlier for consecutive access to rows of A and B)C = [[0.0] * n for _ in range(n)]t0 = time.perf_counter()for i in range(n):Ci = C[i]for k in range(n):a = A[i][k]Bk = B[k]for j in range(n):Ci[j] += a * Bk[j]t1 = time.perf_counter()flops = 2 * n ** 3 # n^3 multiplications and n^3 additionstflops = flops / (t1 - t0) / 1e12 # Measured effective throughput (TFLOPS)return t1 - t0, tflopsif __name__ == "__main__":n = 512sec, tflops = matmul_benchmark(n)print(f"n={n}: {sec:.3f}s, effective throughput ~ {tflops:.6f} TFLOPS")
This code only illustrates the measurement method and cannot serve as a performance conclusion:
- Pure Python element-wise loops run far slower than mature high-performance matrix-multiply kernels; the gap often exceeds an order of magnitude.
- If run directly in a script or interactive environment without warmup, the first call also includes compilation and cache-initialization overhead, and the measured number will be low.
- A more meaningful experiment fixes n and the hardware, then compares effective throughput across different loop orders, block sizes, and thread counts, while also recording memory access volume and cache-hit rates.
4.3 A Simple Yardstick for the “Upper Bound”
Matrix multiplication has a trivial complexity lower bound: you must at least read all inputs and write all outputs, so its time complexity lower bound is Ω(n²). Since “filling the matrix” also takes n² steps, no general algorithm can go below Θ(n²). Whether O(n²) can actually be reached remains an open problem.
4.4 The Strassen Algorithm and “Recursively Faster”
In 1969, Strassen found that multiplying two 2×2 matrices needs only 7 multiplications (rather than 8), at the cost of adding several extra additions and subtractions. Applying this idea recursively yields the time complexity:
T(n) = 7·T(n/2) + O(n²) ⇒ T(n) = O(n^{log₂7}) ≈ O(n^{2.807})
Over the following decades, constructions such as Coppersmith–Winograd pushed the exponent steadily lower. As of now, the best publicly known asymptotic exponent is about 2.3715 (2024, Williams et al.).
But “asymptotically faster” does not mean “actually faster”:
- Constant factors and applicability: The correctness of these algorithms depends on complex tensor decompositions with large constant factors; they often have a theoretical advantage only when n exceeds an enormous threshold, and are sometimes called “galactic algorithms.”
- Numerical stability: Strassen-type algorithms amplify floating-point errors, which is especially sensitive in low-precision training.
- Engineering support: Many high-performance numerical libraries select Strassen variants only under specific conditions, not as the default path.
In recent years, research using “algorithm discovery” methods has also found faster multiplication schemes at limited scales. For example, some work found a scheme that completes 4×4 matrices in 47 multiplications, one fewer than the traditional decomposition. Such results are theoretically valuable but are likewise constrained by applicability and numerical stability. It is clear that a small improvement in asymptotic complexity does not necessarily translate into a perceptible end-to-end gain on general hardware.
4.5 Precision and Numerical Stability
Large-model training has shifted comprehensively from FP32 to BF16/FP16 and is gradually exploring FP8 and even lower precision. This has two direct consequences:
- On matrix-multiply units that support the corresponding precision, the number of multiply-adds completable per unit time increases several-fold—one of the important sources of recent growth in training compute.
- At lower precision, accumulation errors are more sensitive, and higher-precision accumulators, sensible scaling, block accumulation, or stochastic rounding are usually needed to keep convergence stable.
This further shows that the “compute” that determines model scale is not only the hardware peak, but also the engineering ability to “use the hardware fully, stably, and efficiently.”
5. Summary and Engineering Recommendations
- Clarify the conventions before comparing: When discussing model scale, always state total parameters, activated parameters, training tokens, and training compute together, and avoid drawing conclusions from a single number.
- Scale is a function of efficiency: With a fixed compute budget, parameters, data, and training strategy must be jointly optimized rather than stacked at a single point.
- Watch marginal returns: Once the gain from parameter expansion falls below the rise in inference cost from an equivalent investment, continuing to stack parameters becomes increasingly questionable—and this is precisely the reasonable core of the original author’s “unsustainable” concern.
- Do not ignore the implementation gap: For the same n, the throughput difference between a naive triple loop and a highly optimized matrix-multiply kernel can be an order of magnitude; optimize the implementation before discussing algorithm replacement.
- Value reproducibility: Benchmarks should record the hardware model, precision mode, loop order, block size, warmup, and timing method; otherwise numbers from different sources cannot be compared side by side.
- View asymptotic complexity rationally: A theoretically superior matrix-multiply algorithm is not necessarily faster on general hardware; engineering gains usually come from the combination of blocking, precision, parallelism, and communication overlap.
To reproduce the scale experiments above on your own cluster or a cloud platform, you typically need to prepare the following resources:
- GPU compute instances and high-performance networking;
- Object storage (for training data and checkpoints);
- Logging services and monitoring/alerting (to track compute utilization, throughput, and failures).
As for whether the scale of public benchmark data and the hardware conditions are representative, and whether conclusions hold at larger scales, both must be tested with reproducible experiments and data—not left at a number comparison with unclear conventions. The next stage of the model scale race will not be about “who has more parameters,” but “who uses the same compute more intelligently.”
