Vision-Language Models (VLMs) like CLIP have transformed image classification by enabling zero-shot inference through natural language prompts. However, the performance of these models is highly sensitive to the specific wording of the prompts used. While Large Language Models (LLMs) can generate detailed class descriptions to improve accuracy, they often introduce "hallucinations"—non-visual or non-discriminative details that confuse the model.
ProAPO (Progressively Automatic Prompt Optimization) is an evolutionary framework designed to automatically refine these prompts into highly discriminative, class-specific descriptions. By utilizing one-shot supervision and an entropy-constrained fitness score, ProAPO filters out problematic LLM outputs, significantly boosting classification performance across diverse datasets.
The Challenges of Prompt Engineering
Optimizing prompts for VLMs faces three primary hurdles: hallucination, search space explosion, and overfitting.
- Hallucinations: LLMs often generate descriptions that are either non-visual (e.g., "has a strong smell") or non-discriminative (e.g., "a seabird" for an albatross). These details fail to help the model distinguish between visually similar classes.
- Search Space Explosion: A prompt typically consists of a task-specific template and a class-specific description. When combined across many classes, the number of possible prompt combinations grows exponentially, making exhaustive search impossible.
- Overfitting: In "one-shot" settings (where only one example image per class is available), a prompt might achieve perfect accuracy on the training sample but fail to generalize to the test set, as shown in the scatter plot above.
The ProAPO Framework
ProAPO addresses these issues through a two-stage optimization process that refines the task-specific template first, followed by the class-specific descriptions.
1. Evolutionary Search Strategy
Instead of a single query, ProAPO treats prompt optimization as an evolutionary problem. It begins by generating a "Library" of potential descriptions from an LLM. It then applies several operators to evolve the population of prompts:
- Edit-based Operators: Adding, deleting, or replacing descriptions from the library.
- Evolution-based Operators: Using Crossover to combine high-scoring prompts and Mutation to introduce new elements, preventing the search from stalling in local optima.
2. Entropy-Constrained Fitness Score
To combat overfitting in low-data regimes, ProAPO introduces a fitness score that balances Accuracy with an Entropy constraint. This constraint penalizes prompts that lead to over-confident but fragile predictions on the single training image. By encouraging lower confidence (higher entropy) on training samples, the model is guided toward more robust and generalizable descriptions.
3. Efficiency through Sampling
To manage the massive search space, ProAPO employs Group Sampling. This strategy identifies "salient" classes—those the model currently struggles to classify—and focuses optimization efforts there. This approach reduced optimization time from over 300 minutes to just 15 minutes in experimental trials, with negligible impact on final accuracy.
Key Results and Insights
ProAPO was evaluated across 13 downstream tasks, including fine-grained classification (birds, cars, aircraft), specialized domains (satellite imagery, textures), and general object recognition (ImageNet).
- Performance Gains: ProAPO outperformed vanilla CLIP by an average of 8.4% on ResNet-50 and 5.7% on ViT-B/32 architectures. It consistently surpassed previous state-of-the-art methods like CoOp (prompt tuning) and CuPL (LLM-generated descriptions).
- Domain Success: The framework showed massive improvements in specialized tasks, such as a 21% gain on the EuroSAT satellite dataset compared to baseline methods.
- Interpretability and Transferability: Unlike continuous prompt tuning, which optimizes abstract mathematical vectors, ProAPO optimizes natural language. This makes the results human-readable and allows the optimized prompts to transfer effectively across different model architectures.
Conclusion
ProAPO demonstrates that the key to leveraging LLMs for computer vision is not necessarily better generation, but better selection. By using actual images as a filter within an evolutionary framework, ProAPO effectively discards hallucinations and identifies the most discriminative visual features for classification. While challenges remain in visually similar scene recognition, ProAPO provides a scalable, interpretable, and highly effective path forward for automatic prompt engineering.
Summary updated