SlowGuess/NeurIPS_2023_OCR huggingface dataset:
To rule out confounding variables other than global similarity structure for improved downstream task performance of the gLocal transform, we created a new triplet dataset where for each triplet in the data we choose an object that is different from the original human choice to be the new odd-one-out choice. Note that this is not a random choice over all objects but a random choice over the set of two objects not chosen by a human participant, i.e., human-adversarial choices (albeit random and not deterministic). Using this human-adversarial triplet dataset, we use the same gLocal optimization as we do for the original task (see Eq. 6). We minimize a bounded cross-entropy error and determine convergence on a held-out, human-adversarial validation set as we have done for the original task. This allows us to use the same hyperparameter setting that we found is optimal for the gLocal transform (see Appx. A.2 for further details). Across the different few-shot learning and anomaly detection tasks, we find the adversarial transform performing slightly worse than the original transform and substantially worse than the gLocal transform for all CLIP models (see Fig. 13).
E Representational alignment
E.1 Human similarity judgments and RSMs
Multi-arrangement task. Human similarity judgments for King et al. [41] and [10] were obtained by using a multi-arrangement task. In a multi-arrangement task, participants are presented with a computer screen showing images of several different objects. The participants are asked to arrange the images into semantically meaningful clusters, given the instruction that images of objects that lie close together are considered more similar. From this arrangement, one can infer pairwise (dis-)similarities of the objects and average those across all participants to obtain a representative (dis-)similarity matrix.
Ordinal scale. In Peterson et al. [65, 66], pairwise similarity judgments were obtained by asking human participants to rate the similarity of pairs of objects on an ordinal scale that ranges from 0 ("not similar at all") to 10 ("very similar"). The pairwise similarity ratings can be averaged across the different participants which in turn yields a matrix of similarities between pairs of objects.
Figure 13: Few-shot learning and anomaly detection performances as a function of the degree of alignment with human similarity judgments for the original, naive, gLocal, and human-adversarial transforms.
Triplet odd-one-out choices. The triplet odd-one-out task is a commonly used task in the cognitive sciences to infer pairwise object similarity ratings [72, 31, 60]. The triplet odd-one-out task is a three-alternative-forced-choice task where participants are presented with three objects and have to select the one that does not fit. In contrast to the multi-arrangement task or an ordinal scale, the triplet odd-one-out task does not naturally yield a similarity matrix. A similarity matrix can be obtained, however, by learning representations for the objects being used in the task from the human responses. Variational Interpretable Concept Embeddings (VICE) — an approximate Bayesian method for inferring mental representations of object concepts from triplet odd-one-out choices — is a method that was specifically developed for that purpose. VICE uses variational inference to learn representations for the objects in the triplets by fitting the human responses via stochastic gradient descent. The method minimizes  $\mathcal{L}_{\mathrm{global}}$  with additional non-negativity and sparsity constraints on the representations. More details about the optimization can be found in Mutthaler et al. [60]. From the VICE solution, one can easily compute a representational similarity matrix (RSM). Specifically, given learned object representations  $V \in \mathbb{R}^{n \times d}$ , one first computes the dot-product similarity matrix  $S_h := V V^\top$  and then exponentiate this matrix elementwise,  $S_h' := \exp(S_h)$ . One can then apply the softmax function defined in Eq. 1 to every combination of triplets in the exponentiated similarity matrix which yields the final RSM for triplet odd-one-out choices from Hebart et al. [32]. The last step is performed to guarantee that the pairwise similarities are modeled according to the triplet odd-one-out objective function that was used to learn the human object representations  $V$  (see Eq. 2).
E.2 Neural network representations and RSMs
Neural network representations. RSMs for neural network representations are obtained by first embedding the same set of images that were presented to the human participants in the  $p$ -dimensional latent space of a neural net. The latent space could be any layer of a neural network. Here we use the penultimate layer space for ImageNet models and the image encoder space for image/text models. We do this because previous work has shown that the penultimate layer space of ImageNet models and the image encoder space of image/text models respectively yield the highest similarity to human behavior [66, 67, 61]. After embedding the images into the neural net's latent space, one obtains a representation matrix  $X \in \mathbb{R}^{n \times p}$  for the  $n$  images in the data. Instead of simply computing the dot-product similarity matrix  $S \coloneqq XX^{\top}$ , in RSA one typically uses either a cosine similarity or a Pearson correlation kernel to compute the affinity matrix,
$$
\cos (\boldsymbol {x} _ {i}, \boldsymbol {x} _ {j}) := \frac {\boldsymbol {x} _ {i} ^ {\top} \boldsymbol {x} _ {j}}{| | \boldsymbol {x} _ {i} | | _ {2} | | \boldsymbol {x} _ {j} | | _ {2}}; \qquad \phi (\boldsymbol {x} _ {i}, \boldsymbol {x} _ {j}) := \frac {\left(\boldsymbol {x} _ {i} - \bar {\boldsymbol {x}} _ {i}\right) ^ {\top} \left(\boldsymbol {x} _ {j} - \bar {\boldsymbol {x}} _ {j}\right)}{| | \left(\boldsymbol {x} _ {i} - \bar {\boldsymbol {x}} _ {i}\right) | | _ {2} | | \left(\boldsymbol {x} _ {j} - \bar {\boldsymbol {x}} _ {j}\right) | | _ {2}},
$$
where the cosine similarity kernel function  $\cos (\pmb{x}_i,\pmb{x}_j)$  or the Pearson correlation kernel function  $\phi (\pmb{x}_i,\pmb{x}_j)$  is applied to every  $(\pmb{x}_i,\pmb{x}_j)$  vector pair of the matrix  $\pmb{X}$  for obtaining the final representational similarity matrix  $S^{\prime}\in \mathbb{R}^{n\times n}$ . Here, we use the Pearson correlation kernel function  $\phi (\pmb{x}_i,\pmb{x}_j)$  to obtain a neural net's RSM. Pearson correlation is the centered version of cosine similarity and the ranking of the obtained similarities does not differ between the two kernel functions but Pearson correlation first centers the vectors to have zero mean and is therefore a more robust measure. For obtaining RSMs with transformed representations, the transforms are first applied to  $\pmb{X}$  before computing  $S^{\prime}$ .
E.3 Representational Similarity Analysis (RSA)
Additional RSMs. To corroborate our findings from §4.5, here we additionally show RSMs for CLIP RN50 and CLIP ViT-L/14 (Laion 2B). In accordance with the different RSMs obtained from the representation space of CLIP ViT-L/14 (WIT), there does not appear to be a qualitative difference in the global similarity structure between the RSMs obtained from applying either the naive or the gLocal transforms to CLIP RN50 or CLIP ViT-L/14 (Laion 2B) (see Fig. 14). Hence, the gLocal transform improves representational alignment while preserving the local similarity structure of the original representation equally well for the different CLIP models, as we show in Tab. 4.
(a) CLIP RN50
Figure 14: Here, we show representational similarity matrices (RSMs) for human behavior and CLIP RN50 [WIT; 70] and CLIP ViT-L/14 [Laion 2B; 82] for four different human similarity judgment datasets [31, 66, 10, 41]. We contrast RSMs obtained from the network's original representation space (second column), the naively transformed representation space [61] (third column), and the representation space obtained by using the gLocal transform (rightmost column) against RSMs directly constructed from human similarity judgments (leftmost column).
(b) CLIP ViT-L/14 (Laion 2B)
F Global transform derivation
Here we derive that
$$
\min _ {\alpha} \| \pmb {W} - \alpha I \| _ {\mathrm {F}} ^ {2} = \| \pmb {W} - (\sum_ {i = 1} ^ {p} \pmb {W} _ {i i} / p) I \| _ {\mathrm {F}} ^ {2}.
$$
$$
\begin{array}{l} \min  _ {\alpha} \| \boldsymbol {W} - \alpha I \| _ {\mathrm {F}} ^ {2} = \min  _ {\alpha} \sum_ {i = 1} ^ {p} \sum_ {j = 1} ^ {p} \left(\boldsymbol {W} _ {i j} - \alpha \mathbb {1} _ {[ i = j ]}\right) ^ {2} \\ = \min  _ {\alpha} \sum_ {i = 1} ^ {p} \sum_ {j = 1, j \neq i} ^ {p} \boldsymbol {W} _ {i j} ^ {2} + \sum_ {k = 1} ^ {p} \left(\boldsymbol {W} _ {k k} - \alpha\right) ^ {2} \\ = \sum_ {i = 1} ^ {p} \sum_ {j = 1, j \neq i} ^ {p} \boldsymbol {W} _ {i j} ^ {2} + \min  _ {\alpha} \sum_ {k = 1} ^ {p} \left(\boldsymbol {W} _ {k k} - \alpha\right) ^ {2}. \\ \end{array}
$$
The minimizer of  $\min_{\alpha}\sum_{k = 1}^{p}\left(\boldsymbol{W}_{kk} - \alpha\right)^2$  is attained with  $\alpha = \sum_{\ell = 1}^{p}\boldsymbol{W}_{\ell \ell} / p$ . Substituting this back into the last equality and reversing the steps from before we have
$$
\begin{array}{l} \sum_ {i = 1} ^ {p} \sum_ {j = 1, j \neq i} ^ {p} \boldsymbol {W} _ {i j} ^ {2} + \min  _ {\alpha} \sum_ {k = 1} ^ {p} \left(\boldsymbol {W} _ {k k} - \alpha\right) ^ {2} = \sum_ {i = 1} ^ {p} \sum_ {j = 1, j \neq i} ^ {p} \boldsymbol {W} _ {i j} ^ {2} + \sum_ {k = 1} ^ {p} \left(\boldsymbol {W} _ {k k} - \sum_ {\ell = 1} ^ {p} \boldsymbol {W} _ {\ell \ell} / p\right) ^ {2} \\ = \sum_ {i = 1} ^ {p} \sum_ {j = 1} ^ {p} \left(\boldsymbol {W} _ {i j} - \left(\sum_ {\ell = 1} ^ {p} \boldsymbol {W} _ {\ell \ell} / p\right) \mathbb {1} _ {[ i = j ]}\right) ^ {2} \\ = \left\| \boldsymbol {W} - \left(\sum_ {\ell = 1} ^ {p} \boldsymbol {W} _ {\ell \ell} / p\right) I \right\| _ {\mathrm {F}} ^ {2}, \\ \end{array}
$$
which finishes our derivation.
G Properties of LCKA
Kornblith et al. [43] previously validated linear centered kernel alignment (LCKA) as a way to measure similarity between neural network representations. Given representations  $\mathbf{X} \in \mathbb{R}^{n \times p}$  and  $\mathbf{Y} \in \mathbb{R}^{n \times p_2}$  containing embeddings of the same  $n$  images stacked row-wise, LCKA is:
$$
\operatorname {L C K A} (\boldsymbol {X}, \boldsymbol {Y}) = \frac {\langle \tilde {\boldsymbol {X}} \tilde {\boldsymbol {X}} ^ {\top} , \tilde {\boldsymbol {Y}} \tilde {\boldsymbol {Y}} ^ {\top} \rangle_ {\mathrm {F}}}{\| \tilde {\boldsymbol {X}} \tilde {\boldsymbol {X}} ^ {\top} \| _ {\mathrm {F}} \| \tilde {\boldsymbol {Y}} \tilde {\boldsymbol {Y}} ^ {\top} \| _ {\mathrm {F}}} = \frac {\| \tilde {\boldsymbol {X}} ^ {\top} \tilde {\boldsymbol {Y}} \| _ {\mathrm {F}} ^ {2}}{\| \tilde {\boldsymbol {X}} ^ {\top} \tilde {\boldsymbol {X}} \| _ {\mathrm {F}} \| \tilde {\boldsymbol {Y}} ^ {\top} \tilde {\boldsymbol {Y}} \| _ {\mathrm {F}}}, \tag {7}
$$
where  $\tilde{X}$  and  $\tilde{Y}$  are equal to  $X$  and  $Y$  with column means subtracted. (Formally,  $\tilde{X} = H X$  and  $\tilde{Y} = H Y$  and  $H = I - \frac{1}{n} 11^{\top}$  is the centering matrix, which is a matrix representation of the linear operator that subtracts column means.)
As Kornblith et al. [43] note, linear CKA can be thought of as measuring the cosine similarity between all pairs of principal components (PCs) of  $\tilde{\pmb{X}}$  and  $\tilde{\pmb{Y}}$ , weighted by the products of the proportions of variance these PCs explain in each representation. Formally, let  $\tilde{\pmb{X}} = \pmb{U}\pmb{\Sigma}\pmb{V}^{\top}$  and  $\tilde{\pmb{Y}} = \pmb{U}'\pmb{\Sigma}'\pmb{V}'^{\top}$  be the singular value decompositions of  $\tilde{\pmb{X}}$  and  $\tilde{\pmb{Y}}$ . The left-singular vectors  $\boldsymbol{u}_i = \boldsymbol{U}_{:,i}$  are the (unit-norm) PCs of  $\pmb{X}$ , and the squared singular values  $\lambda_{i} = \Sigma_{ii}^{2}$  are the amount of variance that those PCs explain (up to a factor of  $1/n$ ). Given these singular value decompositions, linear CKA is:
$$
\operatorname {L C K A} (\boldsymbol {X}, \boldsymbol {Y}) = \frac {\sum_ {i = 1} ^ {p _ {1}} \sum_ {j = 1} ^ {p _ {2}} \lambda_ {i} \lambda_ {j} ^ {\prime} \left(\boldsymbol {u} _ {i} ^ {\top} \boldsymbol {u} _ {j} ^ {\prime}\right) ^ {2}}{\sqrt {\sum_ {i = 1} ^ {p _ {1}} \lambda_ {i} ^ {2}} \sqrt {\sum_ {j = 1} ^ {p _ {2}} \lambda_ {j} ^ {\prime 2}}}. \tag {8}
$$