Simple Algorithm
Deep Learning · Emergence · 28 min

Comparing Representations Across Networks

CKA, model stitching and the hypothesis that large models converge on similar representations.

Train one architecture twice from different random seeds and the two networks agree on almost every prediction. Do they compute the same thing inside? Neuron 17 of one has no reason to match neuron 17 of the other, so the question needs measures that ignore arbitrary choices such as permutations, rotations and scale while catching meaningful differences. This lesson builds those measures, from canonical correlations to centered kernel alignment and model stitching, shows where each one misleads, and weighs the bold claim that large models of different data converge on one representation of the world.

What you’ll learn

  • Explain which transformations a representational similarity measure should ignore, and prove that invariance to every invertible linear map makes a measure useless once the width reaches the number of examples.
  • Define CCA, SVCCA and PWCCA, derive linear CKA as a cosine between Gram matrices, and prove its invariances.
  • Compute linear CKA on small examples and explain its sensitivity to high-variance directions and outliers.
  • Use model stitching to compare representations by function rather than geometry.
  • Weigh the evidence for and against the Platonic representation hypothesis and for universality of features.

What a similarity measure should ignore

Feed the same nn inputs to two networks and record a layer of each: X∈Rn×p1X\in\R^{n\times p_1} and Y∈Rn×p2Y\in\R^{n\times p_2}, one row per input, with every column centered. A representational similarity measure s(X,Y)s(X,Y) compares them. Comparing neuron by neuron is hopeless, because many changes to a network leave its function intact:

  • Permutations. Reordering a hidden layer's units, with the matching rows and columns of the weights, changes nothing (permutation symmetry).
  • Rescalings. A ReLU unit's input weights can be multiplied by c>0c>0 and its output weights divided by cc.
  • Invertible linear maps. Where a representation is read only by a linear layer (a residual stream, the input to a linear head), X↦XAX\mapsto XA with W↦A−1WW\mapsto A^{-1}W preserves the function for any invertible AA.

So which invariances should ss have? More is not automatically better.

DerivationProof
  1. XB=[ In  0 ]=YCXB=\big[\,I_n\ \ 0\,\big]=YC

    A rank-nn matrix with nn rows can be column-reduced to [ In  0 ][\,I_n\ \ 0\,]: there are invertible B,C∈Rp×pB,C\in\R^{p\times p} with

  2. s(Y,Z)=s(X (BC−1),Z)=s(X,Z)s(Y,Z)=s\big(X\,(BC^{-1}),Z\big)=s(X,Z)

    So Y=X BC−1Y=X\,BC^{-1}, an invertible linear transformation of XX, and invariance gives

  3. Layers of thousands of units measured on a few thousand inputs are exactly in this regime. A useful measure must give up some invariance; the question is which.

MeasurePermutationOrthogonalIsotropic scalingAny invertible linear map
CCAyesyesyesyes
SVCCAyesyesyesonly if the same subspace is kept
PWCCAyesnoyesno
Linear CKAyesyesyesno
Orthogonal Procrustes distanceyesyesif normalizedno
Neuron-by-neuron correlationnonoyesno
SVCCA first keeps only the top singular directions, and PWCCA weights canonical directions by their overlap with the original neurons; both choices break some invariances (Kornblith et al., 2019). Which column you want depends on how the representation is read downstream.

From canonical correlations to CKA

Canonical correlation analysis finds directions a1,b1\mathbf a_1,\mathbf b_1 maximizing the correlation ρ1\rho_1 between Xa1X\mathbf a_1 and Yb1Y\mathbf b_1, then the best directions uncorrelated with the first, and so on; a summary such as the mean ρˉ\bar\rho is the similarity. CCA is invariant to all invertible linear maps, so it inherits the theorem's problem. SVCCA (Raghu, Gilmer, Yosinski & Sohl-Dickstein, 2017) first keeps only the top singular directions of each layer, enough to explain 99% of the variance, and then runs CCA; it found that networks converge from the bottom up during training, lower layers settling first. PWCCA (Morcos, Raghu & Bengio, 2018) weights each canonical correlation by how much of the representation its direction accounts for, and found that networks that generalize converge to more similar representations than networks that memorize, and that wider networks converge to more similar solutions.

