SlowGuess/NeurIPS_2023_OCR huggingface dataset:
All the experiments are implemented by PyTorch [45]. The learning rates for ImageNet, CIFAR-10/100, and SVHN are of 0.03 with a consine rate decay schedule, i.e.,  $\eta = \eta_0\cos (\frac{7\pi k}{16K})$ , where  $\eta_0$  denotes the initial learning rate and  $k$  is the index of training step [46]. We use a standard stochastic gradient descent (SGD) optimizer with a momentum of 0.9 [47, 48], and the weight decay is 0.0001. The training batch sizes are 128 and 64 for ImageNet and other datasets, respectively. Specifically, the mapping net for ResNet-50 is  $h_{\psi}[512, 49]$ ,  $h_{\psi}[512, 64]$  for WRN, and  $h_{\psi}[512, 49]$  for PARN-18. The total training epoch is 90 for ImageNet and 200 for others. The experiments were trained on four NVIDIA A100 GPUs for ImageNet-1k and one GPU for other datasets.
4.3 Comparison of Interpretation Capability
In this experiment, we compare interpretation results of popular methods, including Grad-CAM [2], Grad-CAM++ [3], RISE [10], Score-CAM [4], Group-CAM [5], and CGC [41]. Note that LICO is compatible with these post-hoc interpretation methods so that in our experiments, we compare the
Figure 3: Saliency maps (Left) and Insertion/Deletion curves (Right) on ImageNet-1k validation set.
saliency maps obtained by these interpretation methods using baseline ImageNet pre-trained model and LICO trained counterparts of the same architectures.
Qualitative results. Qualitatively, we compare the saliency maps obtained by different interpretation methods in Fig. 3 (Left). We can see that for single object images, LICO can effectively help baseline methods cover more comprehensive and discriminative regions, e.g., the head and fur of a bird. However, the baseline methods are inferior in capturing all the objects in the multi-object image. Please refer to Appendix A for more results of multi-class and multi-object cases.
Table 1: Quantitative comparisons of different interpretation methods on ImageNet in terms of Insertion and Deletion. We report the results: "Baseline/+LICO". Overall = Insertion - Deletion.
Method	Grad-CAM++	Grad-CAM	RISE	Score-CAM	Group-CAM	CGC
Insertion↑	50.0/51.2	53.5/57.1	54.0/54.9	55.1/55.6	56.8/55.2	52.2/55.4
Deletion↓	14.8/11.7	13.3/15.1	11.7/10.8	11.5/11.2	12.3/10.5	-/15.8
Overall↑	35.2/39.5	40.2/42.0	43.6/44.1	42.3/44.4	44.5/44.7	-/39.6
Quantitative results. To achieve quantitative evaluation, we follow [10, 4, 5] to conduct Insertion and Deletion tests. Insertion gradually introduces class-related regions (3.6% pixels) of an original image to a blurred image according to the values of the saliency map. This process is repeated until the blurred image is fully recovered. In contrast, Deletion aims to replace related pixels (3.6%) in a blurred image with those of the corresponding original image. In Table 1, we provide the AUC of the classification score after Softmax. For most of the interpretation methods, LICO consistently improves the Insertion and Deletion values. Although the insertion value of Group-CAM and deletion value of Grad-CAM is better than LICO, the LICO still achieves the best overall values. We also report the quantitative results of corresponding cases with different interpretation methods in Fig. 3 (Right). Please refer to Appendix B for the experiment of Pointing Game [5].
Sanity checks. Sanity check for saliency maps was first proposed in [49], which is a qualitative test aiming at evaluating whether the saliency maps are sensitive to model parameters. We conducted two types of test: cascading randomization from top to bottom layers and independent randomizing of
Figure 4: Sanity checks evaluated using ImageNet pre-trained VGG-19 and LICO trained version. Each column represents saliency maps after randomizing corresponding layers following two randomization schemes: (a) cascading randomization from top to bottom layers, and (b) independent randomization of different layers.
different layers. In this experiment, Score-CAM is selected as the baseline method, and the backbone network is VGG-19. In Fig. 4, we can see that Score-CAM is sensitive to the model parameters, and the saliency maps obtained by LICO-trained model also pass these two tests. From Fig. 4(a) we can see that the saliency maps of LICO are more sensitive to model parameters along cascaded randomization, e.g., from Logit to Conv34, then to Conv32.
4.4 Classification Performance
In addition to interpretation comparison, we compare the classification performance on various datasets since LICO can act as a regularization for enhancing image classifier. According to previous studies [1, 41, 50], a good interpretation method often sacrifices the discriminative ability, i.e., lower classification accuracy than baselines. As shown in Table 2, we compare non-post-hoc methods GCC [50] and CGC [41] with our LICO. Despite their emphasis on interpretation ability, both GCC and CGC experience performance degradation compared to the CE loss pre-trained model.
In contrast, LICO surpasses the baseline model and achieves the highest Top-1 and Top-5 accuracy values, a notable advantage not shared by previous interpretation methods. Although LICO introduces relatively few amounts of training parameters, i.e., MLP  $h_{\psi}$  and prompt tokens  $X_{m}$ , which is trivial to the enhancement of both interpretation and classification performance. Furthermore, it does not affect model architectures and introduces any computational overhead at the inference phase. Please refer to Appendices C and D for further evaluation of LICO using ViTs and the potential in regularizing semantic space obtained by  $t$ -SNE, respectively.
Table 2: Classification accuracy (%) on ImageNet using ResNet.
Method	Top-1	Top-5
ResNet-50	76.13	92.91
+GCC [50]	74.40	92.12
+CGC [41]	74.60	92.24
+LICO	76.27	92.99
ResNet-18	69.76	89.08
+GCC [50]	67.74	88.52
+CGC [41]	66.37	88.27
+LICO	69.83	89.21
Training with limited data. In Table 3, we evaluate the
performance of LICO with limited training data. Following [36, 35], we conduct experiments on CIFAR-10/100 and SVHN with different label amounts. Note that we only use limited labeled data for training and do not focus on whether LICO is useful under a semi-supervised setting. Across all the limited training settings, LICO consistently improves both PARN18 and WRN baselines. Notably, in the full training setting, LICO exhibits the largest improvement on CIFAR-100, which is attributed to the effectiveness of prompt guidance introduced by manifold of larger amounts of classes.
Table 3: Classification accuracies (%) on CIFAR-10/100 and SVHN datasets using different amounts of labels. "Full" means training with all labeled data.
Dataset
Labels	CIFAR-10	CIFAR-100	SVHN
40	250	4000	400	2500	10000	40	1000
PARN18	22.9±0.23	32.9±0.42	77.5±0.63	5.2±0.07	23.7±0.17	54.9±0.14	14.7±0.27	56.2±0.21
+LICO	23.7±0.12	36.1±0.61	80.1±0.05	5.8±0.14	21.4±0.48	56.5±0.67	16.0±0.19	59.5±0.41
WRN	23.4±0.92	36.9±1.08	80.8±0.07	8.6±0.17	32.3±0.66	60.7±0.24	15.9±0.23	58.9±0.22
+LICO	24.9±0.42	41.7±0.91	81.5±0.43	10.7±0.51	35.5±0.40	62.0±0.48	17.4±0.34	63.7±0.34
WRNFull	95.6±0.12	80.9±0.18	97.9±0.02
+LICO	95.8±0.08	82.2±0.02	98.3±0.06
Table 4: Fine-grained classification accuracy under full and few-shot settings.
Method	1-shot	5-shot	10-shot	Full	1-shot	5-shot	10-shot	Full
Baseline	CUB-200	Standford-Cars
13.7±0.3	51.7±0.3	66.4±0.2	80.1±0.9	6.1±0.2	34.3±0.4	61.1±0.4	89.7±0.1
+CGC [41]	15.8±0.3	55.2±0.3	68.4±0.3	81.5±0.1	6.5±0.2	36.5±0.4	63.0±0.4	90.3±0.1
+LICO	16.9±0.2	55.8±0.4	68.4±0.2	82.7±0.3	7.1±0.3	37.2±0.5	64.4±0.4	91.5±0.2
Baseline	Aircraft	VGG Flowers
7.7±0.3	25.7±0.4	41.4±0.3	83.7±0.2	52.1±0.5	85.6±0.4	93.2±0.2	96.1±0.2
+CGC [41]	8.0±0.3	26.9±0.4	42.9±0.3	85.7±0.2	53.3±0.5	85.8±0.4	93.4±0.2	96.2±0.2
+LICO	8.4±0.4	27.5±0.2	43.1±0.4	85.6±0.2	55.6±0.4	86.2±0.3	93.4±0.4	96.8±0.3
Fine-Grained classification. Furthermore, we evaluate LICO on a fine-grained classification problem that requires the model to capture fine-grained features. In Table 4, except for the Aircraft, LICO enhances classification performance under all settings compared with CGC. This observation highlights that contrastive learning among attention maps used in CGC primarily emphasizes similarities between target images and other random/augmented images, while disregarding the measurement of semantic distinctions. For the Aircraft dataset, it is difficult for LICO to achieve significant improvements due to the categorical labels are types of aircraft, e.g., the numerical symbols such as 727-200 which are challenging for CLIP text encoder to achieve meaningful embedding, and CLIP has demonstrated relatively lower accuracy on some out of distribution data like aircraft and satellite [8]. To address the challenges, we incorporate prior text knowledge by constructing initial prompts as "a type of aircraft", which allows LICO to improve performance in the few-shot settings while achieving comparable results to CGC under the full setting. This strategy has also been verified in CoCoOp [18].
Ablation on manifold matching and OT alignment. In Table 5, we investigate the effectiveness of  $\mathcal{L}_{\mathrm{MM}}$  and  $\mathcal{L}_{\mathrm{OT}}$ . We can see that only using  $\mathcal{L}_{\mathrm{OT}}$  obtains more performance drop than that of  $\mathcal{L}_{\mathrm{MM}}$ .
This indicates that the global consistency of manifolds guarantees the basic performance, and OT only focuses on local feature alignments so that it cannot be sensitive to relationships between intra- and inter-class samples.
Table 5: Ablation on  ${\mathcal{L}}_{\mathrm{{MM}}}$  and  ${\mathcal{L}}_{\mathrm{{OT}}}$  .
\( \mathcal{L}_{\text{CE}} \)	\( \mathcal{L}_{\text{MM}} \)	\( \mathcal{L}_{\text{OT}} \)	Top-1	Top-5	Insert.	Delet.
✓	76.13	92.91	53.5	13.3
✓	✓	75.98	92.92	56.6	16.0
✓	✓	76.18	92.90	56.9	15.5
✓	✓	✓	76.27	92.99	57.1	15.1
Ablation on number of context tokens. In Table 6, we evaluate the performances influenced by different numbers of learnable tokens. We find that 12 is the best choice in our experiments, and the settings of 16 and 20 are relatively better than those of 4 and 8.
Ablation on distance function  $D$  in Eq. (1). In Table 7, we compare the similarity functions used in manifold matching, which measures distances among samples within a mini-batch. We can see that the Euclidean distance is more suitable to our LICO.
Table 6: Ablation on no. of context tokens.
no.	Top-1	Top-5	Insertion	Deletion
0	75.64	91.92	54.1	17.8
4	76.03	92.74	55.2	17.5
8	76.09	92.89	56.3	16.0
12	76.27	92.99	57.1	15.1
16	76.21	92.87	57.0	15.8
20	76.14	92.93	56.9	15.5
Table 7: Ablation on distance function.
Dataset	Euclidean	Cosine
CIFAR-10	95.78±0.08	95.46±0.12
CIFAR-100	82.22±0.02	81.85±0.05
SVHN	98.25±0.06	98.21±0.06
CUB-200	82.70±0.30	82.10±0.30
Flowers	96.80±0.30	96.20±0.40
Please refer to Appendices E, F, and G for more ablation studies on DC, effects of different type of text encoders, and frozen parameters of prompts, respectively.
In this paper, we proposed LICO to enhance existing visual interpretation methods by incorporating language information, which is compatible with these methods. The LICO aligns image and prompt embeddings globally using manifold matching, simultaneously aligns feature maps with corresponding learnable context tokens by applying optimal transport alignment. Extensive experiments on evaluating interpretation capability and classification performance exhibit both quantitative and qualitative enhancement introduced by LICO. A key limitation of LICO is that it depends on a trainable MLP to project language embeddings into a metric space of same dimension with that of image features, where the output dimension of such MLPs varies according to different image encoders.
Broader Impacts LICO explores effective visual interpretations of DNNs by introducing language knowledge, which is orthogonal to existing post-hoc interpretation methods. An important merit of LICO is to enhance interpretability while achieving competitive or even better classification performance, applicable to various kinds of tasks and models effectively.
This work was supported in part by Shanghai Municipal Science and Technology Major Project (No. 2018SHZDZX01) and ZJLab, Natural Science Foundation of Shanghai (No. 21ZR1403600), National Natural Science Foundation of China (Nos. 62101136, 62306075), China Postdoctoral Science Foundation (No. 2022TQ0069), Young Elite Scientists Sponsorship Program by CAST (No. 2022QNRC001), Shanghai Municipal of Science and Technology Project (No. 20JC1419500), and Shanghai Center for Brain Science and Brain-inspired Technology.
[1] Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2921-2929, 2016.
[2] Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-CAM: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE International Conference on Computer Vision, pages 618-626, 2017.
[3] Aditya Chattopadhyay, Anirban Sarkar, Prantik Howlader, and Vineeth N Balasubramanian. Grad-CAM++: Generalized gradient-based visual explanations for deep convolutional networks. In 2018 IEEE winter Conference on Applications of Computer Vision, pages 839-847, 2018.
[4] Haofan Wang, Zifan Wang, Mengnan Du, Fan Yang, Zijian Zhang, Sirui Ding, Piotr Mardziel, and Xia Hu. Score-CAM: Score-weighted visual explanations for convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and pattern Recognition Workshops, pages 24-25, 2020.
[5] Qinglong Zhang, Lu Rao, and Yubin Yang. Group-CAM: Group score-weighted visual explanations for deep convolutional networks. arXiv preprint arXiv:2103.13859, 2021.
[6] Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In International Conference on Machine Learning, pages 3319-3328, 2017.
[7] Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda Viégas, and Martin Wattenberg. Smoothgrad: removing noise by adding noise. arXiv preprint arXiv:1706.03825, 2017.
[8] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pages 8748-8763, 2021.
[9] Yipei Wang and Xiaogian Wang. "why not other classes?": Towards class-contrastive backpropagation explanations. Advances in Neural Information Processing Systems, 35:9085-9097, 2022.
[45] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. PyTorch: An imperative style, high-performance deep learning library. Advances in Neural Information Processing Systems, 32, 2019.
[46] Ilya Loshchilov and Frank Hutter. SGDR: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016.
[47] Ilya Sutskever, James Martens, George Dahl, and Geoffrey Hinton. On the importance of initialization and momentum in deep learning. In International Conference on Machine Learning, pages 1139-1147, 2013.
[48] Boris T Polyak. Some methods of speeding up the convergence of iteration methods. Ussr Computational Mathematics and Mathematical Physics, 4(5):1-17, 1964.
[49] Julius Adebayo, Justin Gilmer, Michael Muelly, Ian Goodfellow, Moritz Hardt, and Been Kim. Sanity checks for saliency maps. Advances in Neural Information Processing Systems, 31, 2018.
[50] Vipin Pillai and Hamed Piriaviash. Explainable models with consistent interpretations. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 2431-2439, 2021.
A More Results of Saliency Maps
LICO localizes more discriminative local features. Fig. 5 provides more saliency maps, showing that LICO is able to localize fine local features of target objects, e.g., the foot and head in Fig. 5(c).
Figure 5: More samples on ImageNet-1k. For each image, we provide saliency maps of different methods and Insertion/Deletion curves. LICO helps localize fine local features.
More comprehensive locations yield lower metrics. Here, we provide some failure cases obtained by our LICO, where the saliency maps of LICO exhibit more comprehensive locations on target objects while resulting in lower AUC values of Insertion and higher AUC values of Deletion compared with baseline methods.
For the cases with multiple target objects in Fig. 6, LICO localizes different objects separately and comprehensively, which demonstrates the consistency between language knowledge and visual features established by our LICO. However, LICO obtains inferior Insertion/Deletion evaluations, which is paradoxical to human cognition. We conjecture that the main reason is attributed to the fixed text encoder, which is not specifically optimized for target tasks, i.e., the images with a single object occupy a higher percentage of the dataset such as ImageNet-1k. Therefore, the located multiple objects may be harmful to saliency maps-guide pixel-level insertion and deletion strategies.
In Fig. 7, we provide some examples that contain multi-class objects in one image, and for the target classes, LICO obtains more accurate localizations. In Fig. 8, we verified the effectiveness of LICO on capturing more objects of sinlge class within one image, and we can see that LICO captures more comprehensive objects than those without LICO.
B Pointing Game
To verify the localization ability of LICO, we conducted the pointing game on MS COCO 2017 validation set for localization evaluation. Following settings in Score-CAM and Group-CAM, we quantified localization by calculating  $\frac{\text{Hits}}{\text{Hits} + \text{Misses}}$ , assessing if salient pixels fall within the annotated bounding boxes. Table 8 shows that LICO consistently improves all the baseline interpretation methods, indicating the effectiveness of regularization by the proposed manifold OT losses.
Figure 6: Saliency maps of failure cases with multiple target objects on ImageNet-1k. For each image, we provide saliency maps of different methods and Insertion/Deletion curves.
Figure 7: Saliency maps of multi-class cases.
C Evaluation on ViT
We further trained a ViT-Base-16 network on ImageNet-1k dataset and presented the corresponding accuracy, insertion, and deletion in Table 9. We calculated the  $\mathcal{L}_{\mathrm{MM}}$  and  $\mathcal{L}_{\mathrm{OT}}$  between language tokens and representations of patch tokens and class tokens. For attention maps, we applied Grad-CAM in LICO-trained ViT-Base-16 by calculating gradients from outputs to the last attention layer of the class token. Table 9 further confirms that the transformer model with LICO not only performs better in classification but also gains better interpretability than the one without LICO, which is in line with the finding for the CNN-based backbone.
D t-SNE Visualization of Latent Features
We further explore how LICO can regularize the latent space. In Fig. 9, we provide the t-SNE visualization of learned visual features on CIFAR-10 and SVHN. In Fig. 9(a), our LICO enables different classes with similar distribution shapes. Interestingly, if we roughly categorize the ten
Figure 8: Saliency maps of single-class and multi-object cases.
Table 8: Pointing game evaluation on MS COCO 2017 val set.
LICO	Grad-CAM	Grad-CAM++	RISE	XRAI	Score-CAM	Group-CAM
×	56.7±0.225	57.2±0.227	54.3±0.205	55.1±0.232	51.0±0.211	57.5±0.202
✓	56.9±0.221	58.1±0.215	55.2±0.201	56.7±0.229	52.5±0.205	58.2±0.197
classes of CIFAR-10 into two classes, i.e., "animal" and "vehicle", our LICO can almost linearly classify these two classes, whereas the baseline obtains non-linear classification boundary (dashed lines). In Fig. 9(b), LICO makes the latent space exhibit an manifold structure with respect to semantically ordinal classes such as from "1" to "4", and some semantically closer classes are also closer in latent space such as "9" and "10". However, the baseline method is unable to capture the underlying manifold structure and we can see obviously that "7" is far away from "5", "6", and "8", so as to "9" and "10", which should be closer in nature. In Figs. 9(c) and (d), LICO also shows more discriminant results under limited training data.
Figure 9: t-SNE results obtained by the models with and without our LICO. (a) and (b) are results of full setting on CIFAR-10 and SVHN, respectively. (c) and (d) show the results under the setting of limited training data.
Table 9: Evaluation on ImageNet-1k using ViT-Base-16.
Model	Accuracy	Insertion	Deletion
ViT-Base-16 w/o LICO	77.9	55.2	14.4
ViT-Base-16 w/ LICO	78.2	56.0	13.8
Table 10: Ablation on DC.
DC	ImageNet	CIFAR-10	CIFAR-100	SVHN
×	76.22	95.45±0.09	81.3±0.05	98.1±0.10
✓	76.27	95.80±0.08	82.2±0.02	98.3±0.06
Ablation on dynamic context (DC). In the training algorithm of LICO, we designed a dynamic context (DC) for learnable context. We provide some results on ablation of DC in Tables 10 and 11. We can see that, for most of datasets we evaluated, DC consistently improves the classification performance. For few-shot settings in Table 11, DC obtains slight performance improvements, which is attributed to few samples of each class. That is to say, there are insufficient visual feature variety to endow context vectors with various information.
Table 11: Ablation on DC on four fine-grained datasets.
CUB-200	Standford-Cars
DC	1-shot	5-shot	10-shot	Full	1-shot	5-shot	10-shot	Full
X	16.9±0.2	55.8±0.4	68.2±0.2	82.5±0.3	7.0±0.3	37.1±0.5	64.1±0.4	90.3±0.2
✓	16.9±0.2	55.8±0.4	68.4±0.2	82.7±0.3	7.1±0.3	37.2±0.5	64.4±0.4	91.5±0.2
Aircraft	VGG Flowers
DC	1-shot	5-shot	10-shot	Full	1-shot	5-shot	10-shot	Full
X	8.0±0.3	27.4±0.3	42.8±0.2	85.6±0.3	55.3±0.4	85.7±0.4	92.7±0.2	96.2±0.4
✓	8.4±0.4	27.5±0.2	43.1±0.4	85.6±0.2	55.6±0.4	86.2±0.3	93.4±0.4	96.8±0.3
Variation of KL-divergence values between prompts and visual features  $f(\theta)$ . Here, we provide curves of KL-divergence with and without LICO. The KL values obtained by baseline w/o LICO are calculated between CE-trained visual features and fixed CLIP pre-trained vectors, and those obtained by w/ LICO are calculated between visual features and prompts learned by LICO. In Fig. 10, we can see that LICO enables stable descent of KL values, and this indicates that the LICO learned visual features indeed approach the learned language prompts. However, the values obtained by baseline without LICO fluctuate to some extent and cannot decrease further, which is attributed to the domain gap between CLIP pre-trained data and target CIFAR-10. In other words, without manifold matching, it is difficult to enable downstream visual features to be aligned with CLIP pre-trained language knowledge.
F Different Text Encoders
Both Word2Vec (W2V) and BERT can replace the CLIP text encoder in our LICO framework. However, they may be inferior in acting as language guidance in LICO: (1) CLIP text encoder was trained with huge amounts of image-text pairs, and the advanced architecture ViT-B/32 has stronger representation ability than W2V; (2) Even though BERT excels at representing language data, latent representation of BERT may not align with target image representations well; (3) Recent studies on prompt learning like CoCoOp has demonstrated the effectiveness of CLIP pre-trained text encoders for downstream tasks.
In Table 12, we conducted the experiments using W2V as a text encoder, mapping texts into 512-D. W2V: using fixed word embeddings and no context tokens for OT loss. W2V-P: replacing class tokens in the prompts, the context tokens are randomly initialized as Gaussian. We can see that W2V
Figure 10: Variation of KL-divergence value w/ and w/o LICO on CIFAR-10 test set.