How Not to Stitch Representations to Measure Similarity: Task Loss Matching Versus Direct Matching
András Balogh, Márk Jelasity
Abstract
Measuring the similarity of the internal representations of deep neural networks is an important and challenging problem. Model stitching has been proposed as a possible approach, where two half-networks are connected by mapping the output of the first half-network to the input of the second one. The representations are considered functionally similar if the resulting stitched network achieves good task-specific performance. The mapping is normally created by training an affine stitching layer on the task at hand while freezing the two half-networks, a method called task loss matching. Here, we argue that task loss matching may be very misleading as a similarity index. For example, it can indicate very high similarity between very distant layers, whose representations are known to have different functional properties. Moreover, it can indicate very distant layers to be more similar than architecturally corresponding layers. Even more surprisingly, when comparing layers within the same network, task loss matching often indicates that some layers are more similar to a layer than itself. We argue that the main reason behind these problems is that task loss matching tends to create out-of-distribution representations to improve task-specific performance. We demonstrate that direct matching (when the mapping minimizes the distance between the stitched representations) does not suffer from these problems. We compare task loss matching, direct matching, and well-known similarity indices such as CCA and CKA. We conclude that direct matching strikes a good balance between the structural and functional requirements for a good similarity index.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers4
- KLAS: Using Similarity to Stitch Neural Networks for Improved Accuracy-Efficiency TradeoffsDebopam Sanyal, Anantharaman S. Iyer, Alind Khare, Trisha Jain et al.ICLR 2026 · 2 citations
- Revisiting Model Stitching In the Foundation Model EraZheda Mai, Ke Zhang, Fu-En Wang, Zixiao Ken Wang et al.CVPR 2026 · 2 citations
- Grounding Functional Similarity by Invariance-Aware Model StitchingIoannis Athanasiadis, Anmar Karmush, Michael FelsbergICML 2026 · 1 citation
- Less Is More: Rethinking Parameter-Efficient Fine-Tuning from a Subtractive PerspectiveTianqi Jiang, Liu Yang, Xi-Le Zhao, Zixuan Qin et al.AAAI 2026
Builds on11
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
- Do Vision Transformers See Like Convolutional Neural Networks?Maithra Raghu, Thomas Unterthiner, Simon Kornblith, Chiyuan Zhang et al.NeurIPS 2021 · 1,553 citations
- Your classifier is secretly an energy based model and you should treat it like oneWill Grathwohl, Kuan-Chieh Wang, Jörn-Henrik Jacobsen, David Duvenaud et al.ICLR 2020 · 643 citations
- Similarity and Matching of Neural Network RepresentationsAdrián Csiszárik, Péter Korösi-Szabó, Ákos K. Matszangosz, Gergely Papp et al.NeurIPS 2021 · 105 citations
- Grounding Representation Similarity Through Statistical TestingFrances Ding, Jean-Stanislas Denain, Jacob SteinhardtNeurIPS 2021 · 88 citations
Related papers
- Revisiting Model Stitching to Compare Neural RepresentationsYamini Bansal, Preetum Nakkiran, Boaz BarakNeurIPS 2021 · 253 citations
- On the Functional Similarity of Robust and Non-Robust Neural RepresentationsAndrás Balogh, Márk JelasityICML 2023 · 4 citations
- Bridging Functional and Representational Similarity via Usable InformationAntonio Almudévar, Alfonso OrtegaICML 2026 · 1 citation
- Functional Alignment Can Mislead: Examining Model StitchingDamian Smith, Harvey Mannering, Antonia MarcuICML 2025
- Deconfounded Representation Similarity for Comparison of Neural NetworksTianyu Cui, Yogesh Kumar, Pekka Marttinen, Samuel KaskiNeurIPS 2022 · 27 citations
