ConceptioArchivearXiv CS
arXiv CSopen access

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

Unknown · 2026 · arxiv_cs
arXiv CS · Papers · License: Open Access · 2026
Open Source ↗Direct PDF ↓
machine learning, deep learning, neural networks

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

Mengmeng Ma1

University of Delaware

2

Ziyu Yao2

Xi Peng1

George Mason University After Deployment

Before Deployment

How to monitor performance?

How to select model?

1. Introduction Metrics are fundamental for model evaluation, quantifying how well model predictions agree with ground-truth labels [32, 66]. However, real-world deployment introduces a key challenge: while raw data are abundant, expertvalidated labels are scarce and costly [24, 42, 72]. As a

M2

M3

Time

Target Dataset (unlabeled)

M1

M2

Future possible distribution shifts (unlabeled)

M3

Data Distribution

Model

A. Existing Metrics (measure model output) Underspecification

Model Confidence OOD Accuracy

Accuracy-on-the-line

ID Accuracy

Overconfident

Average Confidence

B. Our Metrics (measure model inner workings) Dependency Depth Bias

Circuit Shift Score OOD Accuracy

Reliable generalization metrics are fundamental to the evaluation of machine learning models. Especially in highstakes 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.

Performance M1

OOD Accuracy

Abstract

OOD Accuracy

arXiv:2604.08192v1 [cs.LG] 9 Apr 2026

{yxpengcs,mengma,xipeng}@udel.edu, [email protected]

Dependency Depth Bias

1 − Circuit Shift Score

Figure 1. We address two key challenges: (1) Before deployment, how to select models? (2) After deployment, how to monitor performance under distribution shifts? Existing metrics exhibit underspecification and overconfidence issues. Our metrics, based on models’ inner workings, mitigate these issues, yielding significantly stronger correlations with generalization performance.

result, standard metrics become difficult to compute, limiting their ability to assess model reliability under distribution shift [78]. This limitation creates challenges throughout the model lifecycle (Figure 1). Before deployment, practitioners cannot easily determine which model will perform best on local data, because local evaluation requires expensive expert annotation [33, 35, 41], while benchmark performance does not guaranty robustness to unseen dis-

Before Deployment: Deep connections (instead of shallow shortcuts) predict strong generalization Model A: "Weak Generalization"

Model B: "Moderate Generalization" output

output MLP : MLP layer MLP6-11

3.1

MLP5 MLP4

L1.H9

L1.H8

L1.H7

L1.H1

input embed

L12.H4

MLP9 L7.H2

MLP2 MLP1 L1.H11

L12.H5

MLP7

OOD Acc.

L1.H10

OOD Acc.

MLP1

L12.H6 MLP11

MLP3

Depen. Dep. Bias

OOD Acc.

MLP2 L2.H10

L12.H7

MLP4

32.3%

L2.H10

L12.H10

MLP6-9

L1.H10

input embed

MLP4

Depen. Dep. Bias

1.6 Depen. Dep. Bias

output

MLP11

L .H : Attention head of layer

16.8%

Model C: "Strong Generalization"

86.8% 4.8

L3.H2

L5.H9

L3.H1

MLP2

input embed

Model Generalization Capability Distribution Shift

Model D under ID data

Model D under small distribution shift

output

output 83.1%

MLP11 L11.H6

L11.H5

L11.H10

L11.H6

MLP10

input embed

L2.H2

OOD Acc.

MLP2 L2.H0

Cir. Sh. Score

0.26

MLP4

MLP11 L11.H6

L11.H3

MLP9 MLP7

MLP4 MLP2 L2.H0

input embed

MLP8 MLP4

MLP3

MLP1

L11.H5 MLP10

56.7%

MLP8

MLP7

MLP3

output

0.38

MLP9 MLP8

MLP7

ID Acc.

L11.H3

MLP10

MLP9

MLP1

L11.H5

L2.H2

L2.H6

Cir. Sh. Score

L11.H10

MLP11

Model D under large distribution shift : New edges or nodes : Removed edges or nodes L11.H10

OOD Acc.

96.8%

MLP3 MLP2 MLP1

L2.H1

L2.H8

L2.H6

input embed

After Deployment: Circuit preserves inter-layer topology but exhibit increasing rewiring under larger distribution shift Figure 2. Our observations from visualizing the circuits in the pre- and post-deployment scenarios. The circuits are obtained via Eq. 1 and visualized by retaining the top-100 edges, following the same pruning procedure as in Hanna et al. [27]. Top: Before Deployment, we observe that models with strong OOD generalization exhibit more deep layer pathways (∇-like shape), while weak models rely on shallow, shortcut connections (∆-like shape). Bottom: After Deployment, we observe that as distribution shifts, a model’s circuit retains overall structure but undergoes intensified rewiring dynamics, with new (red) or removed (blue) edges and nodes.

Previous works have explored proxy metrics based on external behavior. On the one hand, the accuracy-on-theline observation [49] suggests that in-distribution (ID) accuracy often correlates with out-of-distribution (OOD) accuracy. However, the underspecification phenomenon [11, 73] shows that multiple models can achieve nearly identical ID accuracy yet have vastly different OOD accuracy. On the other hand, Confidence-based proxies [19, 25, 29] often suffer from overconfident issue, assigning high probabilities to incorrect predictions [21, 46]. Hence, external behaviors alone cannot reliably measure generalization.

(Figure 2, Top), circuits exhibit different inter-layer topologies across models, revealing a consistent structural pattern, which we call the Generalization Motif. After Deployment (Figure 2, Bottom), the circuit’s inter-layer topology remains stable across distribution shifts, with increasing edge rewiring relative to the ID baseline. Building on these key findings, we introduce two circuit-based metrics. For pre-deployment model selection, we propose Dependency Depth Bias (DDB), which quantifies a model’s relative dependency on deep vs. shallow features. For postdeployment performance monitoring, we introduce Circuit Shift Score (CSS), which measures deviations between the model’s circuit and its ID baseline. Across various datasets, DDB and CSS improve the correlation with OOD performance by 13.4% and 34.1%, respectively. Furthermore, with a calibrated threshold, CSS enables early detection of silent failures, achieving a ∼45% gain in detection F1.

We therefore ask whether a model’s internal mechanisms offer stronger signals of generalization. Drawing on mechanistic interpretability (MI) [5, 58], specifically circuit discovery [71], we reverse-engineer the computational pathways of models with different generalization capability and identify two key phenomena. Before Deployment

Our contribution includes: (1) A new perspective for evaluating generalization: leveraging model’s internal mechanism as predictive metrics. (2) Two principled circuit metrics tailored for model selection and performance monitoring. (3) Empirical results in a wide range of benchmark datasets and tasks demonstrate the superior predictive

tributions [12, 55]. After deployment, performance is difficult to monitor on a continuous stream of new, unlabeled data, leaving models vulnerable to “silent failures” in which accuracy degrades without warning [23, 56, 57]. A critical question arises: Can we evaluate model generalization when ground-truth labels are scarce or even unavailable?

power of our metrics.

2. Preliminary: Circuit Discovery in Vision Transformers In this section, we first formally define the computational graph of a Vision Transformer (ViT), followed by the definition of circuits, and finally describe the circuit discovery method adopted in this work. The computational graph of ViT. ViT processes information through a sequence of self-attention and MultiLayer Perceptron (MLP) layers, which operate on the residual stream of the transformer model [15]. We represent ViT’s computations as a directed graph, G = (V, E). To enable fine-grained analysis, following Conmy et al. [9], we define the graph at a sub-layer level of granularity. The vertex set V consists of fundamental computational units, where an MLP layer is a single node, and an attention layer is decomposed into its parallel heads, with each head representing a node. The edge set E contains directed edges (j → i) if the output of node j is a direct input to the computation performed by node i. Circuit definition. In MI, a circuit is typically defined as a subgraph of the model’s full computational graph [6, 47, 71], obtained by assigning binary indicators to its edges, E → {0, 1}. While such a binary formulation facilitates interpretability, it discards fine-grained information that is critical for evaluating generalization. To preserve richer structural information, we adopt a continuous relaxation and define circuits as follows: Definition 1 (Circuit as edge weight mapping). Given a model M with computational graph G = (V, E), a data distribution DX , we define a circuit of M on DX as a weighting function c : e → R such that for each edge e ∈ E,   cM (1) DX (e) := E(x)∼DX KL M\{e} (x), M(x) , where M\{e} denotes M after ablating edge e, and KL(·) denotes the Kullback–Leibler divergence. This definition is particularly suitable for our setting, as it operates without the need for labeled data. A high value of c(e) indicates that the edge is critical for maintaining the model’s normal behavior. The ablation operation, M\{e} , requires a method to “remove” an edge’s contribution. In language models, a common technique is interchange ablation [47], where activations are replaced with those from a different, corrupted input. This approach is less suitable for vision tasks, as generating semantically meaningful “corrupted” images is non-trivial. Therefore, we adopt meanablation [71], in which the contribution of an edge is neutralized by replacing its corresponding activations with their pre-computed mean, averaged over Dx . Circuits discovery. Existing circuit discovery methods were designed to trade off between faithfulness and computational efficiency. For instance, Causal Tracing [47]

is highly faithful but computationally inefficient for large models, while methods like EAP [71] and EAP-IG [27] offer efficient approximations. This raises the practical question of which tool offers the best balance of these properties for vision transformers. To answer this, we conducted a benchmark comparing these methods (see Appendix G). The result shows that EAP-IG achieves a compelling balance of high faithfulness and efficiency, we therefore adopt it as the primary circuit discovery method in this work.

3. Before Deployment: Evaluating Generalization Through Circuit Metrics In this section, we formalize the pre-deployment model selection problem, introduce our evaluation metrics derived from the model’s circuit structure, then validate their predictive power through large-scale experiments.

3.1. Problem Formulation Consider a generalization task T composed of a labeled ID training set Dtr = {xj , yj }W j=1 and an OOD test set DOOD = {xj , yj }H , where x j and yj denote the input j=1 image and ground-truth (GT) label. Assume we have a collection of N ViTs Z = {Mi }N i=1 , all trained on Dtr . We call Z a model zoo. Then an evaluation metric (e.g., accuracy or F1 score) is employed to evaluate the GT performance p(Mi , DOOD ) of each model Mi on DOOD . Definition 2 (Pre-deployment Model Selection). Given a model zoo Z and unlabeled DOOD , our goal is to find the best-performing model M∗ on DOOD . We achieve this goal by designing evaluation metrics that do not require target labels. Ideally, these metrics should strongly correlate with GT performance, allowing us to rank and select models using only these metrics.

3.2. Method As shown in Figure 2, circuits display a consistent layerwise topology aligned with model generalization, motivating a layer-level analysis. Inter-layer dependency matrix. Given the circuit weight mapping c(e) from Eq. 1, we aggregate edge weights into an inter-layer dependency matrix (IDM): X Λij = c(e) (2) e: s(e)=i, t(e)=j

where s(e) and t(e) denotes source layer and target layer of the edge e respectively. Λij quantifies the total dependence of target layer j on source layer i. For each generalization task T , we construct the circuit feature matrix ΛT = 2 [ flat(Λ(M1 )), . . . , flat(Λ(MN )) ]⊤ ∈ RN ×L and the GT performance vector pT = [ p(M1 ), . . . , p(MN ) ]⊤ ∈ RN ×1 , for all Mi ∈ Z, flat(·) is the flattening operator, and L denotes the number of layers in the models.

Pro-generalization Connections output L12.H10

L12.H7

L12.H6

L12.H5

L12.H4

MLP11

Source Layer

MLP9

output MLP9 MLP2 MLP1 L1.H10

L1.H9

L1.H8

L1.H7

L1.H1

input embed

Anti-generalization Connections

Target Layer

Figure 3. CCA reveals the Universal Generalization Motif predeployment. Left. Universal Generalization Motif obtained by normalizing and averaging vT (Eq.3) over all generalization tasks. Brighter regions indicate the inter-layer dependencies positively correlated with generalization; darker regions indicate negative correlations. Right. The resulting motif highlights the anti and pro-generalization connections shared across tasks.

Discovering generalization motif. To identify circuit structures that correlate with GT performance, we perform Canonical Correlation Analysis (CCA) [31]: vT = arg max corr(ΛT v, pT ) v

(3)

where corr(·, ·) denotes the Pearson correlation coefficient. The resulting canonical direction vT identifies a lowdimensional circuit subspace that is maximally correlated with generalization performance for task T , which we term the Generalization Motif (GM). Each entry in vT denotes the correlation between the corresponding IDM entry and GT performance. We visualize all GMs in Appendix J. Universal generalization motif. To obtain the Universal Generalization Motif across all tasks, we normalize and average vT across all tasks, as visualized in Figure 3. The Universal Generalization Motif shows a clear trend in how edges connecting different layers correlate with the GT performance. The edges from deep layers (rows ≥6) shows mostly strong positive correlation, while the edges from shallow layers (rows 1-4) mostly show negative correlations. This contrast is especially profound for edges that are targeted at the output (last column). Importantly, this analysis is only qualitative rather than predictive, since the canonical directions are high-dimensional and prone to overfitting to task-specific variations. We next introduce our quantitative metrics to measure generalization. Circuit metric design. Let L = {I, 1, 2, . . . , L, O} index the layers in the circuit, ordered from shallow to deep. I denotes the input node and O denotes the output node. For a fixed ratio parameter τ ∈ (0, 0.5], k(τ ) = max{1, ⌊τ L⌋}, we define the shallow and deep sets: Llow (τ ) = {1, . . . , k(τ )}, Lhigh (τ ) = {L − k(τ ) + 1, . . . , L, O}.

