Optimizer Innovation: How Can Matrix-Level Optimizers Break the Memory Bottleneck in Large Models?

    This article explains why optimizer states consume much of the memory in trillion-parameter training, how matrix-level structured optimizers differ from element-wise adaptive optimizers, and what engineering work is needed to run them at scale. Topics include efficient orthogonalization, the order of momentum and orthogonalization, compatibility with distributed parallelism, mixed-precision state storage, hyperparameter redesign, and hybrid optimizers that combine both approaches.

    1. The Memory Dilemma: Optimizer States Are Consuming the Model’s Budget

    In large-scale language model training, memory is mainly consumed by model parameters, gradients, optimizer states, and intermediate activations. When a model reaches the trillion-parameter scale, optimizer states often take up far more memory than the parameters themselves. Take the Adam optimizer, which is widely used in industry. It keeps a first-order momentum (an exponential moving average of gradients) and a second-order momentum (an exponential moving average of squared gradients) for every parameter. In mixed-precision training, parameters and gradients can be stored in half precision, but optimizer states usually stay in full precision to maintain numerical stability. For a model with 1.6 trillion parameters, the optimizer states alone can take more than 12 TB of memory. This figure does not include gradients, activations, or communication buffers.

    The logic of a traditional optimizer can be roughly written as follows:

    1. # Initialization
    2. m_0 = 0, v_0 = 0
    3. # Each training step
    4. m_t = β1 * m_{t-1} + (1 - β1) * g_t
    5. v_t = β2 * v_{t-1} + (1 - β2) * g_t^2
    6. θ_t = θ_{t-1} - lr * m_t / (sqrt(v_t) + ε)

    Both m and v need storage equal in size to the parameters. For this reason, optimizer states are one of the three main factors that strain the memory budget, alongside parameters and gradients. When optimizer states occupy much of the memory, engineers often have to reduce the batch size, shorten the context length, or limit the flexibility of their parallelism strategy. These trade-offs can drive training costs up sharply.

    2. The Core Difference: Element-Wise Refinement vs. Matrix-Level Structure

    The core task of an optimizer is to construct an effective update direction in the parameter space. Traditional adaptive optimizers work element by element. They split a weight matrix into individual scalars and accumulate gradient statistics for each one separately. This lets them adapt to different gradient scales across parameters. However, the storage needed for states grows strictly in proportion to the parameter count. Each element also updates independently, so the optimizer cannot account for the high-dimensional geometry of the matrix as a whole.

    Matrix-level structured optimizers take a different approach. They treat the entire weight matrix as one indivisible high-dimensional object, rather than a collection of separate scalars. During each update, they combine the gradient and the accumulated momentum into a single matrix. They then project this matrix toward an orthogonal matrix, using methods such as orthogonalization or polar decomposition. This update direction keeps the main information in the gradient and suppresses noise and ill-conditioned directions. Each step therefore moves more like a coordinated formation than a set of independent moves.

    An analogy helps here. An element-wise optimizer is like computing the downhill path for each iron ball separately. The approach is precise but fragmented. A matrix-level optimizer arranges the balls into a square formation and moves them forward together at one pace. For training efficiency, the matrix-level approach gives each update more useful directional information, so convergence usually takes fewer steps.

    3. From a Speed Challenge to Industrial Validation

    The idea of whole-matrix updates did not appear from nowhere. In an early community challenge on training efficiency, participants had to train a small language model to a target loss using as little compute and time as possible. Most participants kept tuning traditional adaptive optimizers to squeeze out the last bit of performance. One independent researcher, however, introduced a matrix-level orthogonalized update in their implementation for the first time. The number of training steps dropped sharply, and the result broke the record at that time.

    The “square formation” approach soon faced doubts, though. Real gradient distributions do not always follow a regular structure. Would orthogonalization that works on small models still work on large ones? The initial validation only covered models with about 100 million parameters. Industrial-scale models differ widely in depth, width, and the way they are split across parallel devices.

    Later research and engineering work addressed these questions. Researchers found that matrix-level optimizers do not work equally well for every layer. They perform well on parameters with clear matrix structure, such as attention projection matrices and feed-forward network matrices. They are less suitable for non-matrix parameters, such as biases, normalization parameters, and scalar embeddings. Matrix-level optimizers also need to be tuned together with distributed parallelism, mixed precision, gradient accumulation, and other engineering techniques. In other words, moving from the lab to production requires a set of engineering steps.

    4. Engineering for Production: Taking the “Square Formation” Out of the Lab

    To run reliably at large scale, a matrix-level structured optimizer must solve several key engineering problems.

    1. Efficient orthogonalization algorithms

    Running a full singular value decomposition on very large matrices is impractical because the computation cost is too high. In practice, approximate methods such as the Newton–Schulz iteration are common. These methods approach an orthogonal matrix in a few iterations. They avoid building a full spectral decomposition and still balance accuracy against compute. Engineers need to adjust the number of iterations and the tolerance based on matrix dimensions, gradient noise levels, and hardware characteristics.

    2. Ordering of momentum and orthogonalization

    Matrix-level optimizers usually keep momentum accumulation instead of dropping it. They first smooth the gradient with first-order momentum, then apply the orthogonal projection to the resulting momentum matrix. The fusion order strongly affects convergence stability. If orthogonalization runs directly on the raw gradient, gradient noise may be amplified. If momentum accumulation runs first, high-frequency oscillations are effectively suppressed. Different modules, such as embedding layers, attention layers, and output layers, may need different hyperparameter combinations, so careful experimental tuning is required.

    3. Compatibility with distributed parallelism

    In very large training runs, weight matrices are often split across multiple accelerators. The global orthogonalization logic of a matrix-level optimizer conflicts with this sharding by nature. One workable option is local orthogonalization under column-parallel or row-parallel layouts. Each shard is updated in a structured way, which sacrifices some global consistency to save communication. Another option is to use all-gather communication, but this adds significant synchronization overhead. A sound approach is to choose a compromise based on matrix shape and parallelism mode, or to develop custom communication primitives that support local orthogonalization.

    4. Mixed precision and state storage

    Matrix-level optimizers avoid the second-order momentum, but the first-order momentum still takes the same space as the parameters. Storing the momentum matrix in BF16 can further reduce memory use, but it introduces numerical precision issues. In practice, teams can keep master weights and momentum stored separately, or use error feedback compensation, to balance precision and memory.

    5. Redesigning the hyperparameter system

    Traditional adaptive optimizers have mature experience with learning rates, momentum coefficients, and scheduling. Matrix-level optimizers add new dimensions, including orthogonalization strength, momentum decay, and the number of iterations. They are also more sensitive to initialization and data order. Engineers therefore need new hyperparameter search workflows, and they may use automated tuning tools to explore the best configurations.

    5. Hybrid Optimization: A More Practical Path to Industrial Use

    Matrix-level optimizers are not a universal solution. For vector parameters, biases, and normalization factors, element-wise updates are still more stable. A natural choice is therefore a hybrid optimizer. It applies structured orthogonal updates to matrix parameters and keeps element-wise adaptive updates for vector and scalar parameters. This approach can substantially reduce total memory use without introducing unnecessary bias into non-matrix parameters.

    In real training systems, layer grouping, gradient accumulation, and activation recomputation can further reduce peak memory. Savings in optimizer states can be converted into a larger batch size, a longer context window, or more aggressive parallelism. These gains do not simply add up. Together, they can improve model capacity, data throughput, and training stability.

    6. Conclusion and Outlook

    Optimizer state memory is one of the core bottlenecks in very large model training. Matrix-level structured optimizers treat weight matrices as whole objects. They replace element-wise adaptive adjustment with orthogonalized update directions. This approach cuts state storage needs and adds stronger geometric constraints to training, which can reduce the number of steps while maintaining generalization. Challenges remain in efficient orthogonalization, distributed coordination, and hyperparameter adaptation. Still, the path toward industrial use is becoming clear.

    In large-scale training practice at Baidu AI Cloud, optimizer state management and memory tuning have long been central to system architecture design. Whether teams use traditional adaptive optimizers or emerging matrix-level structured optimizers, the goal stays the same: make every accelerator and every watt of power count. As model sizes keep growing, optimizer design will be less a purely algorithmic question and more a systems problem. Understanding the memory and convergence behavior of different optimizers, and making sound engineering trade-offs, is a required skill for every large model engineer.