In the world of engineering and machine learning, we often find ourselves trapped in a "Groundhog Day" of computation. We solve an optimization problem, change one parameter, and then solve the exact same kind of problem all over again from scratch.
Brandon Amos’s recent tutorial, Tutorial on amortized optimization for learning to optimize over continuous domains, provides a comprehensive roadmap for breaking this cycle. By using machine learning to "amortize" the cost of optimization, we can achieve speedups that are, quite literally, thousands of times faster than traditional methods.
TL;DR
Amortized optimization uses machine learning models to predict the solutions to parametric optimization problems. By learning the shared structure between similar problem instances, these methods can solve complex tasks—like variational inference or robotic control—up to 25,000 times faster than traditional iterative solvers.
What Problem Does This Paper Address?
Optimization is a foundational tool in science, but it is often computationally expensive. Traditional solvers (like Gradient Descent or Newton’s method) are "cold-start" processes: they treat every new problem instance as if they’ve never seen anything like it before.
In many real-world settings, however, we solve parametric optimization problems. This means we have an objective function $f(y; x)$ where $x$ is a "context" (like a robot's current state or an input image) and $y$ is the variable we want to optimize (like the next motor command or a latent representation).
Because the "context" $x$ often changes smoothly, the optimal solutions $y^*(x)$ usually share a hidden structure. The "gap" addressed here is the massive waste of computational resources spent re-solving these related problems from scratch.
Methods
The paper taxonomizes the field into two primary modeling approaches:
- Fully-Amortized Models: These are "black-box" models (typically neural networks) that map the context $x$ directly to a solution $\hat{y}$. Once trained, they never look at the original objective function again during inference. They are incredibly fast but can struggle with accuracy if the problem is highly complex.
- Semi-Amortized Models: These models integrate domain knowledge by "opening the black box." They might use a neural network to predict a starting point and then perform a few "unrolled" iterations of gradient descent, or they might learn specific parameters of a classical solver (like the step size in an Anderson Acceleration loop).
The tutorial also distinguishes between two ways to train these models:
- Regression-based: Training the model to mimic a "teacher" (a slow, classical solver).
- Objective-based: Training the model to minimize the objective function $f$ directly. This is the "aha!" moment for many: you don't actually need ground-truth solutions to train an optimizer; you just need a differentiable objective.
Datasets
To demonstrate these principles, the paper utilizes several standard benchmarks and synthetic tasks:
- MNIST: Used to evaluate Variational Autoencoders (VAEs), where the "encoder" is actually an amortized optimizer solving for latent variables.
- Humanoid MDP: A high-dimensional robotic control task (45 state dimensions, 17 action dimensions) used to show how Reinforcement Learning policies act as amortized solvers for optimal control.
- C-convex functions on a sphere: A newly introduced synthetic benchmark for optimizing functions defined on non-Euclidean geometries.
Key Insights and Ideas
- The Amortization Gap: Even the best neural network might not find the perfect mathematical minimum. This difference is the "amortization gap." However, in many fields (like deep learning), a "good enough" solution found in milliseconds is far more valuable than a "perfect" solution found in minutes.
- RL is Amortization: One of the most insightful connections is that Reinforcement Learning (RL) is essentially amortized optimization. An RL policy is just a model that has learned to predict the "argmax" of a Q-value function across different states.
- Smoothing is Key: For non-convex problems with many local minima, the paper highlights that "smoothing" the objective (e.g., via Gaussian perturbations) during training helps the amortized model find better global regions, a technique common in both "learning to optimize" and Evolution Strategies.
Key Results
The quantitative speedups reported are staggering:
- Variational Inference: On a batch of 1024 MNIST images, the amortized encoder was 25,000 times faster (0.4ms vs. 8 seconds) than solving the optimization from scratch with the Adam optimizer.
- Model-Free Control: For a Humanoid robot, the amortized policy was 1,000 times faster than iterative optimization.
- Model-Based Control: Even when incorporating a physics model, the amortized approach remained 700 times faster.
Limitations and Future Work
Despite the speed, amortized optimization isn't a silver bullet. The author acknowledges several hurdles:
- Accuracy vs. Speed: Amortized models rarely reach the high numerical precision of classical solvers. They are best used as "warm-starts" or in applications where speed is the priority.
- Out-of-Distribution (OOD) Failure: If the model encounters a context $x$ far outside its training data, its predicted "solution" may be nonsensical.
- Intractability: Amortization doesn't make an impossible problem possible; if a single instance of the problem is too hard to solve even once, you can't easily train a model to solve it.
Future Directions: The paper points toward "Amortized Convex Solvers" that could be dropped into existing optimization software (like CVXPY) to provide instant speedups for power grids, supply chains, and more.
Summary updated