TL;DR
AdaLeZO is a universal, plug-and-play framework that accelerates Zeroth-Order (ZO) fine-tuning of Large Language Models by 1.7× to 3.0× without increasing memory overhead. By framing layer selection as a Multi-Armed Bandit problem, it dynamically concentrates the perturbation budget on the most sensitive layers rather than blindly updating the entire network. This approach eliminates a massive computational bottleneck and reduces gradient estimation variance while maintaining theoretical unbiasedness.
What Problem Does This Paper Address?
Fine-tuning large language models (LLMs) usually requires backpropagation, which stores massive intermediate activations and quickly hits a "memory wall" on consumer-grade hardware. Zeroth-Order (ZO) optimization methods, like MeZO, offer a clever workaround: they estimate gradients using only forward passes via finite differences, compressing memory footprints down to inference levels.
However, standard ZO optimization suffers from two major flaws:
- The Curse of Dimensionality: Standard methods use isotropic exploration, meaning they perturb all parameters uniformly. This ignores the fact that different layers have vastly different sensitivities, leading to a "blind" random walk.
- The Linear Latency Bottleneck: Profiling reveals that generating random perturbations and updating parameters across the entire network consumes nearly half (~46%) of the total per-step training time. As models grow to tens of billions of parameters, this $O(d)$ overhead severely limits scalability.
Methods
To solve these issues, the authors introduce AdaLeZO (Adaptive Layer-wise Zeroth-Order optimization). Instead of a uniform search, AdaLeZO treats layer selection as a non-stationary Multi-Armed Bandit (MAB) problem.
As shown in Figure 1, the workflow operates through three key modules:
- Dynamic Reward Allocation: The immediate reward for selecting a layer is defined by the magnitude of the estimated scalar gradient. An Exponential Moving Average (EMA) tracks these rewards over time to capture shifting layer sensitivities.
- Adaptive Sampling with Replacement: At each step, the framework draws $K$ layers with replacement based on a Softmax probability distribution (plus a small uniform exploration factor to prevent layer starvation). Layers drawn multiple times receive a higher "multiplicity" count, naturally intensifying updates on critical layers.
- Count-Aware Inverse Probability Weighting (IPW): To ensure the sparse gradient estimate remains mathematically unbiased compared to a full-parameter gradient, AdaLeZO applies IPW reweighting. It also introduces a clipping threshold ($C_{clip}$) to balance the bias-variance trade-off caused by extremely small sampling probabilities.
Datasets
The authors evaluated AdaLeZO across 11 downstream NLP tasks using LLaMA-2-7B, LLaMA-3.1-8B, and the OPT model family (6.7B to 30B parameters). The benchmarks include:
- Classification: SST-2, RTE, CB, BoolQ, WIC, WSC, MultiRC
- Multiple-Choice: Copa, ReCoRD
- Generation / QA: SQuAD, DROP
No new datasets or benchmarks were introduced in this work.
Key Insights and Ideas
- Policy Blindness is Real: First-order optimizers like Adam naturally prioritize updates on shallow and middle layers while leaving deep layers relatively static. Standard ZO methods waste immense budget by forcing uniform updates across all layers.
- ZO Estimates as a Temporal Filter: Although individual zeroth-order gradient estimates are incredibly noisy, their expectation over time faithfully preserves the relative ranking of layer importance (showing a positive Spearman correlation of $\rho \approx 0.48$). The MAB framework successfully acts as a temporal denoiser to extract this structural signal.
- Sparsity Regularizes: Full-parameter perturbation can actually introduce detrimental high-dimensional noise. Restricting updates to a dynamically selected sparse subset of layers acts as an implicit regularizer, often leading to better convergence stability.
Key Results
- Massive Speedups: AdaLeZO achieves 1.7× to 3.0× wall-clock acceleration over standard ZO baselines. On short-sequence tasks where perturbation overhead dominates, the speedup reaches up to 5.1×.
- Universal Compatibility: As a plug-and-play module, it seamlessly accelerates other advanced ZO variants. For example, it boosts HiZOO by 2.0× (AdaHiZOO) and PseuZO by 2.97× (AdaPZO) while maintaining or slightly improving downstream task accuracy.
- Memory Neutrality: It achieves these speedups while strictly preserving the inference-level peak memory footprint of standard ZO methods, making it highly practical for consumer hardware.
Limitations and Future Work
- The First-Order Gap: While AdaLeZO narrows the performance gap between zeroth-order and first-order (backprop-based) methods, a gap still remains on complex reasoning benchmarks like DROP due to the inherently stochastic nature of ZO gradient estimation.
- Scope of Evaluation: The framework was exclusively validated on supervised fine-tuning for NLP tasks. Its efficacy in multimodal contexts or reinforcement learning from human feedback (RLHF) remains an open question for future research.
Summary updated