Centered kernel alignment (Kornblith et al., 2019) starts from the Hilbert–Schmidt independence criterion and normalizes it. With linear kernels it becomes

CKA⁡(X,Y)=∥Y⊤X∥F2∥X⊤X∥F ∥Y⊤Y∥F∈[0,1](X,Y column-centered)\operatorname{CKA}(X,Y)=\frac{\norm{Y^\top X}_F^2}{\norm{X^\top X}_F\,\norm{Y^\top Y}_F}\in[0,1]\qquad(X,Y\text{ column-centered})
Linear CKA equals the RV coefficient of classical statistics. Like CCA it compares layers of different widths, but unlike CCA it stays informative when a layer has more units than there are examples.
DerivationCKA compares Gram matrices
  1. ∥Y⊤X∥F2=Tr⁡(X⊤YY⊤X)=Tr⁡(XX⊤ YY⊤)=⟨K,L⟩F\norm{Y^\top X}_F^2=\Tr\big(X^\top YY^\top X\big)=\Tr\big(XX^\top\,YY^\top\big)=\langle K,L\rangle_F

    Let K=XX⊤K=XX^\top and L=YY⊤L=YY^\top be the n×nn\times n Gram matrices: entry (i,j)(i,j) is how similar inputs ii and jj look to each network. Cyclicity of the trace turns the numerator into their inner product:

  2. CKA⁡(X,Y)=⟨K,L⟩F∥K∥F ∥L∥F\operatorname{CKA}(X,Y)=\frac{\langle K,L\rangle_F}{\norm K_F\,\norm L_F}

    X⊤XX^\top X and XX⊤XX^\top share their nonzero eigenvalues, so ∥X⊤X∥F=∥K∥F\norm{X^\top X}_F=\norm{K}_F, and likewise for YY. Linear CKA is therefore the cosine of the angle between the two Gram matrices, the idea behind representational similarity analysis in neuroscience (Kriegeskorte, Mur & Bandettini, 2008):

  3. CKA⁡(cXQ, Y)=CKA⁡(X,Y)for orthogonal Q, c≠0\operatorname{CKA}(cXQ,\,Y)=\operatorname{CKA}(X,Y)\quad\text{for orthogonal }Q,\ c\ne0

    Invariances. For orthogonal QQ, (XQ)(XQ)⊤=XQQ⊤X⊤=K(XQ)(XQ)^\top=XQQ^\top X^\top=K, so KK does not change at all; for c≠0c\ne0, K↦c2KK\mapsto c^2K, which cancels in the cosine. Permutations are orthogonal matrices, so they are covered.

  4. X↦XA:K↦XAA⊤X⊤≠Kunless AA⊤=c2IX\mapsto XA:\qquad K\mapsto XAA^\top X^\top\ne K\quad\text{unless }AA^\top=c^2I

    Non-invariance. An invertible but non-orthogonal AA changes the Gram matrix to XAA⊤X⊤XAA^\top X^\top. Stretching one feature, for instance, changes how much it weighs in every similarity between inputs. In one sense this is the point: CKA measures a representation's geometry, in which high-variance directions dominate.

Kornblith et al.'s sanity check made the case for CKA. Ten convolutional networks were trained on CIFAR-10 from different seeds; for each layer of one network, a good measure should find the same layer of another network as most similar. Linear CKA did so 99.3% of the time; CCA, SVCCA and PWCCA managed between 1.4% and 15.1%. CKA also showed wider networks becoming more similar, and in very deep plain networks it revealed long runs of layers with nearly identical representations, where linear probes stopped improving.

Predict before you look

A representation XX has two uncorrelated features, the first with three times the variance of the second. Another representation YY keeps only the first feature. What is CKA⁡(X,Y)\operatorname{CKA}(X,Y)?

Show the answer

0.95

