No Token Left Behind: Explainability-Aided Image Classification and Generation

Roni Paiss, Hila Chefer, Lior Wolf
4/11/2022
cs.CV

Official code: apple-aiml-research/ml-no-token-left-behind (140 stars, Jupyter Notebook, last commit 2026-09-11).

Abstract

The application of zero-shot learning in computer vision has been revolutionized by the use of image-text matching models. The most notable example, CLIP, has been widely used for both zero-shot classification and guiding generative models with a text prompt.

Show full abstract

However, the zero-shot use of CLIP is unstable with respect to the phrasing of the input text, making it necessary to carefully engineer the prompts used. We find that this instability stems from a selective similarity score, which is based only on a subset of the semantically meaningful input tokens. To mitigate it, we present a novel explainability-based approach, which adds a loss term to ensure that CLIP focuses on all relevant semantic parts of the input, in addition to employing the CLIP similarity loss used in previous works. When applied to one-shot classification through prompt engineering, our method yields an improvement in the recognition rate, without additional training or fine-tuning. Additionally, we show that CLIP guidance of generative models using our method significantly improves the generated images. Finally, we demonstrate a novel use of CLIP guidance for text-based image generation with spatial conditioning on object location, by requiring the image explainability heatmap for each object to be confined to a pre-determined bounding box.

View on arXivView PDF

Code Implementations(1)

14012Jupyter NotebookMay 31, 20222 months agoNOASSERTION

Similar Papers

Cite this paper

@article{paiss2022token,
  title  = {No Token Left Behind: Explainability-Aided Image Classification and Generation},
  author = {Roni Paiss and Hila Chefer and Lior Wolf},
  year   = {2022},
  eprint = {2204.04908},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2204.04908}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2204.04908.svg)](https://codeofpaper.com/paper/2204.04908)

Discussion