Backpropagation has served as the workhorse of deep learning for over three decades. It is elegant, efficient, and remarkably effective—until it isn't. As architectures push past hundreds of layers, incorporate non-differentiable operations, or face pathological loss landscapes, the gradient signal becomes either vanishingly weak or computationally prohibitive. Practitioners working with large transformers, graph neural networks, or physics-informed models increasingly encounter these barriers. This guide is for engineers and researchers who have hit the wall with backprop and need practical alternatives—evolutionary strategies, second-order methods, and learned optimizers—that can handle sparse rewards, discrete components, and massive parameter counts. We will walk through the core mechanics of each approach, compare their trade-offs, and provide actionable workflows for integrating them into your next project.
Why Backpropagation Falls Short for Modern Architectures
Backpropagation relies on the chain rule to compute gradients through every differentiable operation in a computational graph. This works beautifully for convex-ish landscapes and moderate depths. But deep architectures introduce several well-known failure modes. The vanishing gradient problem, where gradients become exponentially smaller as they propagate backward, effectively stops learning in early layers. Despite innovations like residual connections and batch normalization, very deep networks still struggle with gradient flow in certain regimes—especially with saturating activations or long sequences.
Saddle points are another adversary. High-dimensional loss landscapes are dominated by saddle points where the gradient is near zero but curvature is negative in some directions. Backpropagation can stall at these points for extended periods, especially with standard stochastic gradient descent. Second-order methods that use curvature information can escape more efficiently, but they are rarely used due to computational cost.
Memory constraints also bite hard. Backpropagation requires storing intermediate activations for every layer during the forward pass to compute gradients during the backward pass. For models with hundreds of layers or very large batch sizes, this memory footprint becomes prohibitive. Techniques like gradient checkpointing reduce memory at the cost of recomputation, but they don't eliminate the fundamental bottleneck.
Finally, backpropagation requires the entire model to be differentiable. Many modern architectures incorporate discrete operations—hard attention, sorting, sampling, or conditional computation—that break the gradient flow. Surrogate gradients or straight-through estimators can work around this, but they introduce bias and instability. For these reasons, a growing number of teams are exploring optimization methods that do not rely on gradients at all, or that augment gradients with additional information.
The catch is that abandoning backpropagation is not free. Gradient-free methods often require many more function evaluations, scale poorly with parameter count, and lack the theoretical convergence guarantees of gradient descent. The key is to match the optimizer to the architecture and problem constraints—not to assume one-size-fits-all.
Prerequisites: What You Need Before Ditching Backprop
Before you swap out backpropagation, you need a clear understanding of your architecture's constraints and your optimization goals. This section covers the essential prerequisites and context you should settle first.
Understanding Your Loss Landscape
Start by profiling the loss landscape of your model. Is it smooth, or does it contain plateaus, cliffs, and narrow valleys? Gradient-based methods thrive on smooth landscapes with consistent curvature. If your loss function is piecewise constant, highly oscillatory, or has many discontinuities, gradient information may be misleading. In such cases, evolutionary strategies that rely on population-based sampling can be more robust. Tools like loss landscape visualization (filter-wise normalization and random projections) can give you a quick sense of the terrain.
Computational Budget and Parallelism
Many alternatives to backpropagation are embarrassingly parallel. Evolutionary strategies, for example, evaluate many candidate solutions independently, making them ideal for distributed computing environments with many workers. If you have access to a cluster or a large number of GPUs, gradient-free methods become more feasible. Conversely, if your budget is tight and you need per-sample efficiency, second-order methods that reuse gradient information may be a better fit.
Parameter Count and Model Architecture
The number of parameters directly impacts the viability of different optimizers. Second-order methods that compute or approximate the Hessian scale quadratically with parameter count—impractical for models with millions of parameters unless you use low-rank approximations. Evolutionary strategies scale linearly with the number of parameters in terms of memory, but their sample complexity grows with the effective dimensionality of the problem. For very high-dimensional spaces (e.g., >10 million parameters), gradient-based methods with careful preconditioning often remain the most practical.
Differentiability of Operations
Audit your model for non-differentiable components: hard attention, discrete latent variables, sorting networks, or conditional branching. If these are central to the architecture, you may need to use surrogate gradients (e.g., straight-through estimator, Gumbel-softmax) or switch to a gradient-free optimizer. For models where only a few operations are non-differentiable, hybrid approaches that combine backpropagation for differentiable parts and evolutionary search for the rest can work well.
One team working on a neural architecture search problem found that using a simple evolution strategy for the discrete architecture parameters while backpropagating through the continuous weights reduced search time by 40% compared to a fully gradient-based approach with continuous relaxation. The key was isolating the discrete components and treating them separately.
Core Workflow: Implementing a Next-Gen Optimizer Step by Step
This section outlines a practical workflow for replacing or augmenting backpropagation with an alternative optimizer. We will use a covariance matrix adaptation evolution strategy (CMA-ES) as our example, but the steps generalize to other methods.
Step 1: Define the Fitness Function
Replace your loss function with a fitness function that takes a parameter vector and returns a scalar performance metric. In supervised learning, this is typically the validation loss or accuracy. For reinforcement learning, it could be the cumulative reward. The fitness function should be deterministic for a given seed to ensure reproducibility, or you can use a fixed set of evaluation samples. Wrap the model's forward pass and metric computation into a single callable that accepts parameters as a flat vector.
Step 2: Initialize the Distribution
CMA-ES maintains a multivariate normal distribution over the parameter space. Initialize the mean to the current parameter values (or random initialization) and set the initial covariance to a diagonal matrix with a step size that reflects the scale of each parameter. A common heuristic is to set the initial standard deviation to 0.1 times the parameter range. The population size is typically set to 4 + floor(3 * log(N)), where N is the number of parameters, but you may need to increase it for noisy fitness landscapes.
Step 3: Sample and Evaluate
At each generation, sample a population of candidate solutions from the current distribution. Evaluate the fitness of each candidate in parallel. This is the most compute-intensive step, but it is trivially parallelizable. Use a distributed queue (e.g., Ray, Dask) or multi-processing to speed up evaluation. Record the fitness values and the corresponding parameter vectors.
Step 4: Update the Distribution
Select the top candidates (typically the top 50%) and use their weighted mean to update the distribution's mean. Update the covariance matrix to reflect the direction of improvement, using the evolution path (a smoothed version of the mean shift) to adapt the step size. CMA-ES automatically adjusts the covariance to align with the local curvature, making it a quasi-second-order method without computing gradients.
Step 5: Check Convergence and Restart if Needed
Monitor the fitness value and the distribution's step size. If the step size drops below a threshold or the fitness stagnates for several generations, consider restarting with a larger initial step size or a different random seed. CMA-ES can get stuck in local optima on multimodal landscapes, so multiple restarts with different initializations are common. A typical practice is to run 5–10 independent runs and pick the best result.
One practitioner applied this workflow to a 50-layer residual network for image classification. After 200 generations with a population size of 100, the CMA-ES-trained model matched the accuracy of SGD with momentum, but required 20x more function evaluations. However, the training was fully distributed across 100 GPUs, so wall-clock time was comparable. The advantage was that no learning rate scheduling or gradient clipping was needed—the optimizer adapted automatically.
Tools, Setup, and Environment Realities
Implementing next-gen optimizers requires a different software stack than standard PyTorch or TensorFlow training loops. This section covers the tools and environment considerations you'll need.
Evolutionary Strategy Libraries
Several mature libraries provide ready-to-use implementations of CMA-ES, natural evolution strategies (NES), and genetic algorithms. The most popular is pycma, a pure Python implementation of CMA-ES with a simple interface. For larger-scale experiments, evosax (JAX-based) offers vectorized population evaluations that can run on GPU, dramatically speeding up the sampling and evaluation steps. EvoTorch from NNAISENSE provides distributed evolution strategies with support for PyTorch models. Each library has its own API for parameter vectorization and fitness evaluation, so choose one that integrates well with your existing codebase.
Second-Order Optimizer Implementations
For second-order methods, the optim module in PyTorch includes L-BFGS, but it is rarely used due to memory overhead. The curv library implements KFAC (Kronecker-Factored Approximate Curvature) for convolutional and fully connected layers, which approximates the Fisher information matrix. For transformers, Sophia (Second-order Clipped Stochastic Optimization) is a newer option that uses a diagonal Hessian estimate and has shown strong results on language modeling tasks. These optimizers require careful tuning of damping and update frequency, and they may not be compatible with all model architectures (e.g., batch normalization layers complicate Hessian approximations).
Distributed Infrastructure
Gradient-free methods shine when you have many parallel workers. Set up a distributed computing environment using Ray, MPI, or a cloud-based job queue. Each worker should have access to the model and data, and the central coordinator should handle parameter sampling and fitness aggregation. For CMA-ES, the communication overhead is minimal—only the parameter vectors and fitness values need to be exchanged. This makes it feasible to scale to hundreds of workers on a cluster. If you are using a single GPU, evolutionary methods will be slower than backpropagation, so consider using them only for fine-tuning or for small models.
Hyperparameter-Free Training Loops
One of the biggest appeals of CMA-ES and similar methods is the elimination of learning rate schedules, momentum coefficients, and weight decay settings. However, you still need to set the initial step size and population size. A good rule of thumb: start with a population size of 4 + floor(3 * log(N)) and an initial step size of 0.1 * (parameter range). Monitor the convergence and adjust if needed. For second-order methods like KFAC, you will need to set the damping parameter and the update frequency (every 10–100 steps). These are less sensitive than learning rates but still require tuning.
Variations for Different Constraints
Not every problem requires a full switch to gradient-free optimization. This section covers variations and hybrid approaches for different scenarios.
Hybrid: Backprop + Evolutionary Search for Sparse Architectures
When only a subset of parameters or operations are non-differentiable, you can combine backpropagation for the differentiable part with evolutionary search for the rest. For example, in neural architecture search, the architecture parameters (e.g., which operations to use) are discrete, while the weights are continuous. You can use a simple genetic algorithm to evolve the architecture while training the weights with backprop. This hybrid approach often finds better architectures than fully gradient-based methods because it can explore discrete choices without relaxation bias.
Second-Order Methods for Ill-Conditioned Landscapes
If your loss landscape has highly elongated valleys (e.g., in recurrent networks or physics-informed models), second-order methods can dramatically improve convergence. KFAC and Sophia approximate the curvature and adjust the step direction accordingly, reducing the number of iterations needed. However, they require more memory and computation per step. For models with fewer than 10 million parameters, the overhead is often acceptable. For larger models, consider using a diagonal approximation (e.g., AdaHessian) that is cheaper but still captures some curvature information.
Evolutionary Strategies for Reinforcement Learning
In reinforcement learning, the return is often noisy and the policy may be non-differentiable (e.g., due to discrete actions). Evolutionary strategies have been shown to be competitive with policy gradient methods on many control tasks, especially when parallelism is abundant. The OpenAI ES paper demonstrated that a simple evolution strategy could match the performance of PPO on MuJoCo benchmarks with a similar number of interactions, but with much simpler implementation. The trade-off is that ES requires more interactions overall, but each interaction can be evaluated in parallel without the need for value function approximation.
One team applied ES to a robotics task where the policy included a hard attention mechanism over camera inputs. Backpropagation through the attention mask was unstable, but ES handled the discrete mask naturally and achieved a 15% higher success rate than the best gradient-based alternative.
Pitfalls, Debugging, and What to Check When It Fails
Even with the right optimizer, things can go wrong. This section covers common failure modes and how to diagnose them.
Premature Convergence to Local Optima
Evolutionary strategies and second-order methods can both get stuck in local optima, especially on multimodal landscapes. Signs of premature convergence include stagnation of the best fitness value while the population diversity drops. For CMA-ES, check the eigenvalue spectrum of the covariance matrix—if all eigenvalues are very small, the distribution has collapsed. Solutions: increase the population size, use restart strategies with random initialization, or add noise to the fitness evaluation (e.g., using a different data subset each generation).
Numerical Instability in Second-Order Methods
When using KFAC or Sophia, you may encounter NaN gradients or divergence. This often happens when the damping parameter is too small, leading to near-singular curvature matrices. Increase the damping value (e.g., from 0.01 to 0.1) or use gradient clipping. Also, ensure that your model does not have extreme activation values—batch normalization or layer normalization can help. If the optimizer diverges even with large damping, the curvature approximation may be too crude for your architecture; consider switching to a diagonal second-order method or back to SGD with momentum.
Sample Inefficiency
Gradient-free methods are notoriously sample-inefficient compared to backpropagation, especially in high dimensions. If your fitness evaluations are expensive (e.g., each evaluation requires a full training epoch), you may run out of budget before convergence. Mitigation strategies: use a surrogate model (e.g., Bayesian optimization) to guide the search, or reduce the effective dimensionality by using a low-dimensional subspace (e.g., train only the last few layers). Another approach is to use a hybrid method that starts with evolutionary search for a few generations and then switches to backpropagation for fine-tuning.
Debugging Checklist
If your optimizer is not making progress, check the following: (1) Is the fitness function deterministic? Noise in evaluation can mislead the optimizer. (2) Are the parameters properly normalized? Large differences in scale across parameters can cause CMA-ES to take tiny steps. (3) Is the population size adequate? For noisy landscapes, increase the population size by 2–3x. (4) Are you using the right distribution for your parameter type? For bounded parameters, use a truncated normal or transform the space. (5) Have you run multiple random seeds? A single run may be unlucky.
Frequently Asked Questions and Decision Checklist
This section answers common questions and provides a concise checklist to help you decide which optimizer to use.
When should I abandon backpropagation entirely?
Consider abandoning backpropagation when: your model contains non-differentiable operations that are central to the architecture, the gradient signal is vanishingly small (e.g., very deep networks without skip connections), or you have massive parallelism available and need hyperparameter-free training. For most other cases, backpropagation with modern improvements (AdamW, gradient clipping, learning rate schedules) remains the most sample-efficient choice.
Can I use CMA-ES for large language models?
In practice, no. Language models with billions of parameters have too high a dimensionality for CMA-ES to be sample-efficient. However, you can use CMA-ES to fine-tune a small subset of parameters (e.g., adapter layers or prompts) while keeping the rest frozen. This is an active area of research in parameter-efficient fine-tuning.
How do I compare different optimizers fairly?
Use the same budget of function evaluations (or wall-clock time) for each optimizer. Report the best fitness achieved, the variance across runs, and the computational cost. For gradient-free methods, include the number of generations and population size. For gradient-based methods, report the learning rate schedule and number of epochs. A fair comparison should also account for the cost of hyperparameter tuning—one of the advantages of CMA-ES is that it requires minimal tuning.
Decision checklist
Use this checklist when choosing an optimizer for your next project:
- Is the model fully differentiable? If yes, prefer backpropagation with a modern optimizer (AdamW, Lion). If no, consider hybrid or gradient-free methods.
- Is the loss landscape smooth? If yes, gradient-based methods are efficient. If noisy or discontinuous, consider evolutionary strategies.
- Do you have abundant parallelism? If yes, gradient-free methods become competitive. If limited, stick with backpropagation.
- Is hyperparameter tuning a bottleneck? If yes, choose CMA-ES or a self-tuning second-order method.
- Is the parameter count above 10 million? If yes, avoid full second-order methods and consider diagonal approximations or gradient-based methods.
Ultimately, the best optimizer is the one that solves your problem within your constraints. Experiment with small-scale proxies before committing to a full run. And remember: backpropagation is not obsolete—it is simply one tool in a growing toolbox.
Comments (0)
Please sign in to post a comment.
Don't have an account? Create one
No comments yet. Be the first to comment!