The Adam optimizer is an adaptive learning rate algorithm that computes individual step sizes for each model parameter. It combines the advantages of two other extensions of stochastic gradient descent: AdaGrad, which works well with sparse gradients, and RMSProp, which excels in non-stationary online settings. Adam maintains exponentially decaying averages of past gradients (the first moment, m) and past squared gradients (the second moment, v), which it uses to adaptively scale the learning rate.
Glossary
Adam Optimizer

What is Adam Optimizer?
Adam (Adaptive Moment Estimation) is a first-order gradient-based optimization algorithm for stochastic objective functions, widely used for training deep neural networks.
The algorithm's key steps involve calculating bias-corrected moment estimates to account for initialization at zero, then updating parameters. This makes it robust to noisy gradients and sparse data, leading to faster convergence in many practical deep learning scenarios. Adam is a default choice for training a wide variety of models, including the vision-language-action models used in real-time robotic perception, due to its computational efficiency and minimal memory requirements.
Key Features of Adam
Adam (Adaptive Moment Estimation) is a first-order gradient-based optimization algorithm designed for training deep neural networks. Its core innovation is computing adaptive learning rates for each parameter by using estimates of the first and second moments of the gradients.
Adaptive Per-Parameter Learning Rates
Unlike SGD with a single, global learning rate, Adam maintains a separate learning rate for every single parameter in the model. This rate is adapted based on the historical gradient information for that specific parameter. This allows the algorithm to:
- Accelerate progress in directions with small, consistent gradients.
- Dampen updates for parameters with large, noisy gradients, preventing overshooting.
- Handle sparse gradients effectively, which is common in natural language processing and recommendation systems.
Bias-Corrected Moment Estimates
Adam uses exponential moving averages of the gradient (first moment, m) and the squared gradient (second moment, v). These estimates are initialized at zero, causing a bias towards zero, especially during the initial timesteps. Adam applies bias correction to these estimates:
m_hat = m / (1 - β1^t)v_hat = v / (1 - β2^t)Wheretis the timestep. This correction ensures the estimates are unbiased, leading to more accurate and stable updates early in training, which is critical for convergence.
Momentum and RMSProp Combination
Adam synthesizes the advantages of two preceding algorithms:
- Momentum (from SGD with Momentum): It uses the first moment estimate (
m) to accelerate convergence in relevant directions and dampen oscillations, akin to a ball rolling downhill with inertia. - Adaptive Learning Rates (from RMSProp): It uses the second moment estimate (
v) to scale the learning rate based on the magnitude of recent gradients, normalizing the update step size. This hybrid approach makes it robust across a wide range of architectures and datasets without extensive hyperparameter tuning.
Default Hyperparameter Robustness
The authors of the original Adam paper proposed default hyperparameter values that are famously effective for many problems:
- Learning rate (α):
0.001 - Beta1 (β1):
0.9(decay rate for first moment) - Beta2 (β2):
0.999(decay rate for second moment) - Epsilon (ε):
1e-8(small constant for numerical stability) While tuning can yield improvements, these defaults provide a strong, reliable starting point, reducing the need for extensive hyperparameter search compared to vanilla SGD or RMSProp alone.
Efficiency and Low Memory Footprint
Despite its adaptive nature, Adam is computationally efficient. For a model with n parameters, it requires only O(n) additional memory to store the two moment vectors (m and v). This is the same asymptotic complexity as SGD with momentum. Its update rule is straightforward to implement and parallelize, making it suitable for large-scale training on modern hardware (GPUs/TPUs). The cost per parameter update is only slightly higher than SGD but often leads to faster convergence, reducing total training time.
Limitations and Common Variants
While highly successful, Adam has known limitations that have spurred the development of variants:
- Generalization Gap: Models trained with Adam can sometimes generalize worse than those trained with SGD, particularly for vision tasks. This is an area of active research.
- Weight Decay Implementation: Naïve L2 regularization with Adam is not equivalent to SGD weight decay. AdamW decouples weight decay from the adaptive learning rate, fixing this issue and often improving performance.
- Convergence Proofs: Original convergence proofs required certain assumptions. Variants like AMSGrad modify the update rule to guarantee non-increasing step sizes, addressing a theoretical flaw.
Adam vs. Other Optimizers
A feature and performance comparison of the Adam optimizer against other prominent gradient-based optimization algorithms, highlighting key trade-offs for real-time and embedded machine learning applications.
| Feature / Metric | Adam (Adaptive Moment Estimation) | Stochastic Gradient Descent (SGD) | RMSprop | AdaGrad |
|---|---|---|---|---|
Core Adaptation Mechanism | Per-parameter adaptive learning rates using estimates of first (mean) and second (uncentered variance) moments of gradients | Global learning rate, optionally with momentum | Per-parameter adaptive learning rates using a moving average of squared gradients | Per-parameter learning rates scaled by the square root of the sum of all historical squared gradients |
Momentum Integration | ||||
Bias Correction | ||||
Default Hyperparameters | β₁=0.9, β₂=0.999, ε=1e-8 | Learning rate (η), momentum (γ) optional | Decay rate (ρ)=0.9, ε=1e-8 | Learning rate (η), ε=1e-8 |
Typical Convergence Speed on Deep Nets | Fast initial progress | Slower, requires careful tuning | Fast on non-stationary objectives | Rapid early progress, plateaus later |
Handling of Sparse Gradients | Good | Poor without momentum | Excellent | Excellent initially, degrades over time |
Learning Rate Decay Over Time | Automatic, per-parameter | Requires manual scheduling | Automatic, per-parameter | Aggressive automatic decay (can vanish) |
Memory Footprint (per parameter) | ~3x (stores m, v, params) | ~1x (params) or ~2x (with momentum) | ~2x (stores cache, params) | ~2x (stores cache, params) |
Suitability for Non-Stationary Objectives | Good | Poor | Very Good | Poor |
Robustness to Noisy Gradients | Good | Moderate (with momentum) | Good | Poor in later stages |
Common Use Cases | Default for most deep learning (CV, NLP) | Fine-tuning, with scheduled LR for top accuracy | Recurrent Neural Networks (RNNs) | Sparse data problems (e.g., natural language processing) |
Adam Optimizer
Adam (Adaptive Moment Estimation) is a stochastic gradient descent optimization algorithm that computes adaptive learning rates for each parameter by using estimates of the first and second moments of the gradients.
Core Mechanism: Adaptive Learning Rates
Unlike standard SGD with a single global learning rate, Adam maintains per-parameter learning rates. It does this by calculating two moving averages:
- First moment (mean): An exponentially decaying average of past gradients.
- Second moment (uncentered variance): An exponentially decaying average of past squared gradients. These moments adapt the step size for each weight, allowing larger updates for infrequent parameters and smaller, more precise updates for frequent ones.
The Update Rule
The algorithm updates parameters using the following steps for each timestep t:
- Compute gradient
g_tof the objective function. - Update biased first moment estimate:
m_t = β1 * m_{t-1} + (1 - β1) * g_t. - Update biased second moment estimate:
v_t = β2 * v_{t-1} + (1 - β2) * g_t². - Compute bias-corrected estimates:
m̂_t = m_t / (1 - β1^t),v̂_t = v_t / (1 - β2^t). - Apply the parameter update:
θ_t = θ_{t-1} - α * m̂_t / (√(v̂_t) + ε). Whereαis the learning rate,β1andβ2are decay rates, andεis a small constant for numerical stability.
Hyperparameters & Default Values
Adam's behavior is controlled by a few key hyperparameters with well-established defaults:
- Learning Rate (α): Often set between 0.001 and 0.0001. The default in frameworks like PyTorch and TensorFlow is 0.001.
- β1 (First moment decay): Controls the decay rate for the gradient mean. Default is 0.9.
- β2 (Second moment decay): Controls the decay rate for the gradient variance. Default is 0.999.
- ε (Epsilon): A small constant to prevent division by zero. Default is 1e-8. These defaults are robust across many problems, making Adam relatively easy to use out-of-the-box.
Advantages Over Other Optimizers
Adam combines benefits from two other popular methods:
- Momentum-like behavior from RMSprop and AdaGrad, which helps accelerate convergence in relevant directions.
- Adaptive learning rates from AdaDelta, which makes it suitable for problems with sparse or noisy gradients. Key advantages include:
- Fast convergence early in training.
- Minimal tuning of hyperparameters beyond the learning rate.
- Efficiency in both computation and memory (requires only first-order gradients).
- Suitability for non-stationary objectives and problems with very noisy/or sparse gradients.
Common Use Cases & Frameworks
Adam is the default or highly recommended optimizer for a wide range of deep learning tasks:
- Training large language models (LLMs) and convolutional neural networks (CNNs).
- Computer vision tasks like image classification and object detection.
- Natural language processing models including transformers. It is natively implemented in all major deep learning frameworks:
- PyTorch:
torch.optim.Adam - TensorFlow/Keras:
tf.keras.optimizers.Adamortf.optimizers.Adam - JAX:
optax.adamIts widespread adoption is due to its consistent performance across diverse architectures.
Limitations and Variants
Despite its popularity, Adam has known limitations, leading to specialized variants:
- Generalization Gap: Models trained with Adam can sometimes generalize worse than those trained with SGD, especially for vision tasks. This is addressed by AdamW, which decouples weight decay from the gradient-based update.
- Convergence Issues: On some theoretical convex problems, Adam may not converge to the optimal solution. AMSGrad was proposed to fix this by using the maximum of past second moments to ensure a non-increasing step size.
- Memory Footprint: While efficient, it still requires storing two momentum vectors per parameter, doubling the memory of SGD. Adafactor is a variant designed for extreme memory efficiency. Understanding these trade-offs is crucial for selecting the right optimizer for production systems.
Frequently Asked Questions
Adam (Adaptive Moment Estimation) is a cornerstone algorithm for training deep neural networks. These FAQs address its core mechanics, practical use, and role in modern AI systems like real-time robotics.
The Adam optimizer is a first-order, stochastic gradient-based optimization algorithm that computes adaptive learning rates for each parameter by using estimates of the first moment (the mean) and second moment (the uncentered variance) of the gradients. It works by maintaining two moving averages per parameter: m_t (the biased first moment estimate, akin to momentum) and v_t (the biased second raw moment estimate). On each iteration, it calculates these estimates, corrects their bias towards zero, and updates parameters using a step size scaled by the square root of the corrected second moment. This process makes it well-suited for problems with noisy or sparse gradients and large parameter spaces.
Key update steps:
- Compute gradient
g_tat timestept. - Update biased first moment estimate:
m_t = β1 * m_{t-1} + (1 - β1) * g_t - Update biased second moment estimate:
v_t = β2 * v_{t-1} + (1 - β2) * g_t^2 - Compute bias-corrected estimates:
m̂_t = m_t / (1 - β1^t),v̂_t = v_t / (1 - β2^t) - Update parameters:
θ_t = θ_{t-1} - α * m̂_t / (√(v̂_t) + ε)Whereαis the learning rate,β1andβ2are decay rates, andεis a small constant for numerical stability.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Adam is a cornerstone of modern deep learning optimization. To understand its role and alternatives, explore these related algorithms and concepts.
Stochastic Gradient Descent (SGD)
The foundational optimization algorithm upon which Adam builds. SGD updates model parameters by taking a step in the direction opposite to the gradient of the loss function, computed on a small, random subset (mini-batch) of the training data.
- Core Mechanism: θ = θ - η * ∇J(θ; x, y)
- Limitations: Uses a single, global learning rate (η) for all parameters, which can be inefficient for sparse data or parameters with different scales.
- Momentum: A common extension adds a velocity term to dampen oscillations and accelerate convergence in relevant directions. Adam's innovation was to automate the tuning of per-parameter learning rates, addressing SGD's key limitation.
RMSProp
A key precursor to Adam, RMSProp (Root Mean Square Propagation) adapts the learning rate for each parameter based on a moving average of the magnitudes of recent gradients.
- Mechanism: Maintains a decaying average of squared gradients (E[g²]). The learning rate for each parameter is divided by the root of this average.
- Effect: Performs well on non-stationary objectives and is particularly effective for recurrent neural networks.
- Adam's Inheritance: Adam incorporates RMSProp's concept of a moving average of squared gradients (the second moment estimate) but combines it with a moving average of the gradients themselves (the first moment), leading to the 'moment estimation' in its name.
Adaptive Moment Estimation (The Adam Algorithm)
This card details the core computational steps of the Adam optimizer itself.
- Compute Gradients: Calculate the gradient g_t of the stochastic objective function with respect to parameters θ at timestep t.
- Update Biased First Moment Estimate (m_t): m_t = β₁ * m_{t-1} + (1 - β₁) * g_t. This is an exponential moving average of the gradient (the mean).
- Update Biased Second Moment Estimate (v_t): v_t = β₂ * v_{t-1} + (1 - β₂) * g_t². This is an exponential moving average of the squared gradient (the uncentered variance).
- Bias Correction: Compute bias-corrected estimates: m̂_t = m_t / (1 - β₁ᵗ), v̂_t = v_t / (1 - β₂ᵗ). This counteracts initialization bias toward zero.
- Parameter Update: θ_t = θ_{t-1} - α * m̂_t / (√v̂_t + ε). The learning rate α is scaled for each parameter by the ratio of its mean to its standard deviation.
Learning Rate Schedulers
While Adam adapts per-parameter learning rates, the global step size (α) can also be adjusted over time using a learning rate scheduler. These are often used in conjunction with Adam.
- Step Decay: Reduces α by a fixed factor after a set number of epochs.
- Cosine Annealing: Decreases α following a cosine curve from an initial value to zero (or a minimum), often with restarts.
- One-Cycle Policy: A specific schedule that increases the learning rate for a short period before decreasing it, often leading to faster convergence and better generalization.
- Warmup: A short initial phase where α is linearly increased from a small value, stabilizing training in the early steps, which is crucial for large models like Transformers.
AdamW Optimizer
A refined variant of Adam that corrects its handling of weight decay. In standard Adam, adding L2 regularization (weight decay) is not equivalent to true weight decay due to the adaptive learning rates.
- Problem: In Adam, L2 regularization is scaled by the adaptive learning rate, weakening its effect for parameters with large historical gradients.
- AdamW Solution: Decouples weight decay from the gradient-based update. Weight decay is applied directly to the weights before the adaptive update step.
- Result: Leads to better generalization performance and is now considered a best practice for training deep neural networks, especially vision models and Transformers.
Gradient Clipping
A technique frequently used with Adam (and other optimizers) to stabilize training, particularly in recurrent neural networks and Transformers.
- Purpose: Prevents exploding gradients, where gradients become excessively large and cause numerical instability and catastrophic updates.
- Mechanism: Scales down the entire gradient vector if its norm (e.g., L2 norm) exceeds a predefined threshold.
- Common Use with Adam: Clipping is applied to the raw gradients (g_t) before they are used to update the moment estimates. This ensures the moving averages in Adam remain bounded and stable.
- Threshold: A typical value is a gradient norm clip of 1.0 or 5.0.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us