TL;DR
ECO (Ensembling Context Optimization) improves few-shot image classification in vision-language models by learning an ensemble of multiple diverse, shorter prompts instead of a single long one. By redistributing the same parameter budget, ECO delivers consistent accuracy boosts across 11 benchmarks with absolutely zero added computational cost at inference time.
What Problem Does This Paper Address?
Foundational vision-language models like CLIP have revolutionized image recognition by enabling zero-shot classification via textual prompts (e.g., "a photo of a [CLASS]"). However, performance is highly sensitive to prompt wording; a minor tweak can cause a significant swing in accuracy.
To bypass manual prompt engineering, methods like Context Optimization (CoOp) introduce prompt learning, optimizing continuous context vectors directly from data. While effective, existing methods only learn a single prompt. They miss out on the benefits of prompt ensembling—the practice of averaging predictions from multiple different prompts, which is known to significantly boost the robustness and accuracy of vision-language models.
Methods
The authors introduce ECO (Ensembling Context Optimization), a framework that seamlessly merges prompt learning with prompt ensembling.
Instead of learning a single long prompt with $M$ context tokens (the standard CoOp approach), ECO splits the parameter budget to learn $D$ distinct prompts, each containing $N$ shorter context tokens, such that the total number of trainable parameters remains constant ($M = D \times N$).
During training, cross-entropy loss optimizes these $D$ sets of context vectors simultaneously while keeping the base CLIP model frozen. At inference time, the text features generated by each prompt are averaged element-wise before computing similarity scores with the image features.
Crucially, because these textual prompts do not depend on the input image, the ensembled text features can be precomputed and cached. This means ECO provides the benefits of an ensemble with zero additional computational overhead during deployment.
Datasets
The approach was evaluated using a standard few-shot protocol (1, 2, 4, 8, and 16 shots) across 11 diverse image classification benchmarks:
- General Objects: ImageNet, Caltech101
- Fine-Grained Categories: OxfordPets, StanfordCars, Flowers102, FGVCAircraft
- Scenes & Textures: SUN397, DTD
- Satellite Imagery: EuroSAT
- Actions: UCF101
- Specialized/Noisy: Food101 (noted for having noisy annotations)
Key Insights and Ideas
- The Power of Shorter, Diverse Contexts: Optimization landscapes for shorter prompts appear to yield more diverse and complementary representations. Learning four distinct 4-token prompts captures broader semantic context than a single 16-token prompt, preventing the model from overfitting to a narrow textual subspace.
- Computational Free Lunch: Ensembling typically incurs a linear cost penalty. ECO circumvents this entirely by exploiting the decoupled architecture of vision-language models, allowing the ensemble's complexity to be completely baked into static text embeddings before inference begins.
- Enhanced Data Efficiency: The performance gap between ECO and single-prompt methods is widest in ultra-low-data regimes (1 and 2 shots), making it an exceptionally strong few-shot learner.
- Robustness to Noisy Labels: On datasets like Food101, which suffer from clean-label noise, ECO maintains steady improvements where single-prompt methods often struggle or degrade below zero-shot baselines.
Key Results
The authors found that a configuration of $D=4$ prompts and $N=4$ tokens provided the best overall trade-off.
As summarized in the performance breakdown below, ECO ($D=4, N=4$) consistently outperformed the CoOp baseline across all shot configurations:
- 1-Shot: Achieved an absolute accuracy gain of +3.47% over CoOp (62.90% vs 59.43%).
- 2-Shot: Delivered a +2.88% improvement.
- 16-Shot: Maintained a +0.85% advantage, outperforming both CoOp and strong linear-probe baselines.
Limitations and Future Work
While ECO demonstrates clear advantages, this paper focuses exclusively on extending the basic, unconditional text prompt learning method (CoOp). The authors note that ECO is a general framework and intend to apply it to more advanced prompt learning paradigms in future work, such as instance-conditional prompting (e.g., CoCoOp) and multi-modal prompt learning (e.g., MaPLe), where prompts are learned in both the vision and language branches.
Summary updated