Definition 3 (Dependency Depth Bias). For a set of target layers J, the Dependency Depth Bias (DDB) measures their relative dependency on deep versus shallow source layers: ! P i∈Lhigh (τ ),j∈J,Λij ̸=0 Λij DDB(J) (Λ, τ ) = log P . (4) i∈Llow (τ ),j∈J,Λij ̸=0 Λij Following the Universal Generalization Motif, we instantiate three variants of DDB by choosing different targetlayer sets J: (1) DDBglobal = DDB(L) . (2) DDBdeep = DDB(Lhigh (τ )) . (3) DDBout = DDB({O}) .

3.3. Experimental Setup Datasets. We evaluate our method on three multi-domain datasets, where each “domain” represents a distinct datagenerating distribution: PACS [38] with four stylistic domains (Photo, Art Painting, Cartoon, and Sketch); Camelyon17 [34], a medical histopathology dataset where the ID and OOD domains are split with hospitals of origin; and Terra Incognita [4] with four domains corresponding to different physical camera trap locations. To construct generalization tasks, we train the model on one domain and test on all other domains in the same dataset, yielding 12, 2, and 12 generalization tasks, respectively. Model zoo construction. Each zoo includes 72 to 144 ViTs trained from scratch or finetuned from five pretrained checkpoints under diverse hyperparameter settings. Details are available in Appendix B. Baselines. We compare our circuit metrics against baselines from three categories: (1) ID-based Metrics that analyze the model on source data (i.e., ID Accuracy [49] and Sharpness [3]); (2) OOD-based Metrics that analyze output probability distribution on target data (i.e., Average Confidence [29], Average Negative Entropy (ANE) [29] and Meta-Distribution Energy (MDE) [54]); or analyze feature quality on target data (i.e., RANKME [20] and α-ReQ [2]); and (3) ID vs. OOD Comparison Metrics (ATC [19]). Evaluation protocol. We quantify each metric’s predictive power by its correlation with true OOD performance, measured by Accuracy for PACS and Camelyon17, and by Macro F1 for the class-imbalanced Terra Incognita. We report the strength of this correlation using three standard measures: the coefficient of determination (R2 score), Spearman’s Rank Correlation Coefficient (SRCC), and Kendall Rank Correlation Coefficient (KRCC).

3.4. Results and Discussion Correlation with GT performance: DDB vs. baselines. Table 1 reports the correlation between all metrics and GT performance across three datasets. Our proposed circuit metrics consistently achieve the highest correlation in all datasets. Among circuit metrics, DDBout has the best overall correlation score (0.766) and the smallest SEM (0.029),

Table 1. Correlation strength (R2 , SRCC, and KRCC) for pre-deployment model selection. Experiments are conducted on PACS, Camelyon17, and Terra Incognita with results averaged over all available generalization tasks. The final column reports the mean score and the standard error of the mean (SEM↓). The best results are bolded. Our DDB metrics consistently outperform all baselines across datasets. PACS (Style Shift)

Method 2

SRCC

ID Accuracy [49] Sharpness [3]

0.765 0.048

AC [29] ANE [29] MDE [54] RANKME [20] α-ReQ [2]

Camelyon17 (Institution Shift)

KRCC

2

R

SRCC

0.878 0.075

0.720 0.037

0.423 0.097

0.646 0.608 0.345 0.379 0.495

0.755 0.728 0.650 0.386 0.641

0.582 0.554 0.478 0.266 0.474

ATC [19]

0.555

0.720

DDBglobal (Ours) DDBdeep (Ours) DDBout (Ours)

0.913 0.891 0.862

0.921 0.908 0.897

R

OOD acc DDBout

Terra Incognita (Geographic Shift)

Average

KRCC

2

R

SRCC

KRCC

0.650 0.204

0.480 0.146

0.537 0.361

0.711 0.576

0.528 0.408

0.632±0.047 0.217±0.060

0.535 0.568 0.347 0.089 0.299

0.793 0.781 0.717 0.225 0.275

0.620 0.603 0.502 0.169 0.200

0.367 0.378 0.371 0.163 0.261

0.563 0.590 0.726 0.467 0.484

0.408 0.425 0.541 0.311 0.334

0.585±0.044 0.582±0.040 0.520±0.048 0.273±0.039 0.385±0.045

0.574

0.588

0.802

0.628

0.199

0.358

0.257

0.520±0.065

0.783 0.767 0.731

0.477 0.693 0.748

0.626 0.860 0.820

0.461 0.674 0.646

0.684 0.650 0.714

0.813 0.788 0.838

0.613 0.592 0.642

0.699±0.054 0.758±0.035 0.766±0.029

Table 2. Ablation on DDBout ’s hyperparameter τ . The results consistently show that τ = 0.3 yields the strongest correlation.

Strong Generalization Weak Generalization

1.0

τ

Score 3

0.6

2

0.4

1

0.2

0

DDBout

OOD Accuracy

4 0.8

2

R SRCC KRCC

0.1

0.2

0.3

0.4

0.5

0.744 0.743 0.562

0.772 0.843 0.653

0.798 0.862 0.684

0.801 0.849 0.671

0.772 0.838 0.673

−1

0.0 0

50

100

150

200

Training Steps

Figure 4. The training dynamics of OOD accuracy (left y-axis) vs. our DDBout (right y-axis) on PACS. The plot compares two models: one demonstrating strong generalization (orange line) and the other exhibiting weak generalization (blue line). The strong alignment in the trajectories demonstrates that DDBout ’s dynamic serves as a reliable predictor of a model’s generalization capability throughout the training process.

indicating that the most reliable signal comes from the edges targeted at the output. DDBdeep , which measures the strength of deep-to-deep connectivity, also achieves strong performance across datasets, suggesting that generalization depends on rich information flow among deeper layers. In contrast, DDBglobal shows high correlation in PACS but deteriorates in Camelyon17, reflecting the sensitivity to dataset-specific structural patterns. The scatter plots are available in Appendix F. These results reveal a strong link between a model’s

inter-layer structure and its generalization capability: models that rely more on deep, high-level features exhibit greater robustness to distribution shifts. This aligns with the established view that deep networks learn hierarchical representations, where deep layers encode more abstract and domain-invariant semantics [77, 80], while shallow layers capture spurious, domain-specific cues [22]. DDB measures generalization in training dynamics. To further examine whether DDB also reflect the training dynamic of generalization, we compared the training dynamic of the best and worst-generalizing models from the PACS dataset in Figure 4. We show the training dynamics for the other two datasets in Appendix H. The results show a remarkable alignment between the GT OOD performance dynamic and DDB metric dynamic. For models that generalize, DDBout increases (from 2.6 to 4.1) in tandem with the OOD accuracy (from 0.19 to 0.83), reflecting increasing reliance on deep features. In contrast, non-generalizing models exhibit stagnant or declining DDBout (around -0.9) alongside persistently low OOD accuracy (around 0.19), indicating reliance on spurious shallow features. Ablation on τ . We vary τ ∈ {0.1, 0.2, 0.3, 0.4, 0.5} and

4. After Deployment: Monitoring Performance Degradation via Circuit Shift In this section, we first provide a formal definition of the performance monitoring problem and introduce our Circuit Shift Score. We then present a comprehensive experimental validation of their effectiveness in detecting significant performance drops.

PACS Motif

FMoW Motif

Source Layer

evaluate its impact on DDBout ’s correlation with OOD performance, averaged across the three datasets. As shown in Table 2, τ = 0.3 yields the best performance. Ablations for the other two variants are provided in Appendix I.

Target Layer

Figure 5. Generalization Motifs post-deployment shows contradictory patterns. Left. The GM on PACS, most inter-layer dependencies are positively correlated with performance. Right. The GM on FMoW shows mostly negative correlation. Inter-layer topology no longer provides a consistent signal of generalization.

