Zero-shot Retrieval: Augmenting Pre-trained Models with Search Engines

Hamed Damirchi, Cristian Rodriguez Opazo, Ehsan Abbasnejad, Damien Teney, Javen Qinfeng Shi, Stephen Gould, Anton van den HengelarXiv 2023 · DOI

TL;DR

This paper introduces a novel method to improve the zero-shot performance of pre-trained vision models by augmenting them with web search. The approach identifies uncertain predictions and uses them to query search engines for relevant data, which is then used to fine-tune the model, leading to significant accuracy gains on challenging datasets.

What Problem Does This Paper Address?

Large pre-trained models like CLIP have revolutionized computer vision by learning rich representations from vast amounts of data. However, they often struggle with domain-specific nuances and out-of-distribution data. While retrieval-augmented methods exist, they typically rely on curated datasets and can be computationally expensive. This paper addresses the challenge of making pre-trained models more robust and adaptable to specific tasks without requiring additional labeled data, by dynamically leveraging the vast, uncurated knowledge available on the web.

Methods

The core of the proposed method involves a test-time augmentation strategy.

  1. Uncertainty Detection: The model first identifies instances where it is uncertain about its prediction. This is achieved by analyzing the entropy of the model's output probabilities.
  2. Web Search Query Generation: For these uncertain instances, text queries are formulated based on the class names or descriptions. The authors explore different query strategies, including direct class names, LLM-generated descriptions, and image captions.
  3. Data Retrieval: A search engine (like Google) is used to retrieve images based on these queries.
  4. Refinement: To handle the inherent noise in web-scraped data, a refinement step is introduced. This involves modeling the distribution of retrieved images in CLIP's feature space using a mixture of von Mises-Fisher distributions and keeping only those images that are sufficiently close to the target dataset's distribution.
  5. Model Update: A compact, linear probe classifier is trained on the refined retrieved dataset. This classifier is then used alongside the original pre-trained model, with a decision mechanism based on which model provides higher confidence.

Datasets

The authors evaluate their method on five popular image classification datasets:

  • Flowers [38]
  • Pets [39]
  • Stanford Cars [30]
  • Food [7]
  • ImageNet [16]

No new benchmarks were introduced; instead, the focus was on improving performance on existing datasets in a zero-shot setting.

Key Insights and Ideas

  • Leveraging Uncertainty for Targeted Augmentation: The key insight is that focusing retrieval efforts on instances where the model is uncertain is more effective than random retrieval or retrieving data for all instances. This allows for efficient use of web search and targeted improvement.
  • Web Search as a Dynamic Knowledge Source: The paper demonstrates that the web, when queried intelligently, can serve as a powerful, dynamic source of information to augment pre-trained models, overcoming the limitations of static, curated datasets.
  • Refinement is Crucial for Noisy Web Data: The inherent noise in data retrieved from the web necessitates a robust refinement process. The proposed distribution-based refinement in CLIP's feature space is shown to be effective in filtering out irrelevant images.
  • Class Name Queries are Often Sufficient: Surprisingly, using simple class names as search queries often yields significant improvements, highlighting the effectiveness of modern search engines in capturing relevant concepts.

Key Results

  • Substantial Accuracy Gains: The method achieves significant improvements in zero-shot accuracy, notably a 15 percentage point increase on the Stanford Cars and Flowers datasets.
  • Outperforming Baselines: The proposed approach consistently outperforms the zero-shot CLIP baseline.
  • Efficiency: The method uses a significantly smaller amount of retrieved data compared to methods like Internet Explorer, while achieving comparable or better results.
  • Robustness to Noise: The refinement process effectively mitigates the impact of noisy retrieved data.
  • Impact of Prompt Specificity: The study on prompt specificity shows that while detailed descriptions can sometimes reduce confidence, a balance between specificity and generality is key.

Limitations and Future Work

  • Dependence on Search Engine Quality: The performance is inherently tied to the quality and relevance of the search engine's results.
  • Computational Cost of Retrieval: While more efficient than some methods, web retrieval at test time still adds computational overhead.
  • Bias in Web Data: The authors acknowledge that susceptibility to bias in web data is a pertinent concern that needs further investigation.
  • Future Work: The authors suggest exploring dynamic approaches where models can continuously access the internet for new knowledge, amalgamating results from multiple search engines, and addressing issues of bias. They also envision prompt engineering through LLMs as a key area for future exploration.

Summary updated

BibTeX
@misc{damirchi2023zero,
  author = {Hamed Damirchi and Cristian Rodriguez Opazo and Ehsan Abbasnejad and Damien Teney and Javen Qinfeng Shi and Stephen Gould and Anton van den Hengel},
  title = {{Zero-shot Retrieval: Augmenting Pre-trained Models with Search Engines}},
  year = {2023},
  eprint = {2311.17949},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.17949},
}
Figure