Optimizer Design for Training Very Large Models: From Memory Bottlenecks to Matrix Updates

    This article explains how optimizer choice affects the total cost of training large language models. It covers the memory footprint of element-wise adaptive optimizers, how matrix-level updates change both the optimizer state and the update direction, and why memory savings do not always lower peak memory. It also outlines the engineering issues that arise at scale, such as parameter sharding and low-precision computation, and a staged process for validating an optimizer before using it in production.

    1. Start by Breaking Down the Sources of Cost

    Evaluating a training approach for large models requires more than looking at parameter count, number of training steps, or the runtime of a single experiment. What determines return on investment is the total resource consumption needed to reach a target quality level, and whether that process can be reproduced reliably.

    The optimizer is an important variable in this calculation. It determines how gradients are used to update parameters, and it determines what historical information must be stored during training. For very large models, even a few bytes of extra state per parameter can add up to memory requirements on the order of several terabytes.

    A boundary needs to be clarified first. An optimization method performing well in an experiment does not prove that a particular model uses that method, and it certainly does not support conclusions about product advantages that have not been verified. The value of an optimizer should be judged against verifiable algorithm definitions, training configurations, and experimental results.

    From an engineering perspective, an optimization approach should answer at least four questions:

    • Does it reduce the training compute needed to reach the same model quality?
    • Does it lower peak memory usage on the same hardware?
    • Do the added matrix computations and communication cancel out the gains?
    • Do the advantages hold when model size, data distribution, and training stage change?

    Together, these questions form the basis of a technical assessment.

    2. Why Element-Wise Adaptive Optimizers Use a Lot of Memory

    Common adaptive optimizers maintain two types of historical statistics for each trainable parameter: the first moment and the second moment of the gradient. The first moment reflects the smoothed direction of the gradient. The second moment reflects the accumulated scale of squared gradients.

    Let (g_t) be the current gradient. The basic form of the moment updates is:

    [
    mt=\beta_1m{t-1}+(1-\beta_1)g_t
    ]

    [
    vt=\beta_2v{t-1}+(1-\beta_2)g_t^2
    ]

    The algorithm then uses the bias-corrected first and second moments to construct the update:

    [
    \Delta\theta_t=-\eta\frac{\hat m_t}{\sqrt{\hat v_t}+\epsilon}
    ]

    Here, (\eta) is the learning rate, and (\epsilon) is a small constant for numerical stability. Specific implementations may also include mechanisms such as decoupled weight decay.

    The advantage of this design is that different parameters receive different effective step sizes based on their own gradient histories. The cost is also clear: both states usually have the same number of elements as the parameters themselves.

    Suppose a model has (P) parameters that require optimizer state, and both states are stored at 4 bytes per element. The state memory is then approximately:

    [
    M_{\text{state}}=P\times(4+4)=8P\text{ bytes}
    ]

    For a model with one trillion parameters, these two states alone would take about 8 trillion bytes, or 8 terabytes in decimal units. This figure does not include the parameters, gradients, any high-precision master weights, intermediate activations, or communication buffers.

    Mixed-precision training does not automatically convert all states to lower precision. The actual memory depends on the state precision, parameter sharding, offloading strategy, and the optimizer implementation.

    In addition, insufficient memory may force a system to use more recomputation, smaller micro-batches, or more complex parallelism, which can increase cost. However, this does not mean training cost must grow exponentially. Any change in cost has to be analyzed against the specific configuration.

    3. What Matrix-Level Updates Change

    Element-wise adaptive methods scale updates mainly based on statistics for each coordinate. A different approach works directly on the update direction of two-dimensional weight matrices, aiming to use the overall structure across rows and columns.

    Let the weight of a linear layer be:

    [
    W\in\mathbb{R}^{m\times n}
    ]

    First, construct a momentum matrix from the gradient:

    [
    Bt=\mu B{t-1}+(1-\mu)G_t
    ]

    Rather than using (B_t) directly as the final update, the method applies an approximate orthogonalization, or a transformation related to the polar decomposition.

    To understand this operation, write the momentum matrix in singular value decomposition form:

    [
    B_t=U\Sigma V^\top
    ]

    The idealized update direction can then be written as:

    [
    Q_t=UV^\top
    ]

    The weight is then updated as:

    [
    W_{t+1}=W_t-\eta sQ_t
    ]

    Here, (s) is a scale factor that may be needed. Its value should be determined by the specific algorithm definition and the shape of the matrix.

    The key point is not that the matrix is added to the weights in one step. Traditional methods can also perform updates through batched tensor operations. The real difference is that the new approach changes the singular value structure of the update matrix, reducing the differences in scale across singular directions in the original update.

    Rectangular matrices also cannot be generally described as “orthogonal matrices” that satisfy unit conditions on both sides. Under the corresponding full-rank condition, the transformed result is usually column-orthogonal or row-orthogonal. If the matrix is rank-deficient, a more precise interpretation as a partial isometry is required.

    What is transformed here is the update direction, not the weight matrix itself. The weight matrix is not forced to remain orthogonal.

    4. Memory Savings Come From Fewer States, Not From Orthogonalization Itself

    The easiest point to confuse when understanding this type of method is the causal link between the algorithm’s operations and its memory benefit.

    Matrix orthogonalization does not reduce the number of parameters, and it does not compress the parameters automatically. The potential saving in state comes mainly from the fact that some matrix-based update schemes keep only one momentum matrix, instead of storing a second-moment value for each element of the same parameters.

    Under the comparison condition where both historical states use 4 bytes per element, moving from two states to one would theoretically reduce this part of the optimizer state memory by about half.

    However, this does not mean total training memory drops by half. Total memory also includes:

    [
    M{\text{total}}=
    M
    {\text{param}}+
    M{\text{grad}}+
    M
    {\text{state}}+
    M{\text{activation}}+
    M
    {\text{temporary}}+
    M_{\text{communication}}
    ]

    The matrix transformation itself may also create temporary tensors. If buffer reuse is not well controlled in the implementation, the state memory may fall while peak memory does not fall by the same amount.

    In practice, training often combines optimizers. Some two-dimensional weights use matrix-level updates, while other parameters continue to use element-wise methods. The final benefit therefore depends on the share of parameters that each optimizer handles and on the memory layout of each one.

    5. Why It May Improve Training Efficiency but Is Not Effective Everywhere

    Matrix gradients in neural networks may have uneven singular value spectra. If updates are persistently concentrated in a few directions, some directions may receive update scales much larger than others.

    A matrix orthogonalization update can be viewed as a way to reshape the spectrum. It keeps some directional structure while redistributing update magnitude across singular directions. Under suitable models and training settings, this may reduce the number of steps needed to reach a target loss.

    However, the method does not directly compute full curvature information, and it is not equivalent to exact second-order optimization. Differences in gradient magnitude sometimes carry useful information, and weakening them too much can also be harmful.

    Therefore, three metrics should be kept separate:

    1. Steps to convergence: the number of updates needed to reach a specified quality.
    2. Time per step: the computation and communication time required for each update.
    3. End-to-end time: the total time, including training, validation, checkpointing, and failure recovery.

    Even if the number of steps decreases, total time may still increase if the matrix transformation significantly lengthens each step. Conversely, if each step is slightly slower but far fewer steps are needed, overall training may be more economical. Both must be measured. The algorithm’s form alone is not enough to decide.

    6. Challenges in Moving From Small Experiments to Large-Scale Training

    1. Matrix decomposition cannot be implemented directly from the math

    Singular value decomposition is useful for explaining the principle, but it is not necessarily suitable for applying to large numbers of weights at every training step.

    In practice, implementations usually use a finite number of matrix iterations to approximate the required polar factor. More iterations generally mean higher computational cost. Too few iterations may leave a large approximation error.

    The real tradeoff is not a single metric. It is a combination of optimization effectiveness, matrix operation throughput, and numerical stability.

    2. Parameter sharding changes what part of the matrix each device can see

    Large-scale training usually distributes parameters across multiple computing devices. If a single device holds only part of a matrix, it cannot perform the full matrix transformation without additional processing.

    One approach is to gather the full matrix first, then compute and distribute the update. This can be costly in communication and temporary memory. Another approach is to update local blocks. This is easier to execute, but it is usually not equivalent to a transformation on the full matrix.

    For this reason, the sharding layout is more than an implementation detail. It can affect the algorithm itself. Any evaluation must state whether the method processes the full matrix or local blocks.

    3. Different parameters need different update rules

    Biases, normalization scale parameters, embedding matrices, and ordinary hidden-layer weights have different structures and training characteristics.

    A parameter being two-dimensional does not by itself mean it is suitable for matrix orthogonalization updates. Embedding parameters in particular may have update frequencies and data access patterns that differ clearly from those of ordinary linear layers.

    A safer practice is to define parameter groups explicitly. Each group can then have its own learning rate, decay rule, and update method. Check for missing groups and parameters updated more than once.

    4. Low-precision computation requires extra monitoring

    Matrix iterations can be affected by input scale, rounding error, and outliers. In engineering practice, input normalization, the accumulation precision of critical computations, and the handling of abnormal updates all need attention.

    Lower precision can reduce computation and storage costs, but it should be used only when training remains stable. Lowering the precision of every intermediate value without distinction is not a sound approach.

    7. An Executable Validation Process

    Step 1: Establish a reproducible baseline

    Fix the model architecture, training data, effective batch size, training budget, and evaluation method. First confirm that the original training process is stable, and record the total time and each type of memory overhead.

    If the optimizer, data mix, and parallelism strategy are all changed at once, it becomes difficult to tell where any improvement comes from.

    Step 2: Run controlled small-scale experiments

    Choose a representative model, and separately validate parameter grouping, learning rate ranges, matrix scale calibration, and approximate iteration settings.

    Compare validation loss at the same data volume, and also compare actual runtime needed to reach a similar quality level. Faster decrease in training loss does not necessarily mean better generalization.

    Step 3: Analyze resource bottlenecks

    Record at least the following metrics:

    • Optimizer state memory and total peak memory;
    • The share of time spent in the forward, backward, and update phases;
    • Temporary memory introduced by matrix transformations;
    • Communication time and device waiting time;
    • Gradient norm, update norm, and the number of abnormal numerical events;
    • Cumulative resource consumption needed to reach the target validation quality.

    These data help identify whether the main bottleneck is state storage, activation memory, matrix computation, or cross-device communication.

    Step 4: Scale up step by step

    Small-model experiments are mainly useful for narrowing down the direction. As matrix sizes, device counts, and communication topology change, the ranking of performance may also change. Medium-scale and target-scale validation are still necessary.

    For sparsely activated models, count separately the total parameters, the parameters activated per forward pass, and the parameters that actually maintain optimizer state. Do not treat these three as interchangeable.

    Step 5: Verify recovery and long-term stability

    Checkpoints should save the parameters, optimizer states, and scheduler states needed to resume training. Also verify whether the training trajectory shows abnormal behavior after an interruption and recovery.

    A method may converge quickly early on, but if it becomes unstable later, is hard to recover, or is complex to operate, it may not be suitable for production training.

    8. Conclusion: Judge Optimizer Benefits by Total Cost at a Target Quality

    Matrix-level updates offer a technical path for large-model training that differs from element-wise adaptive scaling. Their potential value lies in two areas: reducing the historical state needed for some parameters, and improving the optimization process by adjusting the spectral structure of the update matrix.

    They do not outperform traditional methods unconditionally. Parameter type, matrix shape, approximation error, distributed layout, and training stage all affect the final result.

    For developers and organizations, a more reasonable selection standard is this: at comparable quality, with stable and reproducible training, which approach lowers total resource consumption while keeping engineering complexity at an acceptable level.

    The significance of optimizer innovation is not in replacing one algorithm name with another. It is in turning mathematical update rules into training gains that can be verified, scaled, and sustained.