Introduction
This post contains summarization and notes from the following papers:
Adam: A Method for Stochastic Optimization (link)
An overview of gradient descent optimization algorithms (link)
Gradient descent is a core algorithm to perform optimization in Machine Learning. It is a method to minimize an objective function f(θ) (usually f(θ) ∈ R) by updating the parameters in the opposite direction of its gradient. There are a few different gradient descent optimization algorithms such as stochastic gradient descent (SGD), SGD with momentum, RMSProp and Adam. As of 2025, Adam is generally considered the default choice in ML.
Gradient Descent
The vanilla gradient descent is optimized w.r.t entire training dataset:
where γ is the learning rate. However, optimizing over the entire dataset at once is impractical for large datasets. In practice, we don’t use entire dataset but mini-batch of the dataset in one step, so we have:
The above variation of the gradient descent is called mini-batch gradient descent, where we pick the mini-batch size n depending on the application and hardware constraints. The variation is called stochastic gradient descent (SGD) when n equals 1. In practice, the terms stochastic gradient descent and mini-batch gradient descent are often used interchangeably.
Algorithms
SGD with Momentum
Stochastic gradient descent can get stuck at local minima or spend too much time following local noisy gradients. The stochastic gradient descent with momentum (SGD with momentum) helps to escape the local noisy gradients by smoothing the gradients over time:
We update the parameters with the exponentially decaying average of past gradients, which helps avoid small, noisy gradients and focus on overall trends.
RMSProp
Root Mean Square Propagation (RMSProp) is an algorithm that dynamically adopts the learning rate for every parameter θ[i], unlike SGD where we use the same learning rate γ for all parameters. This helps to prevent oscillations, as gradient descent might otherwise make a big move in one direction and a small move in another.
We keep track of the exponentially decaying average of past squared gradients (or uncentered variance), then use this tracked squared gradient to normalize the current gradient.
Adam
Adam is essentially a combination of SGD with momentum and RMSProp. Adam also improves the both method by introducing initialization bias correction. Adam without a bias correction:
Since m[0] and v[0] are initialized with zero, m[t] and v[t] are biased towards zero, especially during the initial steps. The paper explains this by inspecting the expectation value of v[t]. But, first we need to unroll v[t]:
Then, we have:
It is not pretty clear from the paper, but we’re assuming that:
In that case ζ is close to zero, which clearly shows the bias (1-beta2^t) that we need to divide v[t] by. We can assume ζ is close to zero, as this bias correction is mostly required in the initial steps since (1-beta2^t) approaches 1 for large t values.
Finally, Adam with bias correction is:
The End
I hope you enjoyed this post.