With X⊤X=diag⁡(3v,v)X^\top X=\diag(3v,v) and Y⊤X=[ 3v  0 ]Y^\top X=[\,3v\ \ 0\,]: CKA⁡=(3v)29v2+v2⋅3v=310≈0.95\operatorname{CKA}=\frac{(3v)^2}{\sqrt{9v^2+v^2}\cdot3v}=\frac3{\sqrt{10}}\approx0.95. A feature carrying a quarter of the variance is simply gone, yet CKA barely moves. Keep only the weaker feature instead and CKA is 1/10≈0.321/\sqrt{10}\approx0.32. CKA mostly reports agreement in the dominant directions.

When similarity measures mislead

The predict above is the general case. Ding, Denain & Steinhardt (2021) asked measures to be sensitive to changes that alter function (accuracy of probes, out-of-distribution performance) and specific, ignoring changes that do not (such as the random seed). CKA failed the sensitivity test: deleting all but the top 10 principal components of a representation could change probe accuracy while CKA hardly registered it. PWCCA failed specificity: differences between random seeds swamped differences between distant layers. The classical orthogonal Procrustes distance, min⁡Q∥X−YQ∥F\min_Q\norm{X-YQ}_F over orthogonal QQ after normalization, balanced the two best in their tests.

Davari et al. (2023) analyzed CKA's known sensitivity to outliers: a handful of inputs with large activations can dominate the Gram matrices, and they showed that CKA values can be changed substantially without much change in what the networks compute. Williams, Kunz, Kornblith & Linderman (2021) pointed out a further gap: CKA and CCA are not metrics, so similarities need not compose (if AA is like BB and BB like CC, nothing forces AA to be like CC), and they built shape metrics from Procrustes-type alignments that satisfy the triangle inequality.

Check your understanding

Two layers from different networks have linear CKA 0.950.95 on 5,000 test images. Which conclusion is safe?

  1. The layers compute the same function, so either network's upper layers will work on top of the other's lower layers
  2. Their dominant high-variance directions induce nearly the same similarities between inputs; low-variance directions, which may still matter for the task, could differ
  3. The two layers are equal up to an invertible linear map
  4. The networks must have been trained from the same initialization
Show the answer

B. Their dominant high-variance directions induce nearly the same similarities between inputs; low-variance directions, which may still matter for the task, could differ

CKA is a cosine between Gram matrices dominated by the largest-variance directions, as the 0.950.95 for a representation missing a whole feature showed. Whether one network's layers can actually use the other's representation is a functional question, which stitching tests directly.

Similarity as function: model stitching

Geometry-based measures ask whether two representations look alike. Model stitching asks whether one can do the job of the other. Lenc & Vedaldi (2015) took the layers of network A up to some depth, the layers of network B from that depth on, and trained only a small linear "stitching" layer between them. If the stitched network performs nearly as well as B, then A's representation contains what B's upper layers need, up to a linear map.

Bansal, Nakkiran & Barak (2021) turned this into a measuring instrument, with the loss increase of the stitched model as a "stitching penalty". Three findings stand out. Minima found by SGD from different seeds are typically stitching-connected: they can be stitched at many depths with little penalty, a property the authors liken to mode connectivity. More is better: representations learned with more data, greater width or longer training can be plugged into weaker models and improve them. And good networks of the same architecture trained in very different ways, supervised versus self-supervised, can be stitched to each other without a drop in performance. They argue that stitching reveals aspects of representations that CKA cannot.

python
import torch.nn as nn

class Stitched(nn.Module):
    # Bottom of network A, a trainable 1x1 convolution, top of network B
    def __init__(self, bottom_a, top_b, channels_a, channels_b):
        super().__init__()
        self.bottom, self.top = bottom_a, top_b
        for p in list(bottom_a.parameters()) + list(top_b.parameters()):
            p.requires_grad_(False)                    # both halves stay frozen
        self.stitch = nn.Conv2d(channels_a, channels_b, kernel_size=1)

    def forward(self, x):
        return self.top(self.stitch(self.bottom(x)))

Train only stitch on the task loss and compare the result with network B alone; keep the frozen halves' batch-normalization statistics fixed as well. The stitching layer must stay weak, a linear map at most, or it could solve part of the task itself and hide a real mismatch.

Think first Stitching A's bottom into B's top works with almost no penalty. Does stitching B's bottom into A's top have to work too?

