TL;DR
ConMeZO accelerates zeroth-order (gradient-free) LLM finetuning by replacing uniform random direction sampling with adaptive sampling restricted to a cone centered around a momentum estimate. This geometric constraint mitigates the high variance caused by the curse of dimensionality, delivering up to a 2× wall-clock speedup over MeZO while preserving its massive memory savings.
What Problem Does This Paper Address?
Finetuning Large Language Models (LLMs) using standard backpropagation-based optimizers (like AdamW) is notoriously memory-intensive because it requires storing massive activation tensors and gradients. Zeroth-order (ZO) optimization methods, such as MeZO, offer a compelling alternative: they estimate gradients using only forward passes, drastically lowering the GPU memory footprint and enabling finetuning on consumer-grade hardware.
However, traditional ZO methods suffer from a major bottleneck: they sample search directions uniformly at random. In a billion-parameter space, finding a valid descent direction by pure chance is incredibly rare—a challenge known as the "curse of dimensionality." This results in exceptionally high variance in gradient estimates, causing ZO methods to require up to 100× more training iterations than first-order methods to achieve comparable accuracy.
Methods
The authors introduce ConMeZO (Cone-based Memory-efficient Zeroth-order optimization) to narrow down the high-dimensional search space using past trajectory information:
- Cone-Guided Directional Sampling: Instead of sampling a perturbation direction uniformly from an entire hypersphere, ConMeZO restricts the random search direction ($z_t$) to a cone centered around a promising direction defined by a momentum vector ($m_t$).
- Momentum Tracking & Warm-up: The central axis of the cone is guided by an exponentially moving average of past gradient estimates. To prevent early, noisy gradient estimates from permanently biasing the optimization path, the authors implement a momentum warm-up schedule that smoothly transitions from a short memory ($\beta = 0.1$) to long-term tracking ($\beta = 0.99$).
- Vectorized Implementation: Rather than looping through model parameters sequentially in Python (which incurs massive overhead), ConMeZO flattens the parameter buffer and applies perturbations via fused, in-place vector operations. This allows it to reuse random perturbations and run faster per iteration than MeZO.
Datasets
The method was evaluated across a diverse suite of standard natural language processing benchmarks using RoBERTa-large (355M parameters), OPT-1.3B, and OPT-13B models:
- GLUE Benchmark: SST-2, SST-5, SNLI, MNLI, RTE, and TREC.
- Reading Comprehension & QA Benchmarks: SQuAD v1.1, BoolQ, WiC, DROP, ReCoRD, and MultiRC.
No new datasets or benchmarks were introduced in this work.
Key Insights and Ideas
- Exploitation vs. Exploration via Geometry: The cone's half-angle ($\theta$) acts as a direct knob to balance exploration and exploitation. A smaller angle heavily exploits the momentum direction, while a larger angle allows broader exploration.
- The Suboptimality of Naive Momentum: Simply applying momentum directly to parameter updates within a ZO framework (i.e., MeZO + Momentum) does not yield significant performance gains. The real breakthrough comes from using momentum to guide the sampling space rather than the update step itself.
- High-Dimensional Concentration Phenomena: Due to the mathematical properties of high-dimensional spheres, a randomly sampled vector inside a cone will almost always lie sharply near the outer edge of the cone. This allows the authors to simplify their algorithm by fixing the sampling angle directly to $\theta$ without losing accuracy.
Key Results
- 2× Convergence Speedup: When finetuning OPT-1.3B on the SQuAD dataset, ConMeZO reaches MeZO's peak F1 score in less than half the training steps. ConMeZO vs MeZO on SQuAD
- Synthetic Validation: On a synthetic strongly convex quadratic problem ($d=1000$), ConMeZO achieves a clear 2.45× speedup over MeZO. Synthetic Optimization Problem
- Faster Per-Step Runtime: Thanks to the vectorized implementation framework, ConMeZO actually achieves a 3.6% to 7.9% reduction in wall-clock time per iteration compared to MeZO, despite its higher algorithmic complexity.
- Maintained Memory Efficiency: While ConMeZO introduces a modest memory overhead to store the momentum buffer (+10% to +28% peak VRAM on OPT models), it remains vastly more efficient than first-order methods. For instance, on RoBERTa-Large, AdamW requires ~15.8 GB of VRAM, whereas ConMeZO needs only ~3.3 GB.
Limitations and Future Work
- Memory Overhead: Storing the momentum vector requires an extra optimizer state, making its memory footprint slightly larger than vanilla MeZO.
- Static Hyperparameters: The cone angle $\theta$ and final momentum $\beta$ are currently fixed hyperparameters that require manual tuning per task. The authors suggest developing self-adaptive mechanisms to adjust these parameters dynamically during training.
- Orthogonal Combinations: ConMeZO only addresses directional sampling variance. The authors note that their cone-guided sampling strategy is largely orthogonal to other recent ZO advancements, such as second-order curvature estimation (HiZOO) or low-rank adapter spaces (LOZO), making hybrid approaches a promising direction for future research.
Summary updated