# Deep Learning Optimizers Explained: From Momentum to Orthogonalized Updates

    A practical guide to the evolution of deep learning optimizers — from vanilla gradient descent and momentum to adaptive methods and orthogonalized updates. Learn what problem each optimizer solves, how key algorithms work, and how to choose the right one for your training tasks.

    The Role of an Optimizer in Training

    Training a neural network is fundamentally about adjusting parameters repeatedly to reduce the value of a loss function. A helpful analogy is descending a mountain in thick fog: the loss function is like your current altitude, and the gradient computed by backpropagation tells you the slope in each direction beneath your feet. The gradient tells you which way is downhill, but not where to step next or how far to go.

    The optimizer is the decision-making rule. At each step, it reads the gradient and decides how to update the parameters. A mature optimizer typically needs to handle three classes of problems:

    1. Step size control: How large each update should be.
    2. Path quality: How to avoid oscillating back and forth in narrow valleys, and how to steer around local pits.
    3. Direction correction: How to use historical information to make updates more stable.

    This article walks through the evolution of mainstream methods along these three lines.

    Vanilla Gradient Descent and Its Limitations

    The idea of gradient descent dates back to the steepest descent method proposed by Augustin-Louis Cauchy in 1847. Its basic update rule is:

    $\theta_{t+1} = \theta_t - \eta \nabla L(\theta_t)$

    where $\theta$ is the parameter vector, $\eta$ is the learning rate, and $\nabla L$ is the gradient of the loss function. This rule depends only on the current gradient, with no memory of past steps.

    It has two main problems.

    First, a single step size fits poorly everywhere. A learning rate that is too large overshoots the valley floor, causing the loss to bounce back and forth on both sides — or even diverge. A learning rate that is too small makes training extremely slow. With one global learning rate, it is hard to handle both flat and steep regions at the same time.

    Second, inefficiency in narrow valleys. Imagine a loss surface where the curvature along two directions differs greatly. Along the steep direction, the gradient is large and every step overshoots the valley floor, slamming into the opposite wall. Along the flat direction, the gradient is small and progress along the valley floor is slow. The result is that the parameters keep ricocheting between the walls, while the component actually advancing toward the valley bottom is tiny.

    The following code shows vanilla gradient descent iterating on a one-dimensional function, useful for observing how the learning rate affects convergence:

    1. def gradient_descent(grad_fn, theta0, lr=0.1, steps=100):
    2. theta = theta0
    3. for _ in range(steps):
    4. theta = theta - lr * grad_fn(theta)
    5. return theta
    6. # Example: minimize f(x) = x^2, whose gradient is 2x
    7. result = gradient_descent(lambda x: 2 * x, theta0=5.0, lr=0.1)
    8. print(result) # Close to 0

    Set lr to 1.1 and rerun, and the parameter diverges. This shows there is a direct constraint between the learning rate and the curvature of the function.

    Adding Inertia: The Heavy Ball Method

    In 1964, Soviet mathematician Boris Polyak proposed the Heavy Ball Method while studying the convergence speed of optimization. The core idea: treat the parameters as a small ball with mass rolling on the loss surface, so it carries momentum.

    In formula form, the method introduces a velocity variable $v$:

    $v_{t+1} = \beta v_t - \eta \nabla L(\theta_t)$

    $\theta{t+1} = \theta_t + v{t+1}$

    where $\beta$ is the momentum coefficient, commonly set around 0.9. This mechanism produces two immediate effects.

    Effect 1: Acceleration along consistent directions. If gradients point in the same direction for several consecutive steps, velocity accumulates and each step covers more distance — faster progress in flat regions.

    Effect 2: Damped oscillation. On opposite sides of a valley, gradient signs alternate, so the opposing velocity components cancel each other out. The lateral wobble of the parameters shrinks, while the forward progress along the valley is preserved.

    This idea is usually called Momentum in engineering practice. Its implementation requires only one extra state variable compared with the vanilla version:

    1. def momentum_descent(grad_fn, theta0, lr=0.1, beta=0.9, steps=100):
    2. theta, v = theta0, 0.0
    3. for _ in range(steps):
    4. v = beta * v - lr * grad_fn(theta)
    5. theta = theta + v
    6. return theta

    The limitation of momentum is that all parameters still share a single learning rate, so the step size cannot be adjusted per parameter.

    The Idea of Adaptive Step Sizes

    In real training, gradient magnitudes can vary enormously across parameters. For example, embeddings of rare tokens receive gradients infrequently, while frequently used tokens are updated constantly. A single learning rate makes the former learn too slowly and the latter oscillate.

    Adaptive methods maintain a running statistic of historical gradients for each parameter: parameters with persistently large gradients get smaller steps, and parameters with small gradients get larger steps.

    Common approaches include:

    • AdaGrad-family methods: Accumulate the squares of historical gradients. Well suited to sparse gradients, but the accumulated term only grows, so the learning rate keeps shrinking.
    • RMSProp-family methods: Apply an exponential moving average to the squared gradients, solving the problem of premature learning rate decay.
    • Adam (Adaptive Moment Estimation): Maintains both the first moment of gradients (momentum) and the second moment (mean of squared gradients), with bias correction. It combines momentum with adaptive step sizes and is one of the most widely used general-purpose optimizers today.

    Learning rate scheduling (warmup, cosine decay, etc.) is another layer of control used alongside the optimizer: it changes the global step size across training phases and complements the per-parameter adaptivity described above.

    Orthogonalized Updates for Matrix Parameters

    All the methods above treat parameters as independent scalars. But a large share of neural network parameters are two-dimensional matrices, such as the weights of linear layers. For matrices, the “shape” of the update matters as much as its size.

    Take the update matrix accumulated by momentum: its singular value distribution is often highly uneven — a few directions carry large singular values while most carry small ones. This means the update concentrates in a small subspace, leaving most directions barely trained.

    A newer idea is to approximately orthogonalize the update matrix so its singular values are as close to 1 as possible. Every direction then receives an update of comparable magnitude, making more efficient use of the parameter space.

    A full singular value decomposition is computationally expensive, so in practice iterative polynomial approximations are used. The classic Newton–Schulz iteration is one example: for a normalized matrix $X$, repeatedly apply

    $X_{k+1} = \frac{3}{2} X_k - \frac{1}{2} X_k X_k^\top X_k$

    After several iterations, $X$ approaches its orthogonal factor — a matrix whose singular values are all close to 1. The following code is a simplified illustration:

    1. import numpy as np
    2. def approx_orthogonalize(M, steps=5):
    3. X = M / (np.linalg.norm(M) + 1e-7) # Normalize to ensure iterative convergence
    4. for _ in range(steps):
    5. X = 1.5 * X - 0.5 * X @ X.T @ X
    6. return X

    Applying this class of methods requires attention to several points:

    1. Scope of applicability: Orthogonalization relies on matrix structure and is typically applied only to 2D weight matrices. Biases and normalization-layer parameters should still be handled with a conventional optimizer.
    2. Hyperparameter recalibration: The scale of update magnitudes changes, so learning rates and weight decay must be retuned — existing configurations cannot be carried over directly.
    3. Benefits are scenario-dependent: Gains vary considerably across model sizes and tasks. Run controlled experiments on your own benchmark tasks rather than assuming the method outperforms existing ones.
    4. Computational cost: The extra iterations increase per-step compute, which must be weighed against any improvement in convergence speed.

    Practical Guidance for Choosing an Optimizer

    When choosing an optimizer, work through these questions:

    • Does the task already have a well-established recipe? If so, stick with its optimizer and learning rate settings first.
    • Is the model dominated by large matrix parameters? If so, consider trying orthogonalized update methods as a comparison.
    • Is training oscillating or diverging? If so, check the learning rate first, then consider adding momentum or adjusting the momentum coefficient.
    • Do gradients vary widely across parameters? If so, adaptive methods are usually the safer choice.

    The core job of an optimizer is to turn gradient information into stable, efficient parameter updates. Understanding the evolution from steepest descent to momentum, and onward to adaptive and orthogonalized methods, makes it easier to pinpoint which part of the pipeline to fix when tuning.