A Framework for Standardizing Similarity Measures in a Rapidly Evolving Field

Nathan Cloos, Guangyu Robert Yang, Christopher J Cueva

TL;DR

Different machine learning and neuroscience packages implement representational similarity measures—such as Centered Kernel Alignment (CKA)—with subtle algorithmic differences that lead to wildly inconsistent results. This paper introduces an open-source framework and Python repository that standardizes, benchmarks, and provides a mathematically grounded naming convention for ~100 similarity measures across 14 packages, ensuring reproducible comparisons across studies.

What Problem Does This Paper Address?

Quantifying representational similarity is central to modern AI and computational neuroscience, whether comparing two neural network architectures or checking if an artificial model aligns with neural recordings from biological brains. However, the ecosystem of similarity metrics is fragmented.

Two researchers reporting a "CKA score" may actually be executing fundamentally different mathematical operations under the hood (e.g., different kernels, different estimators of statistical dependence, or distance metrics versus correlation scores). Because these differences are buried in repository codebases rather than clearly stated, cross-study comparisons frequently compare apples to oranges without realizing it.

Methods

The authors propose a systematic four-step standardization procedure and release an open-source Python repository (similarity-repository):

  1. Collection: Gathering implementations from published GitHub codebases.
  2. Interface Harmonization: Standardizing data input/output formats (e.g., handling array transpositions and centering).
  3. Compositional Naming: Formulating structured names based on the underlying mathematical components (e.g., cka-kernel_linear-hsic_gretton-score or cka-kernel_rbf_sigma10-hsic_lange-dist_angular).
  4. Consistency Validation: Numerically testing implementations that share the same name on identical data. If two functions named the same yield different outputs, the naming scheme is iteratively refined.

Additionally, the framework automatically derives missing variants where mathematically feasible (such as transforming similarity scores to angular distances via $\arccos$, or deriving RBF kernels via matrix square roots).

Datasets

The authors evaluate their naming conventions and metric variations using synthetic benchmark datasets:

  • Base Datasets ($X$): Gaussian-distributed data matrices of shape $(40, 20)$ (40 samples, 20 features) with exponentially decaying eigenspectra (eigenvalues ranging from 10 down to 0.1).
  • Target Datasets ($Y$): Generated by adding Gaussian noise to $X$ across 10 variance levels (standard deviations from 0 to 10).
  • Evaluations were repeated over 10 independent realizations of $X$, creating a total benchmark set of 100 dataset pairs with varying degrees of ground-truth alignment.

Key Insights and Ideas

  • "CKA" is not a single metric: Across just five popular repositories, CKA splits into at least 12 distinct variations combining different kernels (Linear, RBF), HSIC estimators (Gretton empirical biased, Song unbiased, Lange low-bias), and scoring formats (similarity score vs. angular distance).
  • Variations are not merely rescaled versions of each other: Plotting different variants against one another across the benchmark datasets reveals significant non-linear dispersion. They provide distinct views of representation geometry, meaning conclusions drawn using one variant may not hold with another.
  • The Complexity vs. Consistency trade-off:
  • If a naming scheme is too broad (e.g., calling everything "CKA", or dropping the HSIC estimator tag), consistency error surges because distinct mathematical routines share the same label.
  • If every code implementation gets a unique name, complexity hits maximum (1.0).
  • The proposed compositional scheme finds the sweet spot: minimal naming complexity while driving consistency error to exactly zero.

Key Results

  • Zero Consistency Error: The proposed standardized naming convention achieved an average pairwise mean squared error (MSE) of 0.0 across shared names, whereas removing sub-specifiers ("No kernel", "No hsic", "No scoring") caused substantial consistency errors (MSE up to ~4–6 on synthetic datasets).
  • Mapping Current Repositories: Popular repositories—including representation_similarity (Kornblith et al.), netrep (Williams et al.), repsim (Lange et al.), and platonic (Huh et al.)—only cover small, largely disjoint subsets of available metric configurations. The framework successfully mapped these and expanded their coverage by automatically deriving missing variants.

Limitations and Future Work

  • Derivation Limits: Not all measure variants can be derived through simple input/output transforms (e.g., Song's unbiased HSIC estimator cannot be computed purely from the output of Gretton's biased estimator).
  • Evolving Standards: The authors acknowledge that a fixed naming taxonomy cannot capture future developments. The framework is designed to evolve alongside new estimator discoveries rather than act as a static dogma.
  • Scope: The empirical case study in the paper focuses heavily on Centered Kernel Alignment (CKA), though the broader repository registers roughly 100 similarity measures (such as RSA, Procrustes, and CCA variants).

Summary updated

BibTeX
@inproceedings{cloos2024framework,
  author = {Nathan Cloos and Guangyu Robert Yang and Christopher J Cueva},
  title = {{A Framework for Standardizing Similarity Measures in a Rapidly Evolving Field}},
  booktitle = {UniReps @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=vyRAYoxUuA},
}
Figure