LLM Training Optimizer Memory Bottlenecks and Matrix-Level Orthogonal Updates

    As large language models scale from tens of billions to trillions of parameters, training bottlenecks have shifted from peak compute power to the balance between memory capacity, bandwidth, communication efficiency, and training stability. This article explores the memory bottlenecks of traditional element-wise adaptive optimizers and introduces the core concept of matrix-level orthogonal updates. It further analyzes the potential advantages, engineering challenges, and evaluation methods required to adopt this approach in large-scale training environments.

    LLM Training Optimizer Memory Bottlenecks and Matrix-Level Orthogonal Updates

    Recently, the open-source availability and training practices of ultra-large models have brought “optimizer state memory” to the forefront. As model parameter scales move from tens of billions toward a trillion, the bottleneck of training systems is no longer just peak compute. Instead, it is a comprehensive balance among memory capacity, memory bandwidth, communication efficiency, and training stability. Especially when training tasks need to accommodate larger batch sizes, longer contexts, and higher throughput on limited clusters, the GPU memory consumed by optimizer states directly squeezes the space available for activations, communication buffers, and pipeline parallelism.

    This article does not focus on any specific model or optimizer product. Instead, starting from general technical problems, it discusses the memory bottlenecks of traditional element-wise adaptive optimizers, the core ideas behind matrix-level orthogonal updates, engineering challenges in deployment, and evaluation methods. For developers and enterprise users, the truly valuable question is not whether a specific model is open-source, but rather: in large-scale training, how do we understand the cost of optimizer states, how do we evaluate whether a matrix-level update scheme is worth replacing the traditional one, and how do we use controlled experiments to verify the benefits and risks.

    1. Why Optimizer States Become a Memory Bottleneck

    In mixed-precision training, a single parameter occupies more than one memory footprint. A typical training task involves at least the following states:

    • Low-precision parameter copies: used for forward and backward computation;
    • Low-precision gradients: generated during backpropagation;
    • High-precision master weight copies: used for stable updates;
    • Optimizer states: such as momentum and second-order moments;
    • Activations, temporary tensors, communication buffers, and fragmented memory.

    For element-wise adaptive optimizers, each parameter element typically requires maintaining two types of states: the first-order moment and the second-order moment. If saved in FP32, these two states for a single parameter amount to 8 bytes. For a trillion-parameter model, optimizer states alone reach the scale of several TBs. If the parameter scale expands further, the state memory will rapidly approach or even exceed the available capacity of a single machine or a single group of devices.

    This can be estimated using a simplified formula:

    1. Element-wise adaptive optimizer state memory ≈ N × bytes(m) + N × bytes(v)
    2. Where N is the number of parameters, m is the first-order moment, and v is the second-order moment.
    3. If m and v are both saved in FP32, it is about 8 bytes per parameter.
    4. Trillion-parameter model: 1e12 × 8 B ≈ 8 TB.

    This does not even include parameter copies, gradients, master weights, activations, and communication buffers. If we roughly add up parameters, gradients, master weights, and optimizer states, the basic memory requirement for a trillion-parameter model reaches a dozen TBs or more, not to mention the rapidly growing activations in long-context training. The direct consequences of memory pressure include:

    1. Squeezed Batch Size: Only smaller batch sizes can be used, affecting throughput and gradient stability;
    2. Limited Context: Long-context training requires more activation memory, easily triggering recomputation or partitioning;
    3. Increased Parallelism Complexity: To distribute state memory, more complex data parallelism, tensor parallelism, pipeline parallelism, and state sharding must be introduced;
    4. Higher Communication Costs: State sharding and gradient aggregation introduce additional communication;
    5. Increased Training Costs: Insufficient memory leads to lower device utilization, more recomputation, and longer wait times.

    Therefore, optimizer innovation is not just a “change in mathematical formula”; it is an infrastructure issue that directly impacts the cost structure of the training system.

    2. Essential Differences: Element-Wise vs. Matrix-Level Updates

    The core idea of traditional element-wise adaptive optimizers is to maintain historical gradient statistics separately for each parameter element and scale the update step size accordingly. It can be written as simplified pseudocode:

    1. for step in training_steps:
    2. g = backward(loss)
    3. m = beta1 * m + (1 - beta1) * g # First-order moment
    4. v = beta2 * v + (1 - beta2) * g * g # Second-order moment
    5. w = w - lr * m / (sqrt(v) + eps)

    The advantage of this approach is that it is intuitive, mature, and relatively robust to hyperparameters. However, it also means that each element has an independent update direction and scale. For ultra-large matrices, this “element-wise fine-grained control” brings massive state overhead.

    Matrix-level orthogonalization updates take a different perspective: treating the weight matrix in the hidden layer as a whole, rather than a collection of unrelated scalars. Its core process can be summarized as follows:

    1. Calculate the gradient of the weight matrix;
    2. Combine the gradient with momentum to get the matrix to be updated;
    3. Apply approximate orthogonalization to this matrix to make the distribution of singular values in the update direction more balanced;
    4. Add the processed direction matrix as a whole to the weight matrix.

    The simplified pseudocode is as follows:

    1. for matrix_w in hidden_layer_weights:
    2. grad = backward_grad(matrix_w)
    3. momentum = momentum_update(momentum, grad)
    4. # Approximate orthogonalization: makes the update matrix direction more stable,
    5. # preventing some singular directions from being too strong or too weak.
    6. update_dir = approximate_orthogonalize(momentum)
    7. matrix_w = matrix_w - lr * update_dir

    The “orthogonalization” here is usually not a strict mathematical full orthogonal decomposition. Instead, it uses iterative polynomials, Newton-Schulz-type iterations, or other approximate methods to make the update matrix close to orthogonal or semi-orthogonal at a low cost. The goal is not to pursue formal orthogonality, but to improve the condition number of the update direction, making the overall matrix update more balanced.

    Compared to element-wise schemes, the advantages of matrix-level schemes are mainly reflected in:

    • More Compact States: Typical schemes tend to reduce element-wise second-order states, compressing the state into a momentum or block-wise representation of the same size as the parameters. The exact savings depend on the implementation;
    • More Holistic Update Direction: Instead of letting each element fight its own battle, the entire matrix advances according to a unified geometric structure;
    • Potential Reduction in Training Steps: In small-scale experiments, matrix-level orthogonalization often shows higher effective progress per step;
    • Friendlier to Large Matrices: Hidden layer weight matrices usually have large dimensions, and matrix-level processing aligns better with their structural characteristics.

    However, it must be emphasized that these advantages are not unconditional. The matrix-level scheme saves state memory, which does not mean the per-step computation is cheaper. The orthogonalization iteration itself has computational overhead, and parallel sharding may introduce communication and numerical stability issues.

    3. Potential Advantages and Boundaries of Matrix-Level Orthogonal Updates

    1. Memory Efficiency: From “Two States Per Element” to “Matrix-Level Direction”

    Memory gains are the most direct motivation. If the traditional scheme requires maintaining first and second-order moments for each parameter, the matrix-level scheme at least has the opportunity to reduce element-wise second-order states or convert them into more compact matrix-level representations. For a trillion-parameter model, saving even one FP32 state could mean saving several TBs of memory. The freed memory can be used to:

    • Increase batch size;
    • Extend context length;
    • Reduce activation recomputation;
    • Lower communication caused by state sharding;
    • Improve device utilization.

    However, engineering must account for the “net gain”: Does orthogonalization computation increase per-step latency? Does it cause extra temporary tensors? Does it increase pipeline bubbles? Only when “memory savings + throughput improvement + reduction in convergence steps” net a positive result is it a true gain.

    2. Update Stability: Improving the Condition Number of Matrix Directions

    Element-wise adaptive methods scale each element independently, making them susceptible to local gradient noise. Matrix-level orthogonalization attempts to make the singular values of the update matrix more balanced, thereby preventing a few directions from dominating the update. For deep hidden layer matrices, this holistic constraint may bring more stable training dynamics.

    But stability does not mean “won’t diverge.” Orthogonalization iterations may produce numerical errors under low precision, especially when the matrix condition number is poor and the gradient scale varies significantly. Engineering implementations usually require:

    • Using FP32 or mixed-precision compensation for critical iterations;
    • Clipping outliers or applying norm constraints;
    • Monitoring matrix norms, singular value distribution, and approximate metrics before and after orthogonalization;
    • Retaining the ability to roll back to traditional optimizers.

    3. Scalability: New Requirements for Parallel Sharding

    Ultra-large model training typically uses data parallelism, tensor parallelism, pipeline parallelism, and state sharding. Matrix-level orthogonalization needs to treat the weight matrix as a whole, but in actual training, the matrix may be sharded across different devices. If strict global matrix orthogonalization is performed, it requires cross-device information aggregation; if block-wise approximation is used, some globality is lost.

    Therefore, matrix-level schemes usually need to answer the following engineering questions:

    • Does orthogonalization act on the full matrix, row blocks, column blocks, or local shards?
    • What is the impact of block-wise approximation on convergence?
    • Are extra all-gather or reduce-scatter operations required?
    • Can communication overlap with computation?
    • How to maintain checkpoint format compatibility?

    These questions determine whether a matrix-level scheme can move from single-machine, small-model experiments to multi-machine, large-scale training.

    4. From Racing Experiments to Industrial Deployment: Gradual Validation

    Matrix-level orthogonalization optimizers were mostly validated early on in small-scale models and racing-type experiments. The value of racing experiments lies in proving the “direction is feasible,” but industrial deployment cannot directly copy them. A reduction in steps on a small model does not necessarily equate to an end-to-end throughput increase on a large model; the numerical stability of a single-machine experiment does not necessarily cover multi-machine, long-cycle training.

    A gradual validation path is recommended:

    1. Small-scale Ablation: Compare traditional element-wise schemes with matrix-level schemes under the same model structure, data order, and parallelism strategy;
    2. Medium-scale Comparison: Gradually scale up parameters, batch size, and context length, observing convergence and memory curves;
    3. Gradual Replacement: First replace part of the hidden layers or specific training phases, keeping the traditional optimizer as a control group;
    4. Full Validation: Observe loss stability, downstream evaluation, fault recovery, and throughput in long-cycle training;
    5. Rollback Plan: Retain traditional optimizer checkpoint conversion and rollback paths.

    When evaluating, one should not only look at the speed of training loss decline, but also consider:

    Dimension Key Metrics Description
    Memory Peak memory, optimizer state memory, fragmentation rate Can net savings be converted to batch or context
    Throughput Step latency, tokens/s, device utilization Do orthogonalization computation and communication offset gains
    Convergence Training loss, validation loss, downstream metrics Is the step reduction real
    Stability Gradient norm, outlier ratio, performance after restart Is it reliable over long cycles
    Scalability Multi-machine efficiency, communication ratio, checkpoint size Is it suitable for large-scale clusters
    O&M Monitoring metrics, fault recovery, version compatibility Can it be gradually rolled out and rolled back

    On general cloud platforms such as Baidu AI Cloud, training tasks can leverage container platforms, object storage, logging services, and monitoring alerts for execution and observation. The focus is not on relying on a specific proprietary interface, but on establishing a reproducible experimental baseline, unified metric collection, and a rollbackable release process.

    5. Engineering Implementation Points and Examples

    The engineering implementation of matrix-level orthogonalization updates usually needs to focus on the following modules:

    1. 1. State Management: Clarify which matrix-level states to retain and how to serialize checkpoints.
    2. 2. Orthogonalization Iteration: Choose iteration counts, precision strategies, and outlier handling.
    3. 3. Parallel Sharding: Define the approximate relationship between local blocks and the global matrix.
    4. 4. Communication Scheduling: Overlap collective communication with orthogonalization computation and backpropagation.
    5. 5. Monitoring & Alerting: Record gradient norms, update norms, peak memory, and per-step latency.
    6. 6. Rollback Mechanism: Support conversion from matrix-level states back to traditional states or restoration from old checkpoints.

    A more complete training loop example is as follows:

    1. for step in range(max_steps):
    2. loss = forward_backward(model, batch)
    3. for name, w in model.hidden_matrices():
    4. g = w.grad
    5. state = optimizer_state[name]
    6. state.momentum = momentum_update(state.momentum, g)
    7. # Block-wise approximate orthogonalization to control temporary memory
    8. q = blockwise_orthogonalize(
    9. state.momentum,
    10. block_size=configured_block,
    11. iterations=configured_iters,
    12. compute_dtype="fp32_for_stable_path"
    13. )
    14. w.data = w.data - lr * q
    15. record_metrics(name, g_norm=g.norm(), q_norm=q.norm())

    This pseudocode emphasizes three engineering principles: First, orthogonalization does not need to process the global ultra-large matrix all at once; it can be block-wise to control temporary memory. Second, the stable path can use higher precision. Third, update norms and gradient norms must be recorded to facilitate the detection of numerical anomalies.

    6. Conclusion: Benefits Must Translate to Verifiable System Gains

    The value of matrix-level orthogonalization optimizers lies not in replacing a name, but in providing a technical path to reorganize optimizer states and update directions. For trillion-parameter models, the state memory of traditional element-wise adaptive optimizers indeed becomes a hard constraint on batch size, context length, and parallelization strategies. By treating the weight matrix as a whole, reducing element-wise states, and improving the condition number of the update direction, matrix-level schemes have the potential to reduce memory pressure and improve effective progress per step.

    However, such schemes are not a “free lunch.” Orthogonalization computation, block-wise approximation, parallel communication, low-precision numerical stability, and hyperparameter migration will all affect the final gains. Engineering teams should base their work on controlled experiments, adopt a unified evaluation framework covering memory, throughput, convergence, stability, and O&M costs, and proceed via small-scale ablation, medium-scale validation, gradual replacement, and rollbackable releases. Only when memory savings can be translated into larger batch sizes, longer contexts, or higher device utilization, and long-cycle training remains stable and controllable, will matrix-level orthogonalization updates truly cross over from an experimental concept to an industrial capability.