Geometry-Aware Zeroth-Order Optimization for Fine-Tuning Quantized LLMs

Shaocong Ma, Weidong Cai, Heng HuangNeurIPS 2026

TL;DR

Fine-tuning massive language models on a single consumer or workstation GPU requires two heavy-duty tricks: gradient-free optimization (to drop memory overhead) and extreme quantization (to shrink model weights). However, combining them often breaks training because standard updates accidentally push strictly positive quantization scales into negative territory. By curving the mathematical space of these parameters so zero becomes an unreachable horizon, HoZO stabilizes training and lets you fine-tune a 70B-parameter model on a single 48GB GPU.

What Problem Does This Paper Address?

Standard backpropagation is a memory hog because it caches activations and gradients for every parameter. Zeroth-Order Optimization (ZOO) bypasses this by estimating gradients using only forward passes—nudging parameters slightly, checking if the loss goes up or down, and stepping accordingly. This shrinks training memory down to inference levels.

Even so, a 70-billion-parameter model in 16-bit precision still takes ~140 GB just to load. To fit it onto one GPU, we need aggressive quantization (like 4-bit integers). In quantized models, discrete integer weights are frozen, so ZOO methods instead tune the continuous scale parameters that map those integers back to real numbers.

Here is the catch: scale parameters must be strictly positive ($x > 0$). Existing ZOO methods treat these scales as living in flat, Euclidean space. A random Gaussian nudge or a large update step can easily push a scale across zero into negative values. Fixing this with manual clipping or projections introduces mathematical bias into the gradient estimates, destabilizing or derailing training.

Euclidean updates can fall outside the positive space (left), whereas HoZO's Riemannian metric keeps all updates strictly positive (right).

Methods

To keep scale parameters positive without clumsy clipping, the authors introduce Hyper-Octant Zeroth-order Optimization (HoZO). Instead of treating positive numbers as a flat line with a hard wall at zero, HoZO models the parameter space as a Riemannian manifold—specifically, the positive orthant ($\mathbb{R}^d_{>0}$) equipped with a custom, piecewise-smooth metric.

How does this work in practice?

  • Warped Geometry near Zero: The authors define a closed-form exponential map (how you move from a point given a velocity vector) governed by a threshold $\delta$. When a scale parameter is safely above $\delta$, updates behave linearly, just like standard Euclidean addition. As an update approaches or dips below $\delta$, the geometry smoothly warps into an exponential curve, asymptotically approaching zero without ever touching or crossing it.
  • Reversed Perturbation for Memory Efficiency: Standard ZOO methods (like MeZO) save memory by perturbing weights in-place ($x + \mu v$, then $- 2\mu v$, then $+ \mu v$) using a fixed random seed so they never store a copy of the model. Because HoZO’s exponential map is nonlinear near zero, simple addition and subtraction won't bring you back to your exact starting point. The authors derive an exact mathematical inverse—a Reversed_Perturbation operator using logarithms—to reset parameters in-place with virtually zero extra memory.
Figure 3: Illustration of the constructed exponen- tial mapping, ensuring updates remain within the positive hyper-octant.

Datasets

Following standard ZOO benchmarks, the authors evaluate HoZO on six NLP datasets (randomly sampling 1,000 training, 500 validation, and 1,000 test examples per task):

  • Sentiment Analysis: SST-2
  • Natural Language Inference: RTE, CB, and BoolQ
  • Causal Reasoning: COPA
  • Reading Comprehension: SQuAD

No new benchmarks are introduced; all models are pre-quantized using GPTQ.