No. Stitching tests whether A's representation contains what B's upper layers read out, through a linear map. A richer representation can serve a poorer one's head, but not necessarily the other way round, which is exactly the asymmetry behind "more is better". CKA and CCA are symmetric by construction; a functional test need not be, and the asymmetry is informative.

Do all models converge?

Within one architecture the evidence is mixed. Li, Yosinski, Clune, Lipson & Hopcroft (2016) matched units across networks trained from different seeds and found some features learned reliably, one to one, others matching only as small subspaces, and some unique to one network. Interpretability researchers proposed universality, the speculation that analogous features and circuits form across models and tasks (Olah et al., 2020). Measured strictly it is partial: in GPT-2 models trained from five seeds, only about 1–5% of neurons had a reliably matching neuron in the other runs (Gurnee et al., 2024); networks trained on group operations learned the same family of algorithms, but which internal representations they used varied from seed to seed (Chughtai, Chan & Nanda, 2023).

Across architectures, data and even modalities, Huh, Cheung, Wang & Isola (2024) went further with the Platonic representation hypothesis: as models grow and are trained on more tasks and data, their representations converge toward a shared statistical model of the reality that generates the data. Their main instrument compares neighborhoods. For paired inputs (an image and its caption, say) with representations ϕi\phi_i and ψi\psi_i in two models, let S(ϕi)\mathcal S(\phi_i) be the indices of the kk nearest neighbors of ϕi\phi_i among the samples, and average the overlap:

mNN=1n∑i=1n1k ∣S(ϕi)∩S(ψi)∣∈[0,1],k=10m_{\text{NN}}=\frac1n\sum_{i=1}^n\frac1k\,\big\lvert\mathcal S(\phi_i)\cap\mathcal S(\psi_i)\big\rvert\in[0,1],\qquad k=10
Mutual nearest-neighbor alignment: 11 if both models put the same kk samples nearest to every sample. It uses only the order of distances inside each model, so the two spaces need not have the same dimension.

The evidence. Among 78 vision models scored on a transfer benchmark (VTAB), the strong ones had tightly aligned representations while weak ones varied, which the authors summarize as "all strong models are alike, each weak model is weak in its own way". Comparing language models with vision models on images and their Wikipedia captions, alignment rose roughly linearly with the language model's quality. They suggest three pressures toward convergence (task generality, model capacity and the simplicity bias of deep networks), and show that in an idealized world where observations are bijective functions of the underlying events, contrastive learners converge to a kernel given by pointwise mutual information.

The caveats. The cross-modal alignments stayed below about 0.20.2 (about 0.160.16 against DINOv2) on a scale whose maximum is 11, and the authors list their own limitations: modalities carry different information, the bijective idealization rarely holds, some fields show no convergence yet, and how to measure alignment is contested. Later work presses on the measurement. Gröger, Wen & Brbić (2026) argue that the similarity scores are inflated by model scale; after calibrating against a permutation null, convergence in global measures such as CKA largely disappears, while agreement on local neighborhoods survives, so they propose that models converge on shared local neighborhood relations instead (an "Aristotelian" hypothesis). Koepke, Zverev, Ginosar & Efros (2026, preprint) find that mutual nearest-neighbor alignment measured on about a thousand pairs degrades at the scale of millions unless kk grows with the data, that gains from stronger language models level off in recent models, and that one-to-one image–caption pairing inflates the scores. Their reading: shared coarse structure, without evidence of convergence to a single representation.

Key takeaways

  • A representational similarity measure must choose its invariances. Invariance to every invertible linear map, as in CCA, makes all full-rank representations identical once the width reaches the number of inputs.
  • Linear CKA, ∥Y⊤X∥F2/(∥X⊤X∥F∥Y⊤Y∥F)\norm{Y^\top X}_F^2/(\norm{X^\top X}_F\norm{Y^\top Y}_F), is the cosine between centered Gram matrices: invariant to orthogonal maps and isotropic scaling, good at matching layers across seeds, but dominated by high-variance directions and sensitive to outliers.
  • Measures disagree, so ground them in function (probes, out-of-distribution behavior) and consider alternatives such as Procrustes distances and shape metrics that satisfy the triangle inequality.
  • Model stitching tests whether one network's representation can drive another's upper layers through a linear map; SGD minima are typically stitching-connected, and better representations improve weaker models.
  • Convergence across models is partial: few neurons are universal across seeds, and the Platonic representation hypothesis rests on rising but low alignment scores whose measurement is contested.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