4.1. Problem Formulation After deployment, a model M trained on an ID dataset Dtr ∼ PID will inevitably encounter data from shifted distributions P1 , . . . , PN , forming an unlabeled test set zoo Z ′ = {Di }N i=1 , where Di ∼ Pi and Pi ̸= PID . We assume access to a circuit cM DID extracted from the ID domain, which could be provided by the model provider. Given a predefined critical performance score δ, the goal of the postdeployment monitoring task T ′ (M, Z ′ ) is to raise alarm whenever M performance p(M, Di ) falls below δ. Formally, we formulate this as a binary classification problem. ( y(M, Di ) =

1,

p(M, Di ) < δ

(alarming),

0,

p(M, Di ) ≥ δ

(non-alarming),

(5)

Since GT labels are unavailable post-deployment, we must instead rely on a proxy metric m(M, Di ) and a metric threshold δ ′ such that m(M, Di ) < δ ′ ⇒ p(M, Di ) < δ.

(6)

This introduces two fundamental challenges: (1) identifying label-free proxy metrics that reliably correlates with performance degradation under distribution shift, and (2) calibrating, for each new task, an appropriate threshold δ ′ such that Eq. 6 holds, without access to test labels.

4.2. Method Relative rewiring, rather than inter-layer topology, measures GT performance. Before Deployment, circuits across models differ in their layerwise topology. After Deployment, however, we are comparing circuits from a fixed model. As shown in Figure 2 (bottom), the circuit exhibit consistent inter-layer topology but accumulating rewiring relative to the ID baseline as distribution shift increases. To assess whether layerwise topology still measures generalization, we apply CCA to the inter-layer dependency matrices ΛT ′ = [, flat(Λ(D1 )), . . . , flat(Λ(DN )), ]⊤ across Z ′ (following Sec. 3.2). The resulting Generalization Motifs

(Figure 5) show contradictory patterns across datasets, confirming that inter-layer topology no longer provides a consistent signal of generalization. These findings suggest that fine-grained deviations from a reference circuit could be a more suitable measurement for the post-deployment setting. Circuit metric design. Let R : c → S denote a circuit representation function that maps a circuit to a structured space S, which is equipped with a distance functional d : S × S → R≥0 . Definition 4 (Circuit Shift Score). For any test distribution Di , we define the Circuit Shift Score (CSS) as:  M CSS(R,d) (M, Di ) = d R(cM (7) DID ), R(cDi ) , Depending on the choice of R and d, we consider two main categories: (1) Vector-based CSS(v,·) . R = v : c → R|E| outputs a circuit edge weight vector. The function d is instantiated as standard distance functions, including ℓ2 distance, cosine dissimilarity, or SRCC (rank correlation). (2) Graph-based CSS(g,·) . R = g : c → SG outputs a weighted computation graph (V, E, c(e)), and d measures topological or spectral dissimilarity between graphs, instantiated as Laplacian spectral distance [68], NetLSD distance [67], or Jaccard edge-set dissimilarity between pruned subgraph with top-k edges. Both forms quantify how much the circuit under test data deviates from the ID baseline, in either vector or graph space. See details in Appendix D. Threshold calibration. An effective alarm system requires a calibrated metric threshold (δ ′ ). To fill this need, we propose a calibration strategy based on surrogate data. Concretely, we construct a set of corrupted ID validation sets using common corruptions from CIFAR10-C [28] as well as multiple stylization transformations to simulate distribution shift. This procedure yields 39 corrupted domains, each with known GT performance (Details in Appendix E). We then calibrate the CSS threshold by identifying the corrupted domain whose performance is closest to the desired threshold δ. The corresponding CSS value evaluated in this domain is adopted as the threshold δ ′ .

Table 3. Correlation strength (R2 , SRCC, and KRCC) for post-deployment performance monitoring. We bold the best results. Our proposed CSS metric consistently achieves the strongest correlation across all datasets. PACS (Style Shift)

Method R2

SRCC

AC [29] ANE [29] MDE [54] RANKME [20] α-ReQ [2]

0.031 0.105 0.002 0.100 0.325

ATC [19] CSS(v,cosine) CSS(v,ℓ2 ) CSS(v,SRCC) CSS(g,Laplacian) CSS(g,NetLSD) CSS(g,Jaccard)

FMoW (Temporal Shift)

KRCC

R2

SRCC

0.117 0.200 0.217 0.600 0.650

0.111 0.222 0.222 0.500 0.500

0.314 0.315 0.428 0.322 0.306

0.645

0.617

0.444

0.339 0.028 0.912 0.383 0.092 0.759

0.450 0.500 0.983 0.483 0.183 0.883

0.278 0.389 0.944 0.500 0.167 0.722

CSS MDE

KRCC

R2

SRCC

0.700 0.767 0.717 0.383 0.433

0.556 0.611 0.611 0.333 0.333

0.035 0.038 0.036 0.020 0.024

0.186

0.500

0.333

0.760 0.869 0.723 0.221 0.008 0.650

0.817 0.867 0.750 0.450 0.067 0.783

0.722 0.778 0.722 0.278 0.056 0.667

AC ATC

RANKME -ReQ

Alarm F1 Score

1.0 0.8 0.6 0.4 0.2 0.80

0.82

0.84

0.86

Camelyon17 (Institution Shift)

Performance Threshold

0.88

0.90

Figure 6. Alarm F1 score on the Camelyon17 dataset. Circuit Shift Score consistently outperform other baseline metrics in a clinical acceptable performance range 0.8–0.9 [17, 64].

4.3. Experimental Setup Datasets. (1) PACS [38]. We fix Photo as the ID domain and treat the remaining three as OOD. To increase statistical robustness, each OOD domain is further partitioned into three disjoint subsets, yielding nine OOD domains in total. (2) Camelyon17 [34]. Instead of following the official domain split, we define first eight slides from hospitals 0 and 1 as the ID domain and use all remaining slides as OOD domains, resulting in 34 OOD domains. (3) FMoW. This dataset from the WILDs benchmark [34] contains satellite images from diverse geographic regions and acquisition time, each representing a domain. We adopt the official validation and test splits and further dividing them by region, yielding 10 OOD domains. (4) ImageNet [13]. We use the validation set of ImageNet1k [13] as ID domain and collect ImageNet-C [28], ImageNet-v2 [60] and ImageNetSketch [70] as OOD domains. See details in Appendix A.

ImageNet (Adversarial + Style)

Average

KRCC

R2

SRCC

KRCC

0.058 0.033 0.273 0.193 0.132

0.055 0.034 0.187 0.152 0.087

0.928 0.921 0.829 0.666 0.419

0.943 0.942 0.897 0.901 0.714

0.839 0.833 0.754 0.729 0.547

0.028

0.069

0.063

0.942

0.957

0.861

0.470±0.095

0.476 0.298 0.519 0.069 0.012 0.417

0.691 0.531 0.807 0.249 0.133 0.661

0.508 0.355 0.608 0.173 0.087 0.519

0.741 0.654 0.953 0.055 0.145 0.862

0.916 0.859 0.961 0.135 0.350 0.925

0.764 0.694 0.855 0.087 0.243 0.781

0.622±0.056 0.569±0.074 0.811±0.041 0.257±0.045 0.129±0.027 0.719±0.041

0.391±0.104 0.418±0.102 0.431±0.088 0.408±0.076 0.373±0.060

Model selection. For the ImageNet experiment, we directly evaluate on the ImageNet-1k pretrained model from Timm [74]. For other datasets, we follow the model selection in Section 3 by selecting the best-performing model based on the DDBout metric (details in Appendix B). Baselines. We adopt the same baseline metrics as Sec. 3.3, excluding ID Accuracy and Sharpness, which rely solely on the ID data. Evaluation protocol. We quantify each metric’s predictive power by its correlation with true OOD performance, measured by R2 , SRCC, and KRCC. To assess the effectiveness of performance monitoring, we sweep a range of performance thresholds δ, thus assessing the robustness of our method under varying alarm criteria. For each δ, we randomly sample subsets of corrupted domains to calibrate δ ′ and evaluate the resulting alarm (binary classification) F1 score. This sampling process simulates variability in available corrupted domains and enables visualization of alarm stability across calibration settings.

4.4. Results and Discussion Correlation with GT performance: CSS vs. baselines. As shown in Table 3, most CSS variants outperform existing proxy metrics, with the best CSS variant (CSS(v,SRCC) ) achieving an average correlation of 0.811, exceeding the strongest baseline by 0.341. Across choices of R, vectorbased CSS outperform graph-based ones, suggesting that fine-grained activation patterns provide more informative signals than coarse structural similarity. Among vectorbased CSS, CSS(v,SRCC) performs the best, indicating that relative circuit weight pattern measures performance drift more reliably than absolute magnitudes. “Alarm raising” accuracy. We evaluate CSS(v,SRCC) for performance monitoring on the Camelyon17 dataset, selected for its relevance to real-world deployment scenarios.

Target Layer

Camelyon17(H=Hospital, S=Slide)

4 2 0

Target Layer

Target Layer

(H3, S30): OOD F1=0.666

put out 12 11 10 9 8 7 6 5 4 3 2 1 ut inp t 1 2 3 4 5 6 7 8 9 0 1 2 t u 1 1 1 tpu inp ou

Target Layer

(H4, S49): OOD F1=0.364 ×104

put out 12 11 10 9 8 7 6 5 4 3 2 1 ut inp t 1 2 3 4 5 6 7 8 9 0 1 2 t u 1 1 1 tpu inp ou

1.2 1.0

Rank |OOD - ID|

6

put out 12 11 10 9 8 7 6 5 4 3 2 1 ut inp t 1 2 3 4 5 6 7 8 9 0 1 2 t u 1 1 1 tpu inp ou

Source Layer

(H3, S32): OOD F1=0.975

8

Source Layer

(T1, R2): OOD F1=0.393 ×103

put out 12 11 10 9 8 7 6 5 4 3 2 1 ut inp t 1 2 3 4 5 6 7 8 9 0 1 2 t u 1 1 1 tpu inp ou

Source Layer

Source Layer

Source Layer

Source Layer

Target Layer

(T2, R0): OOD F1=0.471

put out 12 11 10 9 8 7 6 5 4 3 2 1 ut inp t 1 2 3 4 5 6 7 8 9 0 1 2 t u 1 1 1 tpu inp ou

Rank |OOD - ID|

FMoW(T=Time, R=Region)

(T1, R3): OOD F1=0.496

put out 12 11 10 9 8 7 6 5 4 3 2 1 ut inp t 1 2 3 4 5 6 7 8 9 0 1 2 t u 1 1 1 tpu inp ou

0.8

0.6 0.4 0.2 0.0

Target Layer

Figure 7. Visualization of circuit rank changes across domains on FMoW and Camelyon17. Each pixel in the heatmap shows the absolute change in edge rank between the ID and OOD circuits, averaged across edges from source layer (y-axis) to target layer (x-axis). Subplots are annotated with the domain name and corresponding F1 score. Notably, different dataset exhibit distinct circuit shift patterns: FMoW exhibits widespread cross-layer changes, while Camelyon17 shows concentrated changes at deeper layers.

The alarm F1– δ curve is plotted in Figure 6. CSS consistently outperforms the best baseline metrics by ∼45%. Localizing circuit shifts. To examine whether the rank of the circuit edge changes in a consistent pattern under distribution shift, we visualize the rank changes grouped by source and target layers (Figure 7). We observe that different distribution shifts exhibit distinct shift patterns.

5. Related Work 5.1. Generalization Performance Evaluation Evaluating generalization performance [44, 55, 75] without access to target labels has been explored through a range of unsupervised approaches spanning both model selection and performance monitoring. When target data are unavailable, existing studies leverage ID behavior to estimate intrinsic generalization capability [78]. For instance, the linear relationship between ID and OOD accuracy (“accuracy-on-the-line” [49]) and prediction agreement across models [62]. Li et al. [40] further argues that accuracy alone is insufficient to characterize generalization performance, while correct explanations are also required. Other works use loss landscape properties such as sharpness [1, 3, 63, 81], model stability and invariance [7, 14, 43, 69] as generalization surrogates. When unlabeled target data are available, estimators relying on model’s output probability such as average confidence [29], thresholded confidence [19], and meta-distribution energy [54] have been shown to correlate strongly with accuracy under distribution shifts. Beyond output probabilities, featurebased metrics like RANKME [20] and α-ReQ [2] evaluate representation quality as an alternative proxy.

5.2. Mechanistic Interpretability Mechanistic Interpretability (MI) aims to reverse-engineer neural networks by uncovering their internal computational structures [58]. A central approach in MI is circuit discovery, which identifies minimal functional sub-graphs (circuits) that causally implement specific behaviors. Numerous methods have been proposed for automated cir-

cuit discovery, including ACDC [9], its computationally efficient variants Edge Attribution Patching (EAP) [65], EAP-IG [27], and learning-based Edge Pruning [6]; benchmarks such as INTERPBENCH [26] and MIB [51] further support their evaluation. In parallel, many studies employ circuit discovery to explain model behavior, e.g., tracing induction-head mechanisms for in-context learning [15, 71], isolating sub-graphs responsible for factual recall [8, 47, 53, 76, 79], logical reasoning [10, 30] or visual recognition [59], and examining how computation is reused across tasks or prompts [36, 48, 50, 52]. Unlike these post-hoc explanatory efforts, our work introduces a new paradigm: leveraging model’s circuit as a predictive signal to quantify and monitor generalization performance.

6. Conclusion, Limitations, and Future Work In this paper, we have demonstrated that a model’s circuit provides a reliable measure of its performance under distribution shifts, enabling reliable pre-deployment model selection and post-deployment performance monitoring. We introduced two novel circuit-based metrics: DDB for model selection and CSS for performance monitoring, both of which significantly outperform existing proxy metrics. More broadly, this work validates the applicability of circuit discovery methods in the vision domain and presents a new framework to leverage the internal mechanisms of a model to predict its behavior under distribution shifts. Limitations. The main limitation is the computational cost of circuit discovery. While acceptable for the onetime pre-deployment selection, it hinders real-time postdeployment monitoring. A promising direction is to develop more efficient circuit discovery algorithms, which remains an active area of research. Potential strategies to mitigate this limitation are discussed in Appendix K. Future works. A future direction is to directly optimize these circuit metrics, which explicitly encourage the formation of more generalizable mechanisms.

Acknowledgement This work is supported by the National Science Foundation under grant numbers CAREER 2340074, SLES 2416937, III CORE 2412675 and National Institutes of Health under grant number R21CA301093. Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not reflect the views of the supporting entities.

References [1] Alireza Abdollahpoorrostam. In search of the successful interpolation: On the role of sharpness in clip generalization. arXiv preprint arXiv:2410.16476, 2024. 8 [2] Kumar K Agrawal, Arnab Kumar Mondal, Arna Ghosh, and Blake Richards. α-req: Assessing representation quality in self-supervised learning by measuring eigenspectrum decay. Advances in Neural Information Processing Systems, 35:17626–17638, 2022. 4, 5, 7, 8 [3] Maksym Andriushchenko, Francesco Croce, Maximilian Müller, Matthias Hein, and Nicolas Flammarion. A modern look at the relationship between sharpness and generalization. arXiv preprint arXiv:2302.07011, 2023. 4, 5, 8 [4] Sara Beery, Grant Van Horn, and Pietro Perona. Recognition in terra incognita. In Proceedings of the European conference on computer vision (ECCV), pages 456–473, 2018. 4, 1 [5] Leonard Bereska and Efstratios Gavves. Mechanistic interpretability for ai safety–a review. arXiv preprint arXiv:2404.14082, 2024. 2 [6] Adithya Bhaskar, Alexander Wettig, Dan Friedman, and Danqi Chen. Finding transformer circuits with edge pruning. Advances in Neural Information Processing Systems, 37:18506–18534, 2024. 3, 8 [7] Alberto Bietti and Julien Mairal. Invariance and stability of deep convolutional representations. Advances in neural information processing systems, 30, 2017. 8 [8] Bilal Chughtai, Alan Cooney, and Neel Nanda. Summing up the facts: Additive mechanisms behind factual recall in llms. arXiv preprint arXiv:2402.07321, 2024. 8 [9] Arthur Conmy, Augustine Mavor-Parker, Aengus Lynch, Stefan Heimersheim, and Adrià Garriga-Alonso. Towards automated circuit discovery for mechanistic interpretability. Advances in Neural Information Processing Systems, 36: 16318–16352, 2023. 3, 8 [10] Xinnan Dai, Chung-Hsiang Lo, Kai Guo, Shenglai Zeng, Dongsheng Luo, and Jiliang Tang. Uncovering graph reasoning in decoder-only transformers with circuit tracing. arXiv preprint arXiv:2509.20336, 2025. 8 [11] A D’Amour, KA Heller, DI Moldovan, B Adlam, B Alipanahi, A Beutel, C Chen, J Deaton, J Eisenstein, MD Hoffman, et al. Underspecification presents challenges for credibility in modern machine learning. arxiv 2011.03395. arXiv preprint arXiv:2011.03395 [cs, stat], 2020. 2 [12] Roxana Daneshjou, Kailas Vodrahalli, Roberto A Novoa, Melissa Jenkins, Weixin Liang, Veronica Rotemberg, Justin

Ko, Susan M Swetter, Elizabeth E Bailey, Olivier Gevaert, et al. Disparities in dermatology ai performance on a diverse, curated clinical image set. Science advances, 8(31): eabq6147, 2022. 2 [13] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009. 7, 1, 4 [14] Weijian Deng, Stephen Gould, and Liang Zheng. On the strong correlation between model invariance and generalization. Advances in Neural Information Processing Systems, 35:28052–28067, 2022. 8 [15] Nelson Elhage, Neel Nanda, Catherine Olsson, Tom Henighan, Nicholas Joseph, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, et al. A mathematical framework for transformer circuits. Transformer Circuits Thread, 1(1):12, 2021. 3, 8 [16] Malladi et al. Fine-tuning language models with just forward passes. NeurIPS, 2023. 8 [17] LI Fangyu and HE Hua. Assessing the accuracy of diagnostic tests. Shanghai archives of psychiatry, 30(3):207, 2018. 7 [18] Javier Ferrando and Elena Voita. Information flow routes: Automatically interpreting language models at scale. arXiv preprint arXiv:2403.00824, 2024. 4 [19] Saurabh Garg, Sivaraman Balakrishnan, Zachary C Lipton, Behnam Neyshabur, and Hanie Sedghi. Leveraging unlabeled data to predict out-of-distribution performance. arXiv preprint arXiv:2201.04234, 2022. 2, 4, 5, 7, 8 [20] Quentin Garrido, Randall Balestriero, Laurent Najman, and Yann Lecun. Rankme: Assessing the downstream performance of pretrained self-supervised representations by their rank. In International conference on machine learning, pages 10929–10974. PMLR, 2023. 4, 5, 7, 8 [21] Jakob Gawlikowski, Cedrique Rovile Njieutcheu Tassi, Mohsin Ali, Jongseok Lee, Matthias Humt, Jianxiang Feng, Anna Kruspe, Rudolph Triebel, Peter Jung, Ribana Roscher, et al. A survey of uncertainty in deep neural networks. Artificial Intelligence Review, 56(Suppl 1):1513–1589, 2023. 2 [22] Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, and Felix A Wichmann. Shortcut learning in deep neural networks. Nature Machine Intelligence, 2(11):665–673, 2020. 5 [23] Tony Ginart, Martin Jinye Zhang, and James Zou. Mldemon: Deployment monitoring for machine learning systems. In International conference on artificial intelligence and statistics, pages 3962–3997. PMLR, 2022. 2 [24] Lea Goetz, Nabeel Seedat, Robert Vandersluis, and Mihaela van der Schaar. Generalization—a key challenge for responsible ai in patient-facing clinical applications. NPJ Digital Medicine, 7(1):126, 2024. 1 [25] Devin Guillory, Vaishaal Shankar, Sayna Ebrahimi, Trevor Darrell, and Ludwig Schmidt. Predicting with confidence on unseen distributions. In Proceedings of the IEEE/CVF international conference on computer vision, pages 1134– 1144, 2021. 2 [26] Rohan Gupta, Iván Arcuschin Moreno, Thomas Kwa, and Adrià Garriga-Alonso. Interpbench: Semi-synthetic trans-

formers for evaluating mechanistic interpretability techniques. Advances in Neural Information Processing Systems, 37:92922–92951, 2024. 8 [27] Michael Hanna, Sandro Pezzelle, and Yonatan Belinkov. Have faith in faithfulness: Going beyond circuit overlap when finding model mechanisms. arXiv preprint arXiv:2403.17806, 2024. 2, 3, 8, 4, 7 [28] Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. arXiv preprint arXiv:1903.12261, 2019. 6, 7, 1 [29] Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. arXiv preprint arXiv:1610.02136, 2016. 2, 4, 5, 7, 8 [30] Guan Zhe Hong, Nishanth Dikkala, Enming Luo, Cyrus Rashtchian, Xin Wang, and Rina Panigrahy. How transformers solve propositional logic problems: A mechanistic analysis. 2024. 8 [31] Harold Hotelling. Relations between two sets of variates. In Breakthroughs in statistics: methodology and distribution, pages 162–190. Springer, 1992. 4 [32] Ben Hutchinson, Negar Rostamzadeh, Christina Greer, Katherine Heller, and Vinodkumar Prabhakaran. Evaluation gaps in machine learning practice. In Proceedings of the 2022 ACM conference on fairness, accountability, and transparency, pages 1859–1876, 2022. 1 [33] Cheng Jin, Zhengrui Guo, Yi Lin, Luyang Luo, and Hao Chen. Label-efficient deep learning in medical image analysis: Challenges and future directions. arXiv preprint arXiv:2303.12484, 2023. 1 [34] Pang Wei Koh, Shiori Sagawa, Henrik Marklund, Sang Michael Xie, Marvin Zhang, Akshay Balsubramani, Weihua Hu, Michihiro Yasunaga, Richard Lanas Phillips, Irena Gao, et al. Wilds: A benchmark of in-thewild distribution shifts. In International conference on machine learning, pages 5637–5664. PMLR, 2021. 4, 7, 1 [35] Jannik Kossen, Sebastian Farquhar, Yarin Gal, and Tom Rainforth. Active testing: Sample-efficient model evaluation. In International Conference on Machine Learning, pages 5753–5763. PMLR, 2021. 1 [36] Michael Lan, Philip Torr, and Fazl Barez. Towards interpretable sequence continuation: Analyzing shared circuits in large language models. arXiv preprint arXiv:2311.04131, 2023. 8 [37] Yann LeCun, Corinna Cortes, and CJ Burges. Mnist handwritten digit database. ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist, 2, 2010. 4 [38] Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M Hospedales. Deeper, broader and artier domain generalization. In Proceedings of the IEEE international conference on computer vision, pages 5542–5550, 2017. 4, 7, 1 [39] Maximilian Li and Lucas Janson. Optimal ablation for interpretability. Advances in Neural Information Processing Systems, 37:109233–109282, 2024. 4 [40] Tang Li, Mengmeng Ma, and Xi Peng. Beyond accuracy: ensuring correct predictions with correct rationales. Advances in Neural Information Processing Systems, 37:43164–43188, 2024. 8

[41] Yuan-Hong Liao, Amlan Kar, and Sanja Fidler. Towards good practices for efficiently annotating large-scale image classification datasets. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4350–4359, 2021. 1 [42] Mengmeng Ma, Tang Li, Yunxiang Peng, Lu Lin, Volkan Beylergil, Binsheng Zhao, Oguz Akin, and Xi Peng. ” why is there a tumor?”: Tell me the reason, show me the evidence. In Forty-second International Conference on Machine Learning. 1 [43] Mengmeng Ma, Jian Ren, Long Zhao, Sergey Tulyakov, Cathy Wu, and Xi Peng. Smil: Multimodal learning with severely missing modality. In Proceedings of the AAAI conference on artificial intelligence, pages 2302–2310, 2021. 8 [44] Mengmeng Ma, Tang Li, and Xi Peng. Beyond the federation: Topology-aware federated learning for generalization to unseen clients. In Proceedings of the International Conference on Machine Learning (ICML), 2024. 8 [45] Samuel Marks, Can Rager, Eric J Michaud, Yonatan Belinkov, David Bau, and Aaron Mueller. Sparse feature circuits: Discovering and editing interpretable causal graphs in language models. arXiv preprint arXiv:2403.19647, 2024. 4 [46] Alexander Meinke, Julian Bitterwolf, and Matthias Hein. Provably robust detection of out-of-distribution data (almost) for free. arXiv preprint arXiv:2106.04260, 2021. 2 [47] Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual associations in gpt. Advances in neural information processing systems, 35:17359– 17372, 2022. 3, 8, 4 [48] Jack Merullo, Carsten Eickhoff, and Ellie Pavlick. Circuit component reuse across tasks in transformer language models. arXiv preprint arXiv:2310.08744, 2023. 8 [49] John P Miller, Rohan Taori, Aditi Raghunathan, Shiori Sagawa, Pang Wei Koh, Vaishaal Shankar, Percy Liang, Yair Carmon, and Ludwig Schmidt. Accuracy on the line: on the strong correlation between out-of-distribution and indistribution generalization. In International conference on machine learning, pages 7721–7735. PMLR, 2021. 2, 4, 5, 8 [50] Philipp Mondorf, Sondre Wold, and Barbara Plank. Circuit compositions: Exploring modular structures in transformerbased language models. arXiv preprint arXiv:2410.01434, 2024. 8 [51] Aaron Mueller, Atticus Geiger, Sarah Wiegreffe, Dana Arad, Iván Arcuschin, Adam Belfki, Yik Siu Chan, Jaden FiottoKaufman, Tal Haklay, Michael Hanna, Jing Huang, Rohan Gupta, Yaniv Nikankin, Hadas Orgad, Nikhil Prakash, Anja Reusch, Aruna Sankaranarayanan, Shun Shao, Alessandro Stolfo, Martin Tutek, Amir Zur, David Bau, and Yonatan Belinkov. Mib: A mechanistic interpretability benchmark, 2025. 8, 4, 5 [52] Jatin Nainani, Sankaran Vaidyanathan, AJ Yeung, Kartik Gupta, and David Jensen. Adaptive circuit behavior and generalization in mechanistic interpretability. arXiv preprint arXiv:2411.16105, 2024. 8 [53] Yixin Ou, Yunzhi Yao, Ningyu Zhang, Hui Jin, Jiacheng Sun, Shumin Deng, Zhenguo Li, and Huajun Chen. How

do llms acquire new knowledge? a knowledge circuits perspective on continual pre-training. arXiv preprint arXiv:2502.11196, 2025. 8 [54] Ru Peng, Heming Zou, Haobo Wang, Yawen Zeng, Zenan Huang, and Junbo Zhao. Energy-based automated model evaluation. arXiv preprint arXiv:2401.12689, 2024. 4, 5, 7, 8 [55] Fengchun Qiao, Long Zhao, and Xi Peng. Learning to learn single domain generalization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12556–12565, 2020. 2, 8 [56] Joaquin Quiñonero-Candela, Masashi Sugiyama, Anton Schwaighofer, and Neil D Lawrence. Dataset shift in machine learning. Mit Press, 2022. 2 [57] S Rabanser, S Günnemann, and ZC Lipton. Failing loudly: an empirical study of methods for detecting dataset shift. arxiv e-prints. arXiv preprint arXiv:1810.11953, 2018. 2 [58] Daking Rai, Yilun Zhou, Shi Feng, Abulhair Saparov, and Ziyu Yao. A practical review of mechanistic interpretability for transformer-based language models. arXiv preprint arXiv:2407.02646, 2024. 2, 8 [59] Achyuta Rajaram, Neil Chowdhury, Antonio Torralba, Jacob Andreas, and Sarah Schwettmann. Automatic discovery of visual circuits. arXiv preprint arXiv:2404.14349, 2024. 8 [60] Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In International conference on machine learning, pages 5389–5400. PMLR, 2019. 7, 1 [61] Shiori Sagawa, Pang Wei Koh, Tatsunori B Hashimoto, and Percy Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worstcase generalization. arXiv preprint arXiv:1911.08731, 2019. 4 [62] Rahul Saxena, Taeyoun Kim, Aman Mehra, Christina Baek, J Zico Kolter, and Aditi Raghunathan. Predicting the performance of foundation models via agreement-on-the-line. Advances in Neural Information Processing Systems, 37: 31854–31906, 2024. 8 [63] Samuel Schapiro and Han Zhao. Towards understanding the role of sharpness-aware minimization algorithms for out-of-distribution generalization. arXiv preprint arXiv:2412.05169, 2024. 8 [64] Ana-Maria Šimundić. Measures of diagnostic accuracy: basic definitions. ejifcc, 19(4):203, 2009. 7 [65] Aaquib Syed, Can Rager, and Arthur Conmy. Attribution patching outperforms automated circuit discovery. arXiv preprint arXiv:2310.10348, 2023. 8, 4 [66] R Thomas. The problem with metrics is a big problem for ai. Retrieved December, 23:2019, 2019. 1 [67] Anton Tsitsulin, Davide Mottin, Panagiotis Karras, Alexander Bronstein, and Emmanuel Müller. Netlsd: hearing the shape of a graph. In Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining, pages 2347–2356, 2018. 6, 2 [68] Ulrike Von Luxburg. A tutorial on spectral clustering. Statistics and computing, 17(4):395–416, 2007. 6, 2

[69] Yoav Wald, Amir Feder, Daniel Greenfeld, and Uri Shalit. On calibration and out-of-domain generalization. Advances in neural information processing systems, 34:2215–2227, 2021. 8 [70] Haohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. In Advances in Neural Information Processing Systems, pages 10506–10518, 2019. 7, 1 [71] Kevin Wang, Alexandre Variengien, Arthur Conmy, Buck Shlegeris, and Jacob Steinhardt. Interpretability in the wild: a circuit for indirect object identification in gpt-2 small. arXiv preprint arXiv:2211.00593, 2022. 2, 3, 8 [72] Shanshan Wang, Cheng Li, Rongpin Wang, Zaiyi Liu, Meiyun Wang, Hongna Tan, Yaping Wu, Xinfeng Liu, Hui Sun, Rui Yang, et al. Annotation-efficient deep learning for automatic medical image segmentation. Nature communications, 12(1):5915, 2021. 1 [73] Florian Wenzel, Andrea Dittadi, Peter Gehler, Carl-Johann Simon-Gabriel, Max Horn, Dominik Zietlow, David Kernert, Chris Russell, Thomas Brox, Bernt Schiele, et al. Assaying out-of-distribution generalization in transfer learning. Advances in Neural Information Processing Systems, 35:7181– 7198, 2022. 2 [74] Ross Wightman. PyTorch Image Models. 7, 2 [75] Jingkang Yang, Kaiyang Zhou, Yixuan Li, and Ziwei Liu. Generalized out-of-distribution detection: A survey. International Journal of Computer Vision, 132(12):5635–5662, 2024. 8 [76] Yunzhi Yao, Ningyu Zhang, Zekun Xi, Mengru Wang, Ziwen Xu, Shumin Deng, and Huajun Chen. Knowledge circuits in pretrained transformers. Advances in Neural Information Processing Systems, 37:118571–118602, 2024. 8 [77] Jason Yosinski, Jeff Clune, Anh Nguyen, Thomas Fuchs, and Hod Lipson. Understanding neural networks through deep visualization. arXiv preprint arXiv:1506.06579, 2015. 5 [78] Han Yu, Jiashuo Liu, Xingxuan Zhang, Jiayun Wu, and Peng Cui. A survey on evaluation of out-of-distribution generalization. arXiv preprint arXiv:2403.01874, 2024. 1, 8 [79] Qinan Yu, Jack Merullo, and Ellie Pavlick. Characterizing mechanisms for factual recall in language models. arXiv preprint arXiv:2310.15910, 2023. 8 [80] Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. arxiv. arXiv preprint arXiv:1311.2901, 2013. 5 [81] Yingtian Zou, Kenji Kawaguchi, Yingnan Liu, Jiashuo Liu, Mong-Li Lee, and Wynne Hsu. Towards robust out-ofdistribution generalization bounds via sharpness. arXiv preprint arXiv:2403.06392, 2024. 8

Inside-Out: Measuring Generalization in Vision Transformers Through Inner Workings Supplementary Material Table 4. Overview over datasets in pre-deployment setting and their associated domains, along with a shift type for each dataset

Dataset

PACS [38]

Camelyon17 [34]

Terra Incognita [4]

Shift type

Domain

style shift

art painting cartoon photo sketch

institution shift

ID Hospitals hospital1 hospital2

geographic shift

location 38 location 43 location 46 location 100

Table 5. Overview over datasets in post-deployment setting and their associated ID and OOD domains, along with a shift type for each dataset. The hospital id and slide id in Camelyon17 domains as well as the region id in FMoW domains follows the indexing in original dataset metadata. The time id correspondence in FMoW dataset is: time 1 → val split and time 2 → test split in the original dataset split

Dataset

ID domain

OOD domain

PACS [38]

Sketch

art painting subset 1-3 cartoon subset 1-3 photo subset 1-3

Camelyon17 [34]

hospital 0 slide 0-7 hospital 1 slide 10-17

hospital 0 slide 8-9 hospital 1 slide 18-19 hospital 2 slide 20-29 hospital 3 slide 30-39 hospital 4 slide 40-49

FMoW [34]

Official ID split

time 1 region 0-4 time 2 region 0-4

ImageNet Validation

ImageNet-Sketch ImageNet-v2 motion blur 0-4 defocus blur 0-4 zoom blur 0-4 snow 0-4 frost 0-4

A. Details on Datasets Pre-deployment setting. We use 11 domains collected from three datasets: PACS [38], Camelyon17 from WILDS [34], and the Terra Incognita [4] datasets, see domain and shift type details in Table 4. For PACS and Terra Incognita, we consider all possible in-distribution to out-ofdistribution (ID → OOD) domain pairs, i.e., we train on one domain(ID domain) and evaluate the model on all the others (OOD domains). For the Camelyon17 dataset we train on the official ID split provided by WILDS, and group the OOD split by hospital id, results in two OOD domains. Then we evaluate on both OOD domains. Post-deployment setting. In Section 4, we drawn domains from four datasets, FMoW from WILDS [34], PACS [38], Camelyon17 from WILDS [34] with a slightly different setting, and ImageNet [13]; see domain and shift type details in Table 5. For the FMoW dataset, the official data split creates (train, id val, val, test) by the year the images were taken. We train on the train split and use the id val split for ID evaluation set. For OOD domains, we split the val (time1) and test (time2) sets by the regions where the images were taken; this results in 10 domains in total. For PACS, we use Sketch as the ID domain and treat the remaining three as OOD, because this is the most challenging distribution shift. To expand the number of OOD domains, we randomly split each OOD domain into three subsets, expanding the OOD domains to 9. For Camelyon17, the dataset can be split into 5 hospitals and each hospital contains 10 slides of digitized Whole Slide Images

ImageNet [13]

(WSIs). This results in 50 slides each originating from a specific patient at a specific hospital. We use the first 8 slides from hospital 0 and hospital 1 for training, leaving all other slides for OOD evaluation; this results in 34 OOD domains. For ImageNet, we use the validation set as the ID domain and collect 27 OOD domains from ImageNetC [28], ImageNet-v2 [60] and ImageNet-Sketch [70].

B. Details of Model Zoo Construction and Model Selection Pre-deployment setting. To obtain a diverse set of models, we train/fine-tune different pretrained ViTs listed in Table 6. To balance model diversity with computational efficiency, we adopt a two-stage hyperparameter selection strategy. First, we perform an extensive hyperparameter sweep on a representative subset of each dataset. Specifically, for PACS we conduct the sweep on the photo domain; for Camelyon17, on a subset of the official indistribution (ID) dataset; and for Terra Incognita, on location 38. The initial search is performed over an expanded

Table 6. The list of ViTs used in our study. Pretrained weights are sourced from the PyTorch Image Models (timm) library [74], using the model names listed

Model

Timm model name

random init ViT OPENAI CLIP LAION2b CLIP ImageNet 21k ImageNet 1k MAE

N/A vit base patch16 clip 224.openai vit base patch16 clip 224.laion2b vit base patch16 224 in21k vit base patch16 224.orig in21k ft in1k vit base patch16 224.mae

Table 7. Hyperparameter sweep grid for constructing the model zoo for the PACS and Terra Incognita pre-deployment experiment

Learning Rate

Batch Size

Weight Decay

Fine-tune

3e-2 1e-2 3e-3

128 256

0 1e-2

Only head Whole model

grid consisting of learning rates (10−1 , 3 × 10−2 , 10−2 , 3 × 10−3 , 10−3 ), batch sizes (128, 256), and weight decays (0, 10−1 , 10−2 , 10−3 ).Based on the results of this sweep, we construct a reduced hyperparameter grid by selecting configurations that achieve strong performance across all pretraining types. In particular, we ensure that for each pretraining type, at least one configuration within the reduced grid attains near-optimal performance. This pre-selection strategy follows prior practice in [73]. As a result, for PACS and Terra Incognita, we adopt a 3 × 2 × 2 grid over learning rate, batch size, and weight decay. Due to computational constraints, we further reduce the grid for Camelyon17 to 3 × 2 × 1. The final hyperparameter configurations are summarized in Table 7 and Table 8, respectively. Post-deployment setting. In the post-deployment experiments, we are focusing on a single model for each dataset and the model selection is performed from the preconstructed model zoo based on the DDBout criterion, or by directly adopting pretrained models when appropriate for the dataset. For PACS, we directly select models from the model zoo obtained in the pre-deployment stage. For Camelyon17 and FMoW, since the in-distribution (ID) and outof-distribution (OOD) settings differ from those used during pre-deployment, we conduct an additional lightweight hyperparameter sweep using a reduced 2 × 2 × 1 grid over learning rate (10−2 , 3 × 10−3 ), batch size (256), and weight decay (0, 10−2 ). For ImageNet, we directly adopt ImageNet-1K pretrained models from the Timm library without further fine-tuning.

Table 8. Hyperparameter sweep grid for constructing the model zoo for the Camelyon17 pre-deployment experiment

Learning Rate

Batch Size

Weight Decay

Fine-tune

3e-2 1e-2 3e-3

128 256

0

Only head Whole model

C. Model Performances Across Different Pretraining We report the average ID and OOD performance for each pretraining strategy, aggregated over all models in the corresponding model zoo and across all generalization tasks. For each model, ID performance is evaluated on the ID test set, while OOD performance is computed as the mean accuracy across all remaining domains. We then average these ID and OOD metrics over all models sharing the same pretraining strategy. Finally, for each dataset, we report the mean ID accuracy, mean OOD accuracy, and the corresponding ID– OOD performance gap in Table 9.

D. Detailed Definitions of Distance Metrics for the Circuit Shift Score Here we provide the formal definitions of distance metrics for the graph-based CSS(g,·) and vector-based CSS(v,·) variants. Graph-based distance metrics: Let C1 = (V, E, W1 ) and C2 = (V, E, W2 ) be two circuit graphs of the same model with respect to two different input distributions. |V|

• laplacian Spectrum Distance [68]: Let {λi (C)}i=1 be the ordered eigenvalues of circuit graph C’s Laplacian matrix. The distance is the Euclidean distance between the eigenvalue vectors of the two graphs: v u |V | uX 2 (λi (C1 ) − λi (C2 )) dLaplacian (C1 , C2 ) = t i=1

• NetLSD (Net Laplacian Spectral Descriptor) [67]: The NetLSD signature is a vector derived from the solution to the heat equation on a graph. This results in a graph size agnostic feature extraction function. Consequently, given C1 and C2 , we prune the circuit graph as C1k = (V1 , E1 , W1 ) and C2k = (V2 , E2 , W2 ) by retaining the top-k edges following Hanna et al. [27] and extract the NetLSD signature vectors from both circuits. The distance is the L2 distance between these signature vectors. For a full definition, we refer the reader to [67]. • Jacarrd Similarity: We first derive the pruned circuit graphs C1k and C2k . This metric measures the overlap of

Table 9. Model generalization comparison. Columns show averaged ID, OOD accuracy and OOD-ID Gap of each model over all domains within the dataset.

Model

Benchmark

ID accuracy

OOD accuracy

OOD-ID Gap

random init

PACS Camelyon17 Terra Incognita FMoW

0.477 ± 0.018 0.934 ± 0.009 0.565 ± 0.014 0.547 ± 0.020

0.201 ± 0.010 0.686 ± 0.014 0.221 ± 0.011 0.497 ± 0.009

0.276 ± 0.156 0.248 ± 0.006 0.344 ± 0.023 0.051 ± 0.003

ViT-B MAE pretrained

PACS Camelyon17 Terra Incognita FMoW

0.580 ± 0.017 0.912 ± 0.021 0.633 ± 0.017 0.569 ± 0.007

0.242 ± 0.012 0.836 ± 0.018 0.220 ± 0.008 0.512 ± 0.013

0.338 ± 0.011 0.076 ± 0.005 0.413 ± 0.023 0.057 ± 0.011

ViT-B openai CLIP

PACS Camelyon17 Terra Incognita FMoW

0.921 ± 0.010 0.955 ± 0.010 0.772 ± 0.014 0.639 ± 0.015

0.695 ± 0.021 0.881 ± 0.010 0.334 ± 0.012 0.578 ± 0.008

0.226 ± 0.014 0.075 ± 0.012 0.438 ± 0.018 0.060 ± 0.005

ViT-B laion2b CLIP

PACS Camelyon17 Terra Incognita FMoW

0.913 ± 0.011 0.962 ± 0.008 0.750 ± 0.020 0.647 ± 0.021

0.693 ± 0.024 0.887 ± 0.010 0.338 ± 0.012 0.591 ± 0.009

0.219 ± 0.016 0.075 ± 0.010 0.412 ± 0.028 0.055 ± 0.017

ViT-B ImageNet 21k

PACS Camelyon17 Terra Incognita FMoW

0.966 ± 0.003 0.979 ± 0.004 0.807 ± 0.012 0.618 ± 0.012

0.677 ± 0.013 0.917 ± 0.002 0.344 ± 0.008 0.575 ± 0.020

0.289 ± 0.014 0.062 ± 0.005 0.463 ± 0.016 0.043 ± 0.019

ViT-B ImageNet 1k

PACS Camelyon17 Terra Incognita FMoW

0.922 ± 0.005 0.964 ± 0.007 0.771 ± 0.012 0.602 ± 0.015

0.658 ± 0.012 0.908 ± 0.008 0.286 ± 0.011 0.547 ± 0.010

0.264 ± 0.008 0.056 ± 0.002 0.485 ± 0.017 0.055 ± 0.006

the edge sets over the two pruned circuits. Given the edge sets in the two circuits, denoted as E1 and E2 , the Jaccard distance is defined as: dJaccard (E1 , E2 ) = 1 −

|E1 ∩ E2 | |E1 ∪ E2 |

Vector-based distance metrics: Let e1 , e2 ∈ RE be the two vectors of edge weights from two circuits, defined over the full edge set E of the model architecture. • Cosine Similarity: compute the cosine similarity between the two vectors. dCosine (e1 , e2 ) = 1 −

e1 · e 2 ∥e1 ∥∥e2 ∥

• Spearman Ranking Correlation Coefficient (SRCC): Measures the rank correlation. Let rg(e) be the rank vector of e. SRCC(e1 , e2 ) = ρ(rg(e1 ), rg(e2 )) • ℓ2 Distance (Euclidean Distance): The standard Eu-

clidean distance between the two vectors. v u |E| uX dℓ2 (e1 , e2 ) = ∥e1 − e2 ∥2 = t (e1,i − e2,i )2 i=1

E. Calibration Set Construction Detail In the post-deployment setting, our goal is to monitor potential performance degradation and identify “silent failures” of the model. To support reliable threshold calibration for our circuit-based metric, we construct a diverse corruption set that simulates realistic distribution shifts. The corruption set used in our experiments includes: (1) 9 types of Stylization, cartoon, contour, edge, edge-enhance, pallete, posterize, solarize and emboss. These corruptions introduce texture, edge, and color-style distortions, capturing a wide range of appearance changes that real-world data may undergo. (2) fog, frost, gaussian noise, shot noise, defocus blur, and snow, each applied with severity levels 1–5. We adopt these corruptions because they are widely used to benchmark robustness and model

Table 11. CPR(↑) scores across circuit discovery methods. All evaluations were performed using mean ablations. We bold and underline the best and second-best methods per column, respectively.

degradation under natural image perturbations.

F. Detailed Scatter Plots Pre-deployment setting. we evaluate all metrics across the full collection of 34 ID → OOD tasks. Figure 8, 9 and 10 presents the corresponding scatter plots in PACS, Camelyon17 and Terra Incognita, illustrating the relationship between each metric and GT OOD performance. Post-deployment setting. Figure 11 displays the complete set of scatter plots for every metric across datasets, enabling a comprehensive comparison of their predictive behaviors.

G. Circuit Discovery Method Benchmark We benchmark five existing circuit discovery methods on vision tasks, following the standardized evaluation protocol introduced by Mueller et al. [51]. Our goal is to assess the faithfulness and efficiency of each method in identifying circuits that reliably capture the causal mechanisms underlying model predictions. Experimental setup. We evaluate circuit discovery across three vision benchmarks: Color-MNIST [37], Waterbirds [61], and ImageNet [13]. Due to the large size of ImageNet, we randomly sample 10000 samples from the validation set for evaluation. The evaluated methods include: (1) Edge Activation Patching (EActP) [47], (2) Edge Attribution Patching (EAP) [65], (3) EAP with Integrated Gradients (EAP-IG), with two variants: EAP-IG-inputs [27] and EAP-IG-activation [45], following [27], we set gradient integration steps to 5, (4) Information Flow Route (IFR) [18], and (5) Uniform Gradient Sampling (UGS) [39]. Table 10. CMD(↓) scores across circuit discovery methods. All evaluations were performed using mean ablations. We bold and underline the best and second-best methods per column, respectively.

Method

Color-MNIST

Waterbirds

ImageNet

small-ViT

ViT-B/16

ViT-B/16

ViT-B/16

Random

0.555

0.748

0.754

0.732

EActP

0.466

0.095

0.271

0.360

EAP

0.332

0.103

0.299

0.376

EAP-IG-inp EAP-IG-act

0.567 0.452

0.063 0.076

0.242 0.327

0.325 0.381

IFR

0.724

0.565

0.590

0.585

UGS

0.300

0.114

0.053

0.102

Waterbirds

ImageNet

small-ViT

Color-MNIST ViT-B/16

ViT-B/16

ViT-B/16

Random

0.263

0.274

0.260

0.299

EActP

1.679

0.732

0.698

0.804

EAP

1.658

0.712

0.570

0.655

EAP-IG-inp EAP-IG-act

2.033 1.658

0.902 0.858

0.706 0.656

0.813 0.810

IFR

1.025

0.499

0.409

0.410

UGS

1.231

0.893

0.946

0.897

Method

Given a full model M and its circuit subgraph C k (retaining activations on the top-k attributed edges), the faithfulness score is defined as: f (C k , M; KL) =

(8)

′ where y and yC k denote the clean output of the model without ablating any activation, and the counterfactual output of the model, with all edges outside of C k is ablated. KL(· ∥ ·) denotes the Kullback–Leibler divergence. As mentioned in Section 2, we ablate edges with mean ablation, i.e., the output of an edge is neutralized by replacing its corresponding activations with their pre-computed mean over the input dataset. Here, y∅′ denote the outputs from the empty circuit, effectively ablating all edges. This formulation measures the proportion of the model’s explanatory power preserved by the circuit, normalized between the trivial (empty) and complete models. Following Mueller et al. [51], we evaluate each method using two aggregate metrics, the integrated circuit performance ratio (CPR) and the integrated circuitmodel distance (CMD), Instead of selecting a single circuit threshold (which would make evaluation highly sensitive to hyperparameter choices), both metrics aggregate faithfulness continuously over all circuit sizes k: Z 1 Z 1 CPR = f (C k ) dk, CMD = |1 − f (C k )| dk, 0

Faithfulness metrics. To quantify how faithfully an extracted circuit C k captures the model’s causal structure, we adopt the faithfulness definition from Mueller et al. [51].

′ ′ KL(y ∥ yC k ) − KL(y ∥ y∅ ) , ′ 1 − KL(y ∥ y∅ )

0

(9) where f (C k ) is the faithfulness at fraction k of retained edges. CPR captures how much of the model’s behavior is positively preserved across circuit scales, with higher CPR indicates that a method consistently identifies components that support the model’s predictions. CMD instead measures the overall deviation from perfect fidelity, with lower CMD indicates that a method successfully identifies components with any strong effect on the model’s computation,

sketch photo sketch cartoon

1.0 R 2=0.701 SRCC=0.821 0.8 KRCC=0.630 0.6 0.4 0.2 0.0

R 2=0.137 SRCC=0.198 KRCC=0.113

0.4 0.6 R 2=0.740 1.00 SRCC=0.882 KRCC=0.715 0.75

sketch artpainting

0.6

0.8

R 2=0.586 SRCC=0.851 KRCC=0.653

1.0

0.25 0.50 R 2=0.215 SRCC=0.284 KRCC=0.183

0.75

1.000.2 0.4 R 2=0.805 SRCC=0.890 KRCC=0.723

1.5 R 2=0.755 SRCC=0.861 KRCC=0.691

1.0

0.8

1.0

0.25 0.50 R 2=0.146 SRCC=0.274 KRCC=0.176

0.75

1.000.2 0.4 0.6 R 2=0.773 SRCC=0.892 KRCC=0.728

0.8

1.5 1.0 R 2=0.756 SRCC=0.877 KRCC=0.699

0.4 0.6 1.25 R 2=0.648 SRCC=0.885 1.00 KRCC=0.716 0.75 0.50 0.25 0.00

0.8

1.0

0.25 0.50 R 2=0.001 SRCC=0.194 KRCC=0.085

0.75

1.000.2 0.4 0.6 R 2=0.223 SRCC=0.534 KRCC=0.371

0.8

1.5 1.0 R 2=0.193 SRCC=0.549 KRCC=0.385

0.4 0.6 2=0.614 1.0 RSRCC=0.857 KRCC=0.672 0.5

0.8

1.0

0.2 0.4 R 2=0.001 SRCC=0.177 KRCC=0.077

0.6

0.8

0.2 0.4 R 2=0.219 SRCC=0.563 KRCC=0.409

0.6

0.8 2.0 1.5 R 2=0.166 SRCC=0.536 KRCC=0.384

0.8

1.0

0.2 0.4 R 2=0.012 SRCC=0.102 KRCC=0.010

0.6

0.8 0.2 0.4 R 2=0.426 SRCC=0.622 KRCC=0.420

0.6

0.8

0.8

1.0

0.2 0.4 R 2=0.001 SRCC=-0.126 KRCC=-0.088

0.6

0.8 0.2 0.4 0.6 R 2=0.717 SRCC=0.730 KRCC=0.547

0.8

R 2=0.503 SRCC=0.568 KRCC=0.379

0.5 0.5 0.6 R 2=0.643 SRCC=0.842 KRCC=0.668

R 2=0.520 SRCC=-0.514 KRCC=-0.349

R 2=0.129 SRCC=0.371 KRCC=0.304

2.0 0

R 2=0.517 SRCC=0.775 KRCC=0.600

25 50 R 2=0.481 SRCC=0.712 KRCC=0.539

75

R 2=0.899 SRCC=0.877 KRCC=0.686

R 2=0.897 SRCC=0.891 KRCC=0.718

0.7 0

25 50 R 2=0.258 SRCC=0.440 KRCC=0.225

75

100

1.0 1.5 R 2=0.505 SRCC=-0.719 KRCC=-0.520

1000.10 0.15 R 2=0.731 SRCC=0.895 KRCC=0.737

0.20

0.25

0.5 0.0 R 2=0.838 SRCC=0.900 KRCC=0.727

0.5

2 3 R 2=0.827 SRCC=0.899 KRCC=0.715

4

0.20

0.25

0.5 0.0 R 2=0.878 SRCC=0.893 KRCC=0.716

0.5

2 3 R 2=0.874 SRCC=0.895 KRCC=0.705

4

0.5 0.0 R 2=0.866 SRCC=0.929 KRCC=0.780

0.5

2 3 R 2=0.780 SRCC=0.913 KRCC=0.747

4

5

0.80

25 50 R 2=0.519 SRCC=0.634 KRCC=0.463

75

100

1 2 R 2=0.457 SRCC=-0.633 KRCC=-0.453

0

25 50 R 2=0.085 SRCC=-0.450 KRCC=-0.321

75

100

1.0 1.5 R 2=0.109 SRCC=-0.308 KRCC=-0.197

20 40 R 2=0.284 SRCC=0.617 KRCC=0.371

60

1.0 1.2 1.4 R 2=0.504 SRCC=-0.831 KRCC=-0.615

1.6

1.8

0 25 50 R 2=0.462 SRCC=0.727 KRCC=0.533

75

1000.100 0.125 0.150 0.175 R 2=0.765 SRCC=0.915 KRCC=0.746

0.5 R 2=0.847 SRCC=0.901 KRCC=0.717

0.0

0.5

2 3 R 2=0.714 SRCC=0.883 KRCC=0.691

100

1 2 R 2=0.642 SRCC=-0.805 KRCC=-0.614

3

4

25 50 R 2=0.830 SRCC=0.880 KRCC=0.696

75

100 0.10 0.15 R 2=0.824 SRCC=0.885 KRCC=0.705

0.20

0.5 R 2=0.916 SRCC=0.915 KRCC=0.740

0.0

0.5

2 R 2=0.842 SRCC=0.920 KRCC=0.753

3

4

2.0 20 40 60 R 2=0.778 SRCC=0.812 KRCC=0.637

80

100 0.10 0.15 R 2=0.538 SRCC=0.752 KRCC=0.589

0.20

0.5 R 2=0.845 SRCC=0.769 KRCC=0.604

0.0

0.5

2 R 2=0.947 SRCC=0.856 KRCC=0.700

3

4

0.50 0.25 0.00 0.4 0.6 R 2=0.650 1.00 SRCC=0.877 KRCC=0.702 0.75

0.5

0.6 R 2=0.740 SRCC=0.888 KRCC=0.695

0.7

3

20 40 R 2=0.393 SRCC=0.623 KRCC=0.498

60

80

0.10 0.15 R 2=0.655 SRCC=0.920 KRCC=0.757

20 40 R 2=0.221 SRCC=0.406 KRCC=0.339

60

80

0.10 0.15 0.20 R 2=0.713 SRCC=0.913 KRCC=0.747

0.50 0.25 0.00

photo cartoon

photo sketch

R 2=0.557 SRCC=0.784 KRCC=0.595

0.8

1.25

0.5

0.55 0.60 0.65 0.70 R 2=0.081 SRCC=0.762 KRCC=0.555

1.0

0.5

0.60 0.65 R 2=0.037 SRCC=0.571 KRCC=0.404

1.5 R 2=0.364 SRCC=0.596 KRCC=0.406

1.0

0.5 0.55 0.60 0.65 0.70 0.75 0 25 50 R 2=0.182 R 2=0.694 SRCC=0.536 SRCC=0.815 KRCC=0.366 KRCC=0.627

1.5 R 2=0.666 SRCC=0.666 KRCC=0.490

1.0

0.5 0.5 0.6 R 2=0.231 SRCC=0.398 KRCC=0.251

0.70 0

2.0 0

0.25

5

4

cartoon photo

photo artpainting

0.0 0.5 0.4 0.6 2=0.822 1.0 RSRCC=0.911 0.8 KRCC=0.748 0.6 0.4 0.2 0.0 0.4 0.6 1.2 R 2=0.902 SRCC=0.823 1.0 KRCC=0.652 0.8

artpainting photo artpainting cartoon artpainting sketch

0.7

75

0.8 0

50 R 2=0.576 SRCC=0.661 KRCC=0.463

100

75

1.0 1.5 R 2=0.679 SRCC=-0.680 KRCC=-0.496

0.6 0.4

0.2 0.6 1.25 R 2=0.880 SRCC=0.866 1.00 KRCC=0.713 0.75 0.50 0.25 0.00 0.6 1.0 R 2=0.692 SRCC=0.921 0.8 KRCC=0.789

cartoon sketch

cartoon artpainting

R 2=0.569 SRCC=0.767 KRCC=0.592

0.8

1.0 0.2 0.4 0.6 R 2=0.000 SRCC=-0.062 KRCC=-0.039

0.8

0.4 0.6 R 2=0.828 SRCC=0.751 KRCC=0.576

0.8

0.8

1.0 0.2 0.4 R 2=0.002 SRCC=0.003 KRCC=0.028

0.6

0.8

0.4 0.6 R 2=0.792 SRCC=0.914 KRCC=0.754

1.0 0.2 0.4 0.6 R 2=0.052 SRCC=-0.024 KRCC=-0.022

0.8

1.0

0.2 0.4 R 2=0.007 SRCC=-0.048 KRCC=-0.043

1.0

0.2 0.4 R 2=0.000 SRCC=-0.074 KRCC=-0.038

1.0

1.5 1.0 R 2=0.769 SRCC=0.700 KRCC=0.529

0.5

0.00.5 0.6 R 2=0.310 SRCC=0.501 KRCC=0.349

0.7

0.8

25 50 R 2=0.640 SRCC=0.672 KRCC=0.484

100

1.0 R 2=0.709 SRCC=-0.752 KRCC=-0.562

1.5

40 60 R 2=0.852 SRCC=0.880 KRCC=0.724

80

1000.10 0.15 R 2=0.538 SRCC=0.934 KRCC=0.775

0.20

0.50 0.25 0.00 0.25 0.50 1 2 3 R 2=0.880 R 2=0.910 SRCC=0.862 SRCC=0.883 KRCC=0.693 KRCC=0.711

4

5

0.8

1.5 1.0 R 2=0.801 SRCC=0.892 KRCC=0.731

0.5

0.6 R 2=0.499 SRCC=0.736 KRCC=0.580

0.7

0.8

25 50 75 R 2=0.041 SRCC=-0.355 KRCC=-0.249

100 125

1.0 R 2=0.055 SRCC=-0.150 KRCC=-0.102

1.5

40 60 R 2=0.392 SRCC=0.706 KRCC=0.539

80

100 0.1 0.2 R 2=0.672 SRCC=0.914 KRCC=0.752

0.3

0.5 0.0 R 2=0.772 SRCC=0.895 KRCC=0.722

0.5

2 3 R 2=0.798 SRCC=0.887 KRCC=0.724

4

5

0.4 0.6 R 2=0.898 SRCC=0.754 KRCC=0.603

0.8

1.5 1.0 R 2=0.838 SRCC=0.722 KRCC=0.566

0.5

0.60 0.65 R 2=0.325 SRCC=0.554 KRCC=0.402

25 50 R 2=0.488 SRCC=0.768 KRCC=0.588

75

100

1.0 1.5 R 2=0.635 SRCC=-0.804 KRCC=-0.643

1000.10 0.15 R 2=0.692 SRCC=0.812 KRCC=0.648

0.20

0.5 0.0 R 2=0.898 SRCC=0.672 KRCC=0.524

0.5

2 3 R 2=0.957 SRCC=0.868 KRCC=0.723

0.6

0.4 0.6 R 2=0.755 SRCC=0.831 KRCC=0.649

0.8

1.0

1.5 1.0 R 2=0.704 SRCC=0.775 KRCC=0.591

0.5

0.0 0.5 0.6 R 2=0.228 SRCC=0.563 KRCC=0.403

0.7

0.8

20 40 60 R 2=0.457 SRCC=0.530 KRCC=0.349

80

1000.75 1.00 1.25 R 2=0.849 SRCC=-0.885 KRCC=-0.719

1.50

40 60 R 2=0.801 SRCC=0.920 KRCC=0.760

1000.10 0.15 R 2=0.781 SRCC=0.935 KRCC=0.788

0.20

0.5 0.0 R 2=0.918 SRCC=0.946 KRCC=0.806

0.5

2 3 R 2=0.940 SRCC=0.937 KRCC=0.792

4

0.6

0.2 0.4 0.6 R 2=0.746 SRCC=0.812 KRCC=0.621

0.8

1.0

1.5 1.0 R 2=0.728 SRCC=0.772 KRCC=0.575

0.5

0.6 R 2=0.280 SRCC=0.598 KRCC=0.406

0.7

0.8 20 40 60 R 2=0.006 SRCC=-0.272 KRCC=-0.186

80

100

2.0

20 40 60 R 2=0.462 SRCC=0.744 KRCC=0.577

80

100 0.1 0.2 R 2=0.731 SRCC=0.924 KRCC=0.751

0.3

0.5 0.0 R 2=0.881 SRCC=0.943 KRCC=0.793

0.5

2 3 R 2=0.854 SRCC=0.925 KRCC=0.782

4

0.2

0.8

1.5

0.5

0.60

75

1000.10

0.5

1.6

0.6 0.4 0.2 0.0 0.6 0.8 2=0.976 1.2 RSRCC=0.845 1.0 KRCC=0.712 0.8 0.6 0.4 0.2 0.4 0.6 0.8 1.2 R 2=0.818 SRCC=0.951 1.0 KRCC=0.840 0.8 0.6 0.4 0.2 0.0 0.4 0.6 0.8 1.2 R 2=0.743 SRCC=0.919 1.0 KRCC=0.775 0.8 0.6 0.4 0.2 0.0 0.4 0.6 0.8

ID Accuracy

1.0

0.2

0.4 0.6 SHARPNESS

0.4

0.6 AC

1.0 ANE

0.70

0.65 0.70 MDE

0.75

20

40 RANKME

60

1.0 1.5 R 2=0.277 SRCC=-0.612 KRCC=-0.420

2.0 20 40 60 R 2=0.861 SRCC=0.852 KRCC=0.742

1.00 1.25 1.50 1.75 2.00 0 ALPHAREQ

25

80

80

50 ATC

0.15

0.20

DDBglobal (ours)

0.5

0.0

DDBdeep (ours)

4

1.8

5

DDBout (ours)

5

2.0

Figure 8. All pre-deployment metrics’ scatter plots for all 12 (ID→OOD) generalization tasks in PACS. Each blue dot represents one trained network. Each row represent one generalization task, and the name is shown in the y-axis label. Each column represent one predeployment metric. Y-axis shows models’ performance on the OOD domain, and x-axis shows value of the corresponding metric. All raws share the same y-axis.

making it better suited for uncovering the full underlying algorithm. In practice, these integrals are approximated using

discrete samples of k, following the implementation protocol of Mueller et al. [51].

ID hospital1

R 2=0.656 0.95 SRCC=0.835 KRCC=0.650 0.90

R 2=0.018 SRCC=-0.121 KRCC=-0.061

R 2=0.716 SRCC=0.887 KRCC=0.723

R 2=0.739 SRCC=0.886 KRCC=0.724

R 2=0.424 SRCC=0.826 KRCC=0.618

R 2=0.002 SRCC=0.071 KRCC=0.051

R 2=0.124 SRCC=-0.144 KRCC=-0.094

R 2=0.768 SRCC=0.888 KRCC=0.703

R 2=0.576 SRCC=0.731 KRCC=0.542

R 2=0.738 SRCC=0.903 KRCC=0.735

R 2=0.813 SRCC=0.936 KRCC=0.774

0.85 0.80 0.75

ID hospital2

0.85 0.90 R 2=0.205 1.0 SRCC=0.511 KRCC=0.328

0.95

1.00 0.2 0.4 R 2=0.167 SRCC=0.284 KRCC=0.220

0.6 0.7 0.8 R 2=0.353 SRCC=0.728 KRCC=0.529

0.9

0.4 R 2=0.383 SRCC=0.720 KRCC=0.513

0.2

0.70 0.75 R 2=0.271 SRCC=0.667 KRCC=0.432

0.80

0

0.95

1.00

0.6

0.9

0.6

0.2

0.700 0.725 0.750 0.775 0 MDE

100 R 2=0.158 SRCC=0.343 KRCC=0.265

200

0.75 1.00 1.25 R 2=0.419 SRCC=-0.374 KRCC=-0.289

1.50

1.75

85 90 R 2=0.454 SRCC=0.759 KRCC=0.593

95 0.10 0.12 0.14 R 2=0.349 SRCC=0.521 KRCC=0.378

0.16

0.6 0.4 0.2 0.0 R 2=0.510 SRCC=0.817 KRCC=0.613

0.2

2 R 2=0.498 SRCC=0.732 KRCC=0.538

0.25

2

3

4

0.8 0.6 0.4

0.85

0.90

ID Accuracy

0.2

0.4 SHARPNESS

0.7

0.8 AC

0.4 ANE

100 200 RANKME

0.75 1.00 1.25 1.50 1.75 ALPHAREQ

80

ATC

90

0.10 0.12 0.14 0.16 0.18

DDBglobal (ours)

0.50

0.25 0.00

DDBdeep (ours)

3

DDBout (ours)

4

Figure 9. All pre-deployment metrics’ scatter plots for the 2 (ID→OOD) generalization tasks in the Camelyon17 dataset.

Results and analysis. Tables 11 and 10 report CPR and CMD across datasets and methods. We observe that Uniform Gradient Sampling (UGS) achieves the highest overall faithfulness, followed closely by EAP-IG-inputs. However, UGS incurs prohibitive computational cost due to repeated gradient sampling, making it impractical for large-scale analyses. In contrast, EAP-IG-inputs achieves comparable faithfulness with significantly lower computational overhead, offering a practical balance between interpretability fidelity and efficiency. Consequently, we adopt EAP-IG-inputs as the primary circuit discovery method in the remainder of our work.

H. Training Dynamic of the DDB Metric We present the training dynamics of the Dependency Depth Bias (DDB) metric alongside the corresponding OOD performance for all three pre-deployment datasets in Figure 12. Across all datasets, DDB closely follows the trajectory of OOD accuracy throughout training, confirming that it captures the evolving generalization behavior of the model.

I. Ablation on τ for DDB Metrics To better understand the sensitivity of the Dependency Depth Bias (DDB) metric to its hyperparameter τ , we conduct an extensive ablation across all three DDB variants. Recall that τ ∈ (0, 0.5] controls the partitioning of shallow versus deep layers, influencing how the metric weighs shallow- versus deep-layer circuit contributions. We have shown the ablation results for DDBout in Section 3. Here we report the results for DDBout and DDBout in Table 12 and Table 13, respectively. While DDB values vary noticeably with different choices of τ , the results reveal a consistent and optimal value that yields the strongest correlation with OOD performance. These findings indicate that, although DDB is sensitive to τ , selecting τ with the optimal value leads to consistently strong predictive performance.

J. Generalization Motifs Here, we visualize the extracted Generalization Motifs obtained via CCA analysis for all pre-deployment generaliza-

Table 12. Ablation on DDBdeep ’s hyperparameter τ . The results consistently show that τ = 0.3 yields the strongest correlation scores.

τ

Score R2 SRCC KRCC

0.1

0.2

0.3

0.4

0.5

0.441 0.780 0.592

0.467 0.788 0.609

0.750 0.853 0.681

0.491 0.743 0.565

0.433 0.630 0.478

Table 13. Ablation on DDBglobal ’s hyperparameter τ . The results consistently show that τ = 0.1 yields the strongest correlation scores.

τ

Score 2

R SRCC KRCC

0.1

0.2

0.3

0.4

0.5

0.683 0.786 0.620

0.516 0.653 0.514

0.541 0.655 0.519

0.500 0.606 0.478

0.447 0.553 0.433

tion tasks (Figure 13). Each motif is shown as a heatmap that highlights the pro- and anti-generalization inter-layer connections of a given task T . Although the motifs differ across tasks, they also exhibit consistent global patterns. In particular, we observe a strong contrast between the correlation strengths of shallow versus deep layers, a recurring phenomenon that directly motivates the design of our DDB metric.

K. Overhead Analysis To understand the practical feasibility of using circuit metrics for model evaluation and selection, we analyze the computational overhead introduced by circuit discovery and circuit metric calculation. Circuit discovery is the major overhead. Confidencebased metrics require only a single forward pass to obtain logits. This operation is highly efficient and scales linearly with the number of input samples n. Empirically, on an NVIDIA A6000 GPU, a forward pass with a batch size

R 2=0.575 SRCC=0.835 0.15 KRCC=0.687

R 2=0.368 SRCC=0.780 KRCC=0.615

R 2=0.278 SRCC=0.471 KRCC=0.335

R 2=0.399 SRCC=0.532 KRCC=0.373

R 2=0.714 SRCC=0.864 KRCC=0.695

R 2=0.016 SRCC=0.524 KRCC=0.318

0.8

0.9 0.00 0.25 0.50 0.75 1.00 R 2=0.459 SRCC=0.727 KRCC=0.509

0.6 R 2=0.290 SRCC=0.477 KRCC=0.359

0.7

0.8

1.2 1.0 R 2=0.402 SRCC=0.561 KRCC=0.408

0.6 0.7 2=0.721 0.4 RSRCC=0.810 KRCC=0.616 0.3

0.8

0.90.00 0.25 0.50 0.75 1.00 R 2=0.581 SRCC=0.764 KRCC=0.558

0.6 R 2=0.220 SRCC=0.444 KRCC=0.345

0.7

0.8

1.2 1.0 R 2=0.401 SRCC=0.605 KRCC=0.453

0.8

0.6 0.775 0.800 0.825 0.850 R 2=0.494 SRCC=0.840 KRCC=0.666

0.8

0.90.00 0.25 0.50 0.75 1.00 R 2=0.338 SRCC=0.587 KRCC=0.416

0.6 0.7 R 2=0.622 SRCC=0.808 KRCC=0.592

0.8

1.25 1.00 R 2=0.517 SRCC=0.757 KRCC=0.556

0.75

0.50

0.8

0.00 0.25 0.50 0.75 1.00 R 2=0.213 SRCC=0.487 KRCC=0.328

0.4 0.5 0.6 R 2=0.190 SRCC=0.433 KRCC=0.286

0.7

0.8

0.00 0.25 0.50 0.75 1.00 R 2=0.298 SRCC=0.467 KRCC=0.304

0.8

location43 location38 location43 location46 location43 location100

R 2=0.668 SRCC=0.904 KRCC=0.727

0.8

0.6 0.76 0.78 R 2=0.613 SRCC=0.828 KRCC=0.623

0.80

0.82

0 50 R 2=0.048 SRCC=0.261 KRCC=0.158

0

100

150 1.0 1.2 1.4 R 2=0.155 SRCC=-0.561 KRCC=-0.343

100 R 2=0.167 SRCC=0.451 KRCC=0.272

1.6

1.8

1.5

40 60 R 2=0.042 SRCC=0.202 KRCC=0.165

80

100 0.10 0.12 R 2=0.652 SRCC=0.810 KRCC=0.596

0.14

0.6 0.4 R 2=0.608 SRCC=0.779 KRCC=0.587

0.2

0.0

2 R 2=0.700 SRCC=0.855 KRCC=0.670

3

2.0 20 40 60 R 2=0.032 SRCC=0.166 KRCC=0.137

80

100 0.10 0.12 R 2=0.753 SRCC=0.819 KRCC=0.607

0.14

0.6 0.4 R 2=0.789 SRCC=0.846 KRCC=0.643

0.2

0.01

2 R 2=0.743 SRCC=0.832 KRCC=0.620

3

4

20 40 60 R 2=0.521 SRCC=0.701 KRCC=0.490

80

1000.10 0.12 R 2=0.736 SRCC=0.804 KRCC=0.589

0.6 0.4 0.2 0.0 R 2=0.709 SRCC=0.821 KRCC=0.610

0.2

2 R 2=0.722 SRCC=0.856 KRCC=0.665

3

4

20 40 R 2=0.013 SRCC=0.089 KRCC=0.069

60

80 0.10 0.12 R 2=0.755 SRCC=0.865 KRCC=0.666

200

1.0 R 2=0.218 SRCC=-0.448 KRCC=-0.304

150

1.0 1.5 R 2=0.043 SRCC=-0.170 KRCC=-0.119

0.8 1.50 1.25 1.00 0.75 0.50 0.725 0.750 0.775 0.800 50 R 2=0.222 R 2=0.208 R 2=0.064 SRCC=0.466 SRCC=0.617 SRCC=0.347 KRCC=0.317 KRCC=0.425 KRCC=0.206

100

1.0 1.2 1.4 R 2=0.308 SRCC=-0.577 KRCC=-0.389

0.4 0.6 R 2=0.473 SRCC=0.646 KRCC=0.443

0.8

1.5 1.0 R 2=0.412 SRCC=0.660 KRCC=0.466

0.5

0.70 0.75 R 2=0.205 SRCC=0.687 KRCC=0.500

50 100 R 2=0.348 SRCC=0.627 KRCC=0.464

150

1.00 1.25 1.50 1.75 2.00 40 R 2=0.444 R 2=0.610 SRCC=-0.550 SRCC=0.700 KRCC=-0.434 KRCC=0.480

0.00 0.25 0.50 0.75 1.00 R 2=0.285 SRCC=0.561 KRCC=0.407

0.4 0.6 R 2=0.472 SRCC=0.731 KRCC=0.541

0.8

1.5 1.0 R 2=0.429 SRCC=0.720 KRCC=0.521

0.5

0.70 R 2=0.179 SRCC=0.674 KRCC=0.491

25 50 R 2=0.167 SRCC=0.515 KRCC=0.327

100

1.0 1.5 R 2=0.325 SRCC=-0.472 KRCC=-0.343

2.0

0.8

0.9

0.2 0.4 R 2=0.309 SRCC=0.549 KRCC=0.397

0.6

0.8

0.4 0.6 R 2=0.751 SRCC=0.846 KRCC=0.659

0.8

1.5 1.0 R 2=0.712 SRCC=0.842 KRCC=0.648

0.5

0.75 R 2=0.522 SRCC=0.871 KRCC=0.688

0.80

1.0 1.2 1.4 R 2=0.258 SRCC=-0.446 KRCC=-0.302

1.6

0.8

0.9

0.2 0.4 R 2=0.178 SRCC=0.468 KRCC=0.327

0.6

0.8

0.4 0.6 R 2=0.483 SRCC=0.670 KRCC=0.493

0.8

1.5 1.0 R 2=0.481 SRCC=0.692 KRCC=0.519

0.5 0.65 0.70 R 2=0.422 SRCC=0.805 KRCC=0.624

0.75

0.8

0.9

0.2 0.4 R 2=0.261 SRCC=0.540 KRCC=0.370

0.6

0.8

0.4 0.6 R 2=0.259 SRCC=0.559 KRCC=0.378

0.8

1.5 1.0 R 2=0.234 SRCC=0.563 KRCC=0.379

0.5

0.9

0.5 R 2=0.266 SRCC=0.495 KRCC=0.331

1.0

0.6 R 2=0.040 SRCC=0.123 KRCC=0.078

0.8

1.25 1.00 0.75 0.50 0.25 0.75 0.80 R 2=0.029 R 2=0.169 SRCC=0.138 SRCC=0.500 KRCC=0.092 KRCC=0.321

0.9

0.5 R 2=0.237 SRCC=0.484 KRCC=0.337

1.0

0.5 0.6 R 2=0.325 SRCC=0.545 KRCC=0.383

0.7

4

0.775 0.800 0.825 0.850 0 50 100 R 2=0.323 R 2=0.013 SRCC=0.725 SRCC=0.245 KRCC=0.518 KRCC=0.098

2.0

0.14

0.16

0.12 0.10 0.08 0.4 0.6 0.35 R 2=0.354 SRCC=0.601 0.30 KRCC=0.397 0.25

1.6

0.14

0.7 0.6 0.5 R 2=0.776 SRCC=0.847 KRCC=0.651

0.4

1.5 2.0 R 2=0.846 SRCC=0.913 KRCC=0.745

2.5

60

0.100 80 0.125 0.150 0.175 0.200 0.6 0.4 0.2 R 2=0.881 R 2=0.807 SRCC=0.882 SRCC=0.827 KRCC=0.677 KRCC=0.656

0.0

2.5 3.0 R 2=0.675 SRCC=0.765 KRCC=0.571

3.5

4.0

20 40 R 2=0.138 SRCC=0.490 KRCC=0.344

60

80 0.100 0.125 0.150 0.175 R 2=0.771 SRCC=0.912 KRCC=0.726

0.8 0.6 0.4 R 2=0.573 SRCC=0.751 KRCC=0.547

0.2

2 R 2=0.761 SRCC=0.804 KRCC=0.603

3

4

20 40 R 2=0.303 SRCC=0.437 KRCC=0.338

60

0.10 0.11 0.12 R 2=0.606 SRCC=0.747 KRCC=0.534

0.13

0.6 0.5 R 2=0.512 SRCC=0.679 KRCC=0.478

0.4

1.5 2.0 R 2=0.705 SRCC=0.817 KRCC=0.623

2.5

3.0

20 40 R 2=0.132 SRCC=0.224 KRCC=0.149

60

80 0.10 0.12 R 2=0.826 SRCC=0.882 KRCC=0.697

0.16

0.6 0.4 R 2=0.668 SRCC=0.866 KRCC=0.665

0.2

2 R 2=0.692 SRCC=0.827 KRCC=0.627

0

25 50 R 2=0.346 SRCC=0.584 KRCC=0.418

75

1000.10 0.12 0.14 R 2=0.560 SRCC=0.716 KRCC=0.536

2.00

20 40 R 2=0.087 SRCC=0.150 KRCC=0.102

60

0 20 40 R 2=0.149 SRCC=0.351 KRCC=0.238

60

0.20 0.15 0.10 0.4 0.6 2=0.422 0.25 RSRCC=0.595 0.20 KRCC=0.392 0.15 0.10 0.05 0.00 0.4 0.6 R 2=0.424 0.20 SRCC=0.627 KRCC=0.472

0.80 0

0.75

0

75

1

0.15 0.10 0.05

location46 location43

location46 location38

R 2=0.519 SRCC=0.755 KRCC=0.579

0.1

0.6 0.7 R 2=0.370 0.16 SRCC=0.618 KRCC=0.416 0.14

location46 location100 location100 location38

R 2=0.551 SRCC=0.806 KRCC=0.642

0.2

0.5 0.6 0.7 R 2=0.775 SRCC=0.880 0.4 KRCC=0.722

0.850 50 R 2=0.301 SRCC=0.570 KRCC=0.414

100

80

0.3 0.2 0.1

0.5 0.6 0.7 R 2=0.536 SRCC=0.745 0.3 KRCC=0.576

0

50 R 2=0.218 SRCC=0.547 KRCC=0.402

100

1.00 1.25 R 2=0.311 SRCC=-0.576 KRCC=-0.417

1.50

1.75

0.14

3

0.2 0.1

0.0 0.5 0.6 0.7 2=0.395 0.25 RSRCC=0.628 KRCC=0.447 0.20

0.70 R 2=0.161 SRCC=0.528 KRCC=0.371

0.75

0.80 0 50 R 2=0.077 SRCC=0.414 KRCC=0.284

100

1.0 1.5 R 2=0.198 SRCC=-0.403 KRCC=-0.260

2.0

0.16

0.6 0.4 R 2=0.719 SRCC=0.848 KRCC=0.653

0.2

2 R 2=0.657 SRCC=0.846 KRCC=0.632

0.6 0.4 R 2=0.578 SRCC=0.702 KRCC=0.492

0.2

1.5 2.0 R 2=0.731 SRCC=0.819 KRCC=0.623

3

0.15 0.10 0.05

0.6 0.7 0.8 R 2=0.535 SRCC=0.597 KRCC=0.415 0.15 0.20

location100 location43

R 2=0.020 SRCC=0.197 KRCC=0.149

0.05

0.6 0.7 0.175 R 2=0.649 SRCC=0.819 0.150 KRCC=0.597 0.125 0.100 0.075 0.050

location100 location46

R 2=0.015 SRCC=-0.355 KRCC=-0.241

0.10

location38 location100

location38 location46

location38 location43

0.20

0.85

0.900

0.75

0

50 100 R 2=0.354 SRCC=0.706 KRCC=0.512

150

1.0 R 2=0.533 SRCC=-0.717 KRCC=-0.505

1.5

50 R 2=0.183 SRCC=0.393 KRCC=0.284

100

1.00 1.25 1.50 1.75 R 2=0.325 SRCC=-0.534 KRCC=-0.353

80

0.10 0.12 R 2=0.597 SRCC=0.770 KRCC=0.562

0.14

0.16

2.5

0.10 0.05 0.6 0.7 0.8 0.25 R 2=0.681 SRCC=0.780 0.20 KRCC=0.602

0.8 1.4 1.2 1.0 R 2=0.299 SRCC=0.543 KRCC=0.367

0.8

0.6 0.65 0.70 R 2=0.437 SRCC=0.771 KRCC=0.567

800.100 0.125 0.150 0.175 R 2=0.518 SRCC=0.738 KRCC=0.525

0.6 0.4 0.2 R 2=0.537 SRCC=0.736 KRCC=0.538

0.0

2 R 2=0.662 SRCC=0.815 KRCC=0.601

3

4

0.15 0.10 0.05 0.00

0.6

0.7

0.8

ID Accuracy

0.9

0.5 1.0 SHARPNESS

0.5

0.6 AC

0.7

1.4

1.2 1.0 ANE

0.8 0.68 0.70 0.72 0.74 0.76 0 MDE

50

100 RANKME

150

1.0

1.5 ALPHAREQ

2.0

20

40 ATC

60

0.10

0.12

0.14

DDBglobal (ours)

0.16 0.6

0.4

0.2

DDBdeep (ours)

0.0

2

3

DDBout (ours)

Figure 10. All pre-deployment metrics’ scatter plots for all 12 (ID→OOD) generalization tasks in the Terra Incognita dataset.

of 32 through a ViT-B/16 model takes approximately 123 ms. Circuit discovery, in contrast, requires gradient-based estimation of edge-level contributions. The EAP-IG [27] method used in our experiments performs one forward pass followed by a fixed number of backward passes; following

Hanna et al. [27], we set this number to 5. Under identical hardware and batch size, full circuit discovery requires approximately 1585 ms per batch, which is the major bottleneck. Figure 14 further break down the computation overhead

Ours

Baselines

PACS

Ours

Baselines

FMoW

Ours

Baselines

Camelyon17

Figure 11. All post-deployment metrics’ scatter plot. In each plot, the yellow triangles represent OOD domains in the dataset, Y-axis shows models’ GT performance on the OOD domain, and x-axis shows value of the corresponding metric. All rows share the same y-axis.

in circuit discovery, showing that the backward pass is the primary computational bottleneck. Hence we propose two solutions to accelerate circuit discovery. (1) In this work we adopt EAP-IG for circuit discovery, which requires multiple rounds of forward and backward passes due to Integrated Gradients (IG). Using EAP instead can eliminate multiple

IG passes. Profiling results show that this achieves approximately a 5× speedup, which means the integration steps in the IG method could be reduced to directly optimize runtime. (2) Backward passes can be further approximated with zeroth-order gradient approximation [16], further improving efficiency while reducing memory usage and en-

2

0.4

1 0

0.2 0.0

1 0

50

100

150

Training Steps

200

1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3

4

2 1 0 250

500

750 1000

Training Steps

4

0.30

3

0

Terra Incognita

0.35

1

0.25

3

0.20

2

0.15

1

0.10

0

0.05 0.00

DDBout (Ours)

0.6

Weak generalization

DDBout (Ours)

3

DDBout (Ours)

OOD Accuracy

0.8

OOD Accuracy

4

Strong generalization

Camelyon17

OOD F1

1.0

DDBout (Ours)

OOD acc/F1

PACS

0

250

500

750 1000

1

Training Steps

Figure 12. The training dynamics of OOD performance (left y-axis) vs. our DDBout metric (right y-axis) on PACS, Camelyon17 and Terra Incognita. Across all datasets, DDB closely follows the trajectory of OOD accuracy throughout training, confirming that it captures the evolving generalization behavior of the model. PACS Motifs

Camelyon17 Motifs

Terra Incognita Motifs

Figure 13. Pre-deployment Generalization Motifs vT (Eq.3) of all tasks. Brighter regions indicate the inter-layer dependencies positively correlated with OOD generalization; darker regions indicate negative correlations.

abling larger batch parallelism. Metric calculation overhead is negligible. After circuits are discovered, the computation of circuit metrics (e.g., DDB, CSS) involves only graph-level operations on the induced circuit structure. These operations scale as O(L2 ), where L is the number of Transformer layers. Importantly, this does not scale with number of input samples. As a result, each circuit graph needs to be processed only

once.In practice, metric computation takes approximately 52,ms per circuit, which is negligible compared to the cost of circuit discovery. Furthermore, circuits can be aggregated across multiple batches prior to metric evaluation, amortizing this overhead even further.

5x Figure 14. Circuit discovery runtime profile for a single batch (size 32). Backward pass is the major bottleneck, and replacing EAP-IG with EAP yields approximately 5× speedup.

Record · ID 2614 · SHA-256 530f1424f4e7f9ae
Conceptio Open Knowledge Archive — every document is proof-bundled with source, license, and retrieval metadata.