Key Insights and Ideas

  • Geometry beats projection: Enforcing constraints via intrinsic geometry rather than post-hoc clipping eliminates gradient estimation bias. Despite curving the space, HoZO theoretically matches the optimal $\mathcal{O}(d/\epsilon^4)$ oracle complexity lower bound of standard Euclidean ZOO.
  • Exact recovery matters in nonlinear ZOO: An ablation study shows that trying to do standard "+ / - 2 / +" in-place updates on this curved manifold causes noticeable accuracy drops due to parameter drift. The logarithmic Reversed_Perturbation subroutine is essential to make Riemannian ZOO work in-place.
  • Slower steps, faster finish: Computing exponentials and logarithms makes each HoZO step ~12% slower than flat-space quantized ZOO (1.62s vs. 1.45s per step on Llama-2-13B). Yet because the geometry-aware gradients are cleaner, HoZO converges in far fewer steps, winning on total wall-clock time.
  • Extreme quantization hits a capacity wall, not a stability wall: Even at extreme 2-bit quantization (tested on Llama-3-8B), HoZO's loss decreases smoothly without diverging, proving optimization stability—even though 2-bit information loss prevents it from fully matching 16-bit accuracy.

Key Results

Tested across Llama-2 (7B, 13B, and 70B), HoZO consistently beats zero-shot baselines, 16-bit MeZO, and 4-bit QZO (a state-of-the-art quantized ZOO method):

  • Accuracy Gains: On 4-bit Llama-2-7B, HoZO scores an average of 79.5% across all six tasks, outperforming 16-bit Zero-Shot by +19.9 points, 16-bit MeZO (74.2%), and 4-bit QZO (76.6%). On 4-bit Llama-2-70B, HoZO reaches an 87.3% average score.
  • Massive Memory Savings: HoZO cuts peak GPU memory by up to 34$\times$ compared to standard 16-bit first-order fine-tuning and 3$\times$ compared to 16-bit MeZO, enabling stable fine-tuning of Llama-2-70B on a single 48GB RTX A6000 GPU.
  • Wall-Clock Speedup: When fine-tuning Llama-2-13B on BoolQ, HoZO reaches target low loss 3$\times$ faster than MeZO and 1.4$\times$ faster than QZO in actual wall-clock time.
Figure 1: Performance comparison of the proposed HoZO method against baselines on the Llama-2-7b model across six downstream tasks (SST-2, RTE, CB, BoolQ, Copa, and SQuAD). HoZO consistently yields the highest Accuracy/F1 scores, outperforming all baselines across every individual task. The detailed numbers are presented in Table 2.

Limitations and Future Work

  • Per-step overhead & floating-point precision: The nonlinear mapping adds slight compute overhead per iteration. Additionally, while parameter recovery is exact on paper, practical FP32 rounding and a $10^{-7}$ floor (used to prevent $\log(0)$ errors) mean bitwise equality isn't guaranteed.
  • Quantization bottlenecks: Optimizing scales alone cannot recover capacity lost in ultra-low regimes like INT2.
  • Future directions: The authors only compare scale-tuning ZOO methods with basic SGD updates; integrating HoZO with adaptive optimizers (like Adam), low-rank adapters (LoRA/PEFT), or other compression schemes remains open for future exploration.

Summary updated

Abstract

Zeroth-order optimization (ZOO) is a promising approach for memory-efficient fine-tuning of Large Language Models (LLMs). However, scaling ZOO to larger models on a single GPU necessitates aggressive quantization, which often destabilizes training. A primary cause of this instability is that existing methods treat strictly positive quantization scale parameters as Euclidean variables, potentially leading to boundary violations and optimization difficulties. To address this issue, we propose Hyper-Octant Zeroth-order Optimization (HoZO), a geometry-aware framework that formulates fine-tuning as Riemannian optimization on the positive orthant manifold. By constructing a novel geodesically complete metric and deriving the closed-form exponential map, HoZO inherently enforces positivity constraints without bias-inducing projections. On the theoretical side, we prove that HoZO achieves the optimal oracle complexity for zeroth-order methods. On the empirical side, HoZO outperforms baselines across six downstream tasks and three model sizes. Notably, it achieves a $34\times$ memory reduction compared to first-order fine-tuning, enabling the stable fine-tuning of a 4-bit quantized Llama-2-70b model on a single 48GB GPU.
BibTeX
@inproceedings{ma2026geometry,
  author = {Shaocong Ma and Weidong Cai and Heng Huang},
  title = {{Geometry-Aware Zeroth-Order Optimization for Fine-Tuning Quantized LLMs}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=6r0PI7Q3I7},
}
Figure