Inside-Out: Measuring Generalization in Vision Transformers Through Inner Workings

Yunxiang Peng, Mengmeng Ma, Ziyu Yao, Xi Peng
4/9/2026
cs.LGcs.CV

Official code: deep-real/GenCircuit (5 stars, last commit 2026-03-24).

Abstract

Reliable generalization metrics are fundamental to the evaluation of machine learning models. Especially in high-stakes applications where labeled target data are scarce, evaluation of models' generalization performance under distribution shift is a pressing need. We focus on two practical scenarios: (1) Before deployment, how to select the best model for unlabeled target data? (2) After deployment, how to monitor model performance under distribution shift? The central need in both cases is a reliable and label-free proxy metric. Yet existing proxy metrics, such as model confidence or accuracy-on-the-line, are often unreliable as they only assess model output while ignoring the internal mechanisms that produce them. We address this limitation by introducing a new perspective: using the inner workings of a model, i.e., circuits, as a predictive metric of generalization performance. Leveraging circuit discovery, we extract the causal interactions between internal representations as a circuit, from which we derive two metrics tailored to the two practical scenarios. (1) Before deployment, we introduce Dependency Depth Bias, which measures different models' generalization capability on target data. (2) After deployment, we propose Circuit Shift Score, which predicts a model's generalization under different distribution shifts. Across various tasks, both metrics demonstrate significantly improved correlation with generalization performance, outperforming existing proxies by an average of 13.4\% and 34.1\%, respectively. Our code is available at https://github.com/deep-real/GenCircuit.

View on arXivView PDF

Code Implementations(1)

51Mar 24, 20267 months ago

Similar Papers

Cite this paper

@article{peng2026insideout,
  title  = {Inside-Out: Measuring Generalization in Vision Transformers Through Inner Workings},
  author = {Yunxiang Peng and Mengmeng Ma and Ziyu Yao and Xi Peng},
  year   = {2026},
  eprint = {2604.08192},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2604.08192v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2604.08192.svg)](https://codeofpaper.com/paper/2604.08192)

Discussion