Fine-tuning a Large Language Model (LLM) typically requires a "memory wall." To calculate gradients via backpropagation, a system must store not only the model weights but also the intermediate activations for every layer. For a 13B parameter model, this often exceeds the capacity of consumer-grade hardware.
A growing body of research suggests we can bypass this wall using Zeroth-Order (ZO) optimization. Instead of calculating exact gradients through the chain rule, these methods estimate the "slope" of the loss landscape by slightly perturbing the model weights and observing how the output changes. This allows for fine-tuning using only the memory required for a standard inference pass.
The Mechanism: Poking the Landscape
In traditional first-order optimization, backpropagation provides a precise vector pointing toward the steepest descent. In contrast, Zeroth-Order methods like MeZO, popularized by researchers such as Tanmay Gautam and Wooseok Ha in Variance-reduced Zeroth-Order Methods for Fine-Tuning Language Models, treat the model as a black box.
The intuition is simple:
- Take the current model weights.
- Add a small amount of random noise (a perturbation).
- Run a forward pass to see if the loss went up or down.
- Update the weights in the direction that reduced the loss.
Because this process only requires forward passes, it eliminates the need to store activations. As Shuai Shang demonstrates in Fine-tuning Quantized Neural Networks with Zeroth-order Optimization, combining this with weight quantization (QZO) can reduce memory requirements by up to 18x, enabling the fine-tuning of massive models on a single 24GB GPU.
The Variance Bottleneck
The primary challenge of ZO optimization is variance. Because the algorithm is essentially "guessing" the gradient based on random pokes, the estimates are incredibly noisy. This noise leads to unstable training trajectories, slow convergence, and a "generalization gap" where the model overfits to the specific noise of a training batch.
Yao Zhu and Jindong Wang note in ZooPFL: Exploring Black-box Foundation Models for Personalized Federated Learning that this sensitivity can even cause an optimized model to perform worse than its zero-shot baseline. To make ZO viable for LLMs, researchers have developed three main stabilization strategies.
Strategy 1: Parameter Sparsity
One way to reduce noise is to reduce the number of things you are poking. Yong Liu and Cho-Jui Hsieh introduced Sparse MeZO (S-MeZO) in Sparse MeZO: Less Parameters for Better Performance in Zeroth-Order LLM Fine-Tuning. They discovered that gradient noise disproportionately affects large-magnitude weights. By selectively updating only a subset of small-magnitude weights, S-MeZO achieves faster convergence and higher accuracy. Similarly, Fei Wang proposed LeZO, which updates only specific layers at each step to further slash computation time.
Strategy 2: Variance Reduction and Momentum
To combat the inherent "jitter" of ZO updates, researchers apply classical optimization tricks. Tanmay Gautam utilized SVRG (Stochastic Variance Reduced Gradient) to stabilize MeZO. Other approaches, like MUZO by Yün Peng, use multiple queries per step to get a higher-fidelity gradient estimate, which allows for the use of powerful momentum-based optimizers like Adam. Yao Shu further refined this in Refining Adaptive Zeroth-Order Optimization at Ease by using smoothed first-moment estimates to guide the second-moment updates, significantly speeding up convergence.
Strategy 3: Hybrid and Bilevel Optimization
Sometimes, the best way to use ZO is to not use it alone. Bilevel-ZOFO, proposed by Reza Shirkavand and Heng Huang in Bilevel ZOFO: Efficient LLM Fine-Tuning and Meta-Training, nests a fast first-order adaptation loop inside a zeroth-order outer loop. This "best of both worlds" approach maintains memory efficiency while gaining the stability of gradient-based methods.
In the realm of Vision-Language Models, Yifan Yang developed SharpZO, which uses an evolutionary "warm-up" phase to find a flat, stable region of the loss landscape before applying sparse ZO refinement, ensuring the model doesn't get stuck in sharp, unstable local minima.
The Future of Accessible AI
By removing the requirement for backpropagation, Zeroth-Order methods are transforming fine-tuning from an industrial-scale task into something possible on edge devices and consumer GPUs. Whether through data-centric fixes like OAT-Rephrase or architectural innovations like MoZO, the goal remains the same: achieving the performance of first-order gradients with the footprint of a simple forward pass.