Introduction
Fine-tuning large-scale Vision-Language Models (VLMs), such as CLIP, has traditionally relied on backpropagation (BP). While effective, BP requires the storage of a complex computation graph to calculate gradients, leading to significant memory overhead. This requirement often precludes the deployment of high-performance model adaptation on resource-constrained "edge" hardware, including IoT sensors, smartwatches, and inference-only ASICs.
To address these limitations, researchers have turned to Zeroth-Order (ZO) optimization. ZO methods estimate gradients using only forward passes by evaluating the loss function at slightly perturbed points. However, standard ZO approaches face two primary hurdles: high variance in gradient estimates, which leads to unstable training, and poor convergence, as they often become trapped in "sharp" local minima that fail to generalize to unseen data. This paper introduces SharpZO, a hybrid framework designed to overcome these challenges and enable efficient, forward-only VLM prompt tuning.
The SharpZO Framework
SharpZO utilizes a two-stage optimization strategy that stabilizes the fine-tuning process and prioritizes the discovery of flat, generalizable regions in the loss landscape.
Stage 1: Sharpness-Aware Warm-up (Global Search)
The first stage focuses on finding a stable starting point for optimization. Rather than a standard local search, SharpZO employs a modified Covariance Matrix Adaptation Evolution Strategy (CMA-ES) integrated with Sharpness-Aware Minimization (SAM) principles. By utilizing Coordinate-wise Gradient Estimation (CGE) to identify "worst-case" perturbations, the algorithm explicitly seeks out "flat" regions of the loss landscape. This smoothing effect provides a robust foundation for the subsequent fine-grained search, effectively mitigating the jaggedness that typically plagues ZO methods.
Stage 2: Sparse ZO-SGD (Fine-grained Local Search)
Once the model is positioned in a favorable neighborhood, it transitions to a faster Randomized Gradient Estimation (RGE) method. To manage the inherent noise of ZO gradients, the authors introduce Z-pruning. Unlike traditional magnitude-based pruning, Z-pruning uses Z-score normalization to identify and suppress outlier gradient estimates. This approach treats optimization as a signal-to-noise problem, reducing the search space dimensionality to focus only on the most influential parameters and preventing noisy dimensions from derailing the optimizer.
Experimental Evaluation
The researchers evaluated SharpZO across a comprehensive suite of benchmarks to test its versatility and robustness:
- Downstream Tasks: 11 diverse datasets, including ImageNet (general), OxfordPets (fine-grained), EuroSAT (satellite), and DTD (texture).
- Distribution Shift (OOD): Robustness testing via ImageNet-V2, ImageNet-Sketch, ImageNet-A, and ImageNet-R.
- Architectures: Testing across ResNet-50/101 and ViT-B/16/32 backbones within the CLIP framework.
Key Results and Insights
SharpZO demonstrates significant improvements over existing black-box optimization methods in several key areas:
- Superior Accuracy: SharpZO outperformed state-of-the-art forward-only baselines, such as ZIP and BlackVIP, by an average of 5% to 7% across the 11 downstream tasks. On the ViT-B/16 backbone, it achieved an average accuracy of 75.64%.
- Closing the Gap with Backpropagation: The performance of SharpZO approaches that of first-order methods like CoOp. This suggests that black-box tuning can achieve high quality without the memory costs of backpropagation.
- Enhanced Robustness: By seeking "flat" minima, SharpZO showed a 2.0% to 2.8% absolute improvement over previous ZO methods under distribution shifts, confirming that sharpness-aware optimization translates to better generalization.
- Operational Efficiency: SharpZO significantly reduces the "Time-to-test-accuracy" (ToTA). For instance, on the Pets dataset, SharpZO reached target accuracy in just 2.4 minutes, compared to 126 minutes for the ZIP baseline.
Discussion and Limitations
The success of SharpZO highlights that the high variance of Zeroth-Order methods is often a symptom of the loss landscape's geometry. By "sanding down" the landscape through sharpness-aware warm-up and filtering noise via Z-pruning, the framework makes forward-only tuning a viable reality for VLMs.
However, some challenges remain. The Coordinate-wise Gradient Estimation (CGE) used in Stage 1 is computationally intensive, making it difficult to scale from prompt tuning to full-model fine-tuning involving millions of parameters. Additionally, the transition point between the two stages currently requires manual oversight or specific heuristics. Future work may explore automating this transition and extending the SharpZO methodology to full-scale multimodal Large Language Models (LLMs).
Summary updated