You compare layers of 2,048 units, measured on 1,000 test images, with mean CCA. Every pair of networks you try, including two untrained ones, scores (almost exactly) 11. What is going on?

  1. All networks of this architecture compute the same representation
  2. CCA is invariant to all invertible linear maps, and with more units than images every full-rank representation is such a map of any other
  3. The images are too easy, so every network represents them perfectly
  4. CCA saturates whenever the networks share an architecture
Show the answer

B. CCA is invariant to all invertible linear maps, and with more units than images every full-rank representation is such a map of any other

With width p≥np\ge n, the column spaces of XX and YY generically coincide (all of Rn\R^n, or all centered vectors once the columns are centered), so CCA finds perfectly correlated directions for any pair, trained or not. This is the theorem of the first step; use more inputs than units, reduce dimension first (SVCCA), or use a measure such as CKA.

Question 2

Which change to the representation XX can change its linear CKA with a fixed representation YY?

  1. Permuting the neurons of the layer
  2. Multiplying every activation by 10
  3. Multiplying one feature by 3 and leaving the others alone
  4. Rotating the representation by an orthogonal matrix
Show the answer

C. Multiplying one feature by 3 and leaving the others alone

Linear CKA is the cosine between centered Gram matrices, and X↦XQX\mapsto XQ (orthogonal) and X↦cXX\mapsto cX leave that cosine unchanged. Stretching one feature changes XX⊤XX^\top non-uniformly. For example, if XX has uncorrelated features with variances 33 and 11, tripling the second gives CKA⁡=0.6\operatorname{CKA}=0.6 with the original.

Question 3

A linear stitching layer joins the lower half of a self-supervised network to the upper half of a supervised network of the same architecture, with almost no loss of accuracy. What does this show?

  1. The two networks' lower halves have identical weights
  2. The two representations have CKA close to 11
  3. The stitch would work equally well in the other direction
  4. The self-supervised representation contains, up to a linear map, what the supervised network's upper layers need
Show the answer

D. The self-supervised representation contains, up to a linear map, what the supervised network's upper layers need

Stitching is a functional test of compatibility through a weak map. It does not imply equal weights or high CKA, and it is directional: a richer representation can serve a poorer head without the converse holding. Bansal et al. found exactly such cross-method stitches between good supervised and self-supervised networks.

Question 4

Mutual nearest-neighbor alignment between language and vision models rises as language models improve, but the values stay below about 0.20.2 out of 11. Which reading is most defensible as of the mid-2020s?

  1. The models share some neighborhood structure, increasingly so with scale; whether they converge on one representation is an open, contested hypothesis
  2. Language and vision models have already converged on the same representation
  3. The rise is meaningless, since alignment below 0.50.5 is noise
  4. Alignment is high only because the two models were trained on the same data
Show the answer

A. The models share some neighborhood structure, increasingly so with scale; whether they converge on one representation is an open, contested hypothesis

The trend is real in the measured setting, but the absolute values are low, the metric depends on sample size and kk, and calibrated re-analyses find that global convergence largely disappears while local neighborhood agreement remains. "Converging toward a shared representation" is a hypothesis, not a finding.

Further reading

  • S. Kornblith, M. Norouzi, H. Lee & G. Hinton, "Similarity of neural network representations revisited," ICML (2019).
  • M. Raghu, J. Gilmer, J. Yosinski & J. Sohl-Dickstein, "SVCCA: singular vector canonical correlation analysis for deep learning dynamics and interpretability," NeurIPS (2017).
  • Y. Bansal, P. Nakkiran & B. Barak, "Revisiting model stitching to compare neural representations," NeurIPS (2021).
  • M. Huh, B. Cheung, T. Wang & P. Isola, "Position: The Platonic representation hypothesis," ICML (2024).
  • M. Klabunde, T. Schumacher, M. Strohmaier & F. Lemmerich, "Similarity of neural network models: a survey of functional and representational measures," ACM Computing Surveys 57(9) (2025).