Input Space Mode Connectivity in Deep Neural Networks

## Abstract

Abstract We extend the concept of loss landscape mode connectivity to the input space of deep neural networks. Mode connectivity was originally studied within parameter space, where it describes the existence of low-loss paths between different solutions (loss minimizers) obtained through gradient descent. We present theoretical and empirical evidence of its presence in the input space of deep networks, thereby highlighting the broader nature of the phenomenon. We observe that different input images with similar predictions are generally connected, and for trained models, the path tends to be simple, with only a small deviation from being a linear path. Our methodology utilizes real, interpolated, and synthetic inputs created using the input optimization technique for feature visualization. We conjecture that input space mode connectivity in high-dimensional spaces is a geometric effect that takes place even in untrained models and can be explained through percolation theory.
We exploit mode connectivity to obtain new insights about adversarial examples and demonstrate its potential for adversarial detection. Additionally, we discuss applications for the interpretability of deep networks.

## 1 Introduction

The high-dimensional nature of the parameter space in deep neural networks (DNNs) gives rise to the intriguing phenomenon of loss landscape mode connectivity. This concept reveals that different solutions of the model, achievable through stochastic gradient descent (SGD) training, are not isolated but rather interconnected by simple paths of low loss \citepMC1_Garipov2018, MC2_Draxler2018. This observation challenges the classical view of the loss landscape, which is traditionally perceived as containing many equivalent, discrete minima \citepKawaguchi2016.

Connections between the modes can be as simple as linear in specific cases \citepNagarajan2019, while they are often quadratic or piece-wise linear in the majority of cases. Linear mode connectivity (LMC) can be associated with the consistency of mechanisms employed by models for predictions \citepLubana2023 (e.g., background vs. object in image classification models). Interestingly, LMC relates to the concept of lottery tickets and their stability to SGD noise after a few initial training iterations \citepFrankle2020.

Mode connectivity can be utilized for enhanced ensembling strategies to create more diverse ensembles \citepMC1_Garipov2018. This approach can significantly boost the accuracy and generalization capabilities of models, especially in handling out-of-distribution data \citepFort2020. Furthermore, parameter space mode connectivity can be employed to repair backdoored or error-injected models \citepZhao2020.

The exact causes for mode connectivity within neural networks remain elusive. Architectural symmetries (node permutation) are known contributors \citepZhao2023 but do not explain the full picture. Commonly used loss functions also significantly contribute to the degeneracy of the parameter space.
Our work further explores the hypothesis that mode connectivity is a more general phenomenon of high dimensional geometry, partially studied in \citetFort2019_pheno.

As we demonstrate, the concept of mode connectivity can be generalized to the input space of a neural network. In contrast to the originally studied parameter space, where data are fixed and model (parameters) variable, we employ an inverted setup (fixed model, variable data). We utilize real, virtual (interpolated), and synthetic inputs, which are obtained by input optimization \citepOlah2017.
Considering the cross-entropy loss,
we prepare and compute several examples of optimal inputs (natural images, high-frequency patterns, adversarial examples) and show that they are mode connected in vision models for classification. Insights about the connectivity reveal the potential for adversarial detection and interpretability of DNNs.
We propose that the existence of input space mode connectivity can be explained through high-dimensional percolation, which is a purely geometrical phenomenon.
We also note that trained networks exhibit (approximate) linear mode connectivity for many real examples, and we speculate that this could be an aspect of the implicit regularization of deep learning.

Contributions

- •
We extend the concept of mode connectivity from the original parameter space to the input space of (vision) DNNs.
- •
We observe fundamental differences in connections between loss-minimizing inputs in various setups (real vs. real images, real vs. adversarial attacks, synthetic images) that allow us to distinguish between them.
- •
We propose a novel method for detecting adversarial examples that outperforms baselines for advanced attacks (deepfool \citepdeepfool and Carlini-Wagner (C&W) \citepCarlini2017).
- •
We state a conjecture: that arbitrary inputs with the same prediction are mode connected in randomly initialized neural networks. We provide a proof sketch for this conjecture, based on percolation theory \citephugo2017_percolation.

## 2 Related work

Prior work of \citetjacobsen2018excessive studied the phenomenon of excessive input invariance in neural networks. This research later inspired \citetblindspots to explore a specific form of input space connectivity between real inputs and so-called invariance-based adversarial examples (referred to as blind spots). Remarkably, these blind spots can closely resemble images from different classes with entirely different semantics than the reference image, yet they maintain the same model prediction confidence along the linear interpolant paths to the reference.
In contrast, we study the connectivity between almost any pair of inputs that have similar model outputs. The major difference from \citepblindspots is that invariance-based adversarial examples are (from the model’s perspective) out-of-distribution pathological samples, whereas we consider all possible inputs. Moreover, we empirically and theoretically demonstrate that (loss-based) input space mode connectivity exists in general, including untrained networks.

Our work is directly motivated and inspired by seminal research on parameter space mode connectivity \citepMC1_Garipov2018, MC2_Draxler2018. We leverage various established methods and analytical tools to explore connectivity in the input space. Notably, we adapted a simplified algorithm to bypass loss barriers from \citetFort2019_pheno. In the same work, authors proposed a phenomenological model of the high-dimensional loss landscape that allows analysis of the training dynamics and mode connectivity.
\citetYunis2022 identified a high-dimensional convex hull of low loss between multiple loss minimizes, which is relevant to the discussion about the optimal input manifold. \citetSimsek2021 show that even originally discrete minima can be connected by adding a single neuron to each layer, highlighting the significance of space dimensionality and generality of the phenomenon.

We also build on the feature visualization by optimization technique \citepOlah2017 to create optimal inputs and to prepare adversarial attacks. For the discussion about adversarial detection, we follow and adapt the benchmark from \citetHarder2021.

Figure: Figure 1: Barrier between two input modes. Two examples (A and C) that minimize loss for the class jackfruit are shown. The interpolated point B exhibits maximal loss. Left middle: Cross-entropy loss for interpolated virtual points between A and C. Left bottom: Diagram illustrating the interpolation paths and subsequent optimization of point B, constrained within the orthogonal hyperplane to vector AC. The optimized point B’ minimizes the loss and is nearly indistinguishable from the original point B. Right bottom: Normalized difference pattern B’$-$B, where the maximum pixel value of the difference pattern is 1–5% of the maximum pixel in the original image.
Refer to caption: extracted/5843237/figures/fig1_upd.png

## 3 Methodology

### 3.1 Mode connectivity (from parameter to input space)

We define a parameter space mode as a set of parameters $\theta_{i}$ that minimizes the loss $\mathcal{L}$ (e.g., cross-entropy for classification task) for a given dataset. That is

$$ $\theta_{i}=\underset{\theta}{\mathrm{argmin}}\ \mathcal{L}(f(\mathcal{D}; \theta_{i})),$ (1) $$

where $f(\cdot;\theta)$ is a neural network output, and $\mathcal{D}$ is a dataset that contains both data samples $\mathcal{X}$ and ground truth $y$. Loss minimizers in the parameter space are usually obtained through SGD,
with diversity arising
simply from using different initializations and/or exploiting other sources of randomness such as the sequence in which examples are presented to the model during SGD-based training.

Analogically, the input space mode for a selected class $y_{i}$ is a single data example

$$ $x_{i}=\underset{x}{\mathrm{argmin}}\ \mathcal{L}(f(x_{i};\theta),y_{i}),$ (2) $$

where in contrast to the parameter space, the model is fixed (pretrained). Input modes could be either real data examples with loss below a certain small threshold $\delta$ or obtained through an optimization process (see Section 3.2).

After observing two (or potentially more) modes $x_{\mathrm{A}}$ and $x_{\mathrm{C}}$, we linearly interpolate them to create virtual points ${x}_{\mathrm{A\rightarrow C}}(\alpha)$ as

$$ ${x}(\alpha)=\alpha x_{i}+(1-\alpha)x_{j},$ (3) $$

where $\alpha\in[0,1]$ is uniformly sampled. In general, a loss barrier exists between the two modes (Fig. 1 left middle). The barrier can be bypassed through optimization, which results in modes connected by simple (partially linear) paths of low loss. The optimization follows the procedure described in Section 3.2. In the following sections, we use a simplified notation $x_{\mathrm{A}}\equiv\mathrm{A}$ for points/images, and A$\rightarrow$C denotes a path between A and C.

### 3.2 Feature visualization by optimization (FVO)

FVO is a technique for post-hoc interpretability of DNNs \citepOlah2017. It starts from a small noise $x_{i}$ at the input of a network that is forward propagated to the layer of interest. We aim to find inputs that activate a selected neuron (or neurons) within the layer of interest.
Neurons can be either maximized or activated to a specific pattern through a loss function. The input is iteratively updated w.r.t. the gradient of the loss, similarly to the standard gradient descent training. Note that this optimization process does not produce an unique result, and so multiple distinct examples can be generated and their (input space) mode connectivity studied.

The optimization procedure can be easily adapted for real images. We start from the max loss intermediate point B and optimize until we reach B’, which minimizes the loss (see left bottom diagram in Figure 1). The optimization is constrained within the orthogonal hyperplane to the vector AC, representing a simplified method for connecting modes inspired by \citetFort2019_pheno.

## 4 Experiments

In this section, we provide empirical evidence for the input space mode connectivity in pretrained vision models and discuss potential applications of the phenomenon. First, we show how the two modes can be connected through the optimization of the loss barrier. Second, we study and exploit the connectivity between adversarial attacks and natural images to create an algorithm for adversarial detection. Third, we discuss the potential for interpretability of DNNs. Last, we show that the connectivity exists for untrained (randomly initialized) networks, which validates our theoretical result in Section 5. We used cross-entropy loss for all experiments unless explicitly stated otherwise.
Experiments have minimal compute requirements and were carried out on a regular PC (equipped with GTX 1650 4GB) or cloud services (T4 16GB). Sections 4.1, 4.2, and 4.3 use GoogLeNet(ImageNet); subsection 4.2.1 uses VGG-16(CIFAR10/100); section 4.4 uses ResNet18.

### 4.1 Input space connectivity

Vision models trained for classification tasks provide an ideal setup to observe input space mode connectivity. To demonstrate this phenomenon in a realistic and practically relevant setting, we used GoogLeNet (Inception v1) \citepgooglenet2014 that was pretrained on the ImageNet \citepimagenet15 and is available from the PyTorch torchvision library \citeppytorch. First, we selected representative low-loss examples from the validation dataset, which have cross-entropy loss in the order of 1e-4 or lower. These examples were linearly interpolated with 1,000 uniformly distributed points. After identifying the interpolated point of maximum loss B, we started a constrained optimization process, encompassing 1024 iterations, which resulted in a good loss minimizer B’ (Fig. 1). The Adam optimizer \citepKingma2017 was used with a learning rate of 0.005. We added regularization to the optimization with two additional terms: the mean squared error (MSE) between B and B’, and a high-frequency term that penalizes changes in adjacent pixels. The weights for these terms, $\lambda_{\mathrm{MSE}}=0.1$ for the MSE and $\lambda_{\mathrm{HF}}$ ranging from $1e-8$ to $5e-6$ for the high-frequency term, were determined heuristically, varying by class and setup.

A new path (A$\rightarrow$B’$\rightarrow$C) was created by merging the linear interpolations between A and B’, and between B’ and C. We sampled 500 intermediate points equally from both segments of the new path, disregarding the fact that the barrier typically does not lie exactly at the midpoint of A$\rightarrow$C. The A$\rightarrow$B’$\rightarrow$C path exhibits low loss while connecting two input modes (Fig. 2). Although small secondary barriers are still present in the A$\rightarrow$B’$\rightarrow$C path, we neglect them as far as they are below a certain threshold ($\delta=0.001$ considered here). By repeating the optimization process, we can easily bypass secondary barriers. More examples and qualitatively consistent results from ResNet18 \citepRESNET trained on CIFAR-10 \citepCIFAR are shown in the Appendix E.

Figure: Figure 2: Bypassing the barrier. After optimizing the intermediate point B, we obtained the updated point B’, which linearly connects to both A and C. Note that small secondary barriers, below the threshold of $\delta=0.001$ loss, are disregarded.
Refer to caption: extracted/5843237/figures/fig2_upd.png

Images along the two studied paths closely resemble each other in corresponding pairs, as shown in Figure 3. In fact, their difference is the identical pattern depicted in the right bottom of Figure 1, scaled in intensity proportionally to the interpolation factor $\alpha$.
This is likely due to the process we use to find B’, which resembles the way gradient descent is used to find adversarial examples, the differences being that we restrict the search to a hyperplane and do require B’ to remain close to B.

Figure: Figure 3: Images along two paths. We sampled and compared images along the updated path A$\rightarrow$B’$\rightarrow$C (dashed rectangle) and the original linear path A$\rightarrow$C (bottom row). These paths are illustrated in the diagram in Figure 1. The high-loss intermediate point B and its optimized version B’ are denoted by the blue vertical rectangle.
Refer to caption: extracted/5843237/figures/continuous_new.png

### 4.2 Adversarial attacks

In this section, we demonstrate a fundamental difference in the connectivity between real–real and real–adversarial image pairs. We subsequently leverage this insight for adversarial detection.

Adversarial examples in vision models are images that are generated by perturbing a source image in a way that either minimizes the loss for a selected target class (in targeted attacks) or maximizes the loss for the true class (in untargeted attacks), causing the model to misclassify the image.
The source image and the optimized adversarial example are often almost indistinguishable to a human observer. The process of generating and employing adversarial images to deceive the model is known as an adversarial attack (see Fig. 4).

We find that adversarial examples, even when significantly different in terms of human visual perception, are mode-connected to “true” real images (correct class minimizers). Using ImageNet and GoogLeNet, we picked a low loss example from a selected class (here golf ball) as the mode A. Then, a source image K from a different class (revolver) was optimized to obtain an adversarial example K’ (K’ minimizes the same class as the A).
We used Adam (learning rate 0.005), 1024 iterations, cross-entropy loss with penalizations (0.1*MSE for image deviation and 1e-7*high-frequency penalty).
From here, the mode connecting procedure is identical to the previously described: 1) Detect the max loss point B, 2) Optimize B to get B’, 3) Interpolate over the new path A$\rightarrow$B’$\rightarrow$K’. However, after a single round of this procedure, non-negligible secondary barriers emerge in paths A$\rightarrow$B’ and B’$\rightarrow$K’, which exceed the loss threshold $\delta$ by a considerable margin (as depicted in Fig. 5). Secondary barriers can be successfully bypassed by a repeated application of the procedure to both segments of the A$\rightarrow$B’$\rightarrow$K’ path individually. As a result, the final low-loss path will necessarily be more complex than for real–real modes addressed in Section 4.1.

Figure: Figure 4: Adversarial attack. From the left: i) real input A that minimizes the loss for class golf ball, ii) source input K from a different class, iii) optimized pattern added to the K, and iv) adversarial example K’ that minimizes the loss for the same class as A. The network predicts K’ as a golf ball.
Refer to caption: extracted/5843237/figures/attack_overview1_upd.png

Figure: Figure 5: Barriers and path complexity. Left: Max loss point B on the primary barrier (between the real mode A and adversarial attack K’). Right: Interpolated paths between points from Figure 4. The primary barrier was bypassed through the optimized point B’. Secondary barriers (with lower loss) emerged on the new path A$\rightarrow$B’$\rightarrow$K’ and can be further bypassed by a repeated application of the procedure to both segments of the new path (omitted here). This suggests that the path between a real mode A and an adversarial attack K’ is more complex than that between two real images.
Refer to caption: extracted/5843237/figures/attack_losses_1.png

In addition to the complexity of the paths, we observed significant differences in the barrier heights and shapes between two key scenarios: barriers between real–real modes and real–adversarial modes. To assess the statistical significance of this effect, we conducted the following experiment.
Seven unique pairs of images per class were selected from the validation subset of ImageNet, encompassing 1,000 classes in total. Two pairs from each class, having the highest loss difference between the inputs, were excluded. The remaining 5,000 pairs were interpolated with 250 steps in between, and loss curves were generated.
In the adversarial branch, pairs were formed by combining one example from the selected class with one from a randomly chosen different class. Adversarial examples were created in the same way as described above with the following settings: learning rate 0.005, deviation penalty weight 0.1, frequency penalty weight 1e-8, and 512 iterations. The subsequent procedure mirrored the one described earlier, yielding another set of 5,000 filtered pairs (5 per class).
Descriptive statistics for the maximum barrier height and the gap (the difference between the peak height and the loss value of the higher mode/image) are depicted in Figure 6.

Figure: Figure 6: Barrier height statistics. Boxplots depict the maximum barrier heights and gaps (i.e., the difference between the barrier height and loss value of the higher-loss mode) for selected pairs from the ImageNet validation dataset. The barriers for real–real and real–adversarial example pairs are compared. A total of 5,000 representative pairs (5 per class) were utilized for each scenario.
Refer to caption: extracted/5843237/figures/stats_box_plot.png

Real–adversarial mode pairs exhibit significantly higher barrier max, with mean and median 5.82 and 5.99, respectively. In contrast, real–real pairs have mean 2.27 and median 1.79. The effect is even more pronounced for barrier gaps, where real–adversarial have mean 5.19 and median 5.30, but real–real have mean 1.00 and median only 0.47. The described behavior was utilized to design a new method for adversarial detection.

#### 4.2.1 Adversarial detection

Enhancing the adversarial robustness of models is essential across various domains, particularly in safety-critical applications \citepPang2018. However, the majority of defenses (e.g., adversarial training) are not sufficient against advanced attacks and can be easily fooled by adaptive attacks \citepTramer2020. Instead of maintaining model accuracy against adversarial examples, an alternative is to detect attacks and invalidate predictions for such inputs \citepHan2023, Harder2021.

We propose a simple algorithm for adversarial detection that leverages the relative lack of linear connectivity in natural–adversarial image pairs (as shown in Figure 6); First, we compute the (linear-path) loss curves for all training images $x_{i}$. Each loss curve is obtained from an input pair consisting of $x_{i}$ (a training image) and $x_{\text{template},y_{i}}$ (a low-loss reference image from the same class, $y_{i}=\text{argmax }f(x_{i},\theta)$), which is preselected for each class. Second, concatenate the loss curves with logits $f(x_{i},\theta)$, sorted in descending order, which provide information about prediction confidence. This step slightly enhances performance against simpler attacks, though it can be fully ablated for attacks like deepfool and C&W). Third, resulting feature vectors (loss curves+logits) are then used to train a classifier. Test images are processed through the same pipeline and classified by the model.

We implemented the algorithm to an existing benchmark \citepHarder2021 that uses VGG-16 \citepVGG16 model and CIFAR10/100 datasets. The benchmark employs a representative selection of adversarial attacks (FGSM \citepGoodfellow2015, BIM \citepkurakin2017adversarial, PGD \citepmadry2019deep, deepfool \citepdeepfool, and C&W \citepCarlini2017) all in their untargeted forms. Interestingly, our method outperformed baselines for more advanced attacks (deepfool and the particularly challenging C&W) but underperformed on simpler (FGSM, BIM, PGD). This is a consequence of the nature of untargeted attacks, which generally aim to alter the prediction by maximizing the loss for the correct class. However, unlike FGSM, BIM, and PGD, both deepfool and Carlini & Wagner (C&W) also minimize the loss for a specific incorrect class, making the misclassification more controlled. Our algorithm relies on the existence of a distinct loss barrier, which is less pronounced in simpler attacks but more defined in advanced ones like deepfool and C&W. Complete results are provided in Table 1. Note that we used a classifier (KNN) that was optimized jointly for all attacks on validation data (in contrast to attack-dependent classifiers and hyperparameters in the benchmark). Additionally, unlike the best-performing baseline, our method does not require access to the feature maps.

**Table 1: (adapted from \citepHarder2021) Comparison of detection methods. Accuracy/AUC (%). The attacks are applied on the CIFAR-10/100 test set and the VGG-16 NET. Attacks are described in Appendix B.**
| Dataset | Detector | FGSM | BIM | PGD | Deepfool | C&W |
| --- | --- | --- | --- | --- | --- | --- |
| CIFAR-10 | LID | 86.4 / 90.8 | 85.6 / 93.3 | 80.4 / 90.0 | 78.9 / 86.6 | 78.1 / 85.3 |
|  | Mahalanobis | 95.6 / 98.8 | 97.3 / 99.3 | 96.0 / 98.6 | 76.1 / 84.6 | 76.9 / 84.6 |
|  | InputMFS | 98.1 / 99.7 | 93.5 / 97.8 | 93.6 / 97.9 | 58.0 / 60.6 | 54.7 / 56.1 |
|  | LayerMFS | 99.6 / 100 | 99.2 / 100 | 98.3 / 99.9 | 72.0 / 80.3 | 69.9 / 77.7 |
|  | LayerPFS | 97.0 / 99.9 | 98.0 / 99.9 | 96.9 / 99.6 | 86.1 / 92.2 | 86.8 / 93.3 |
|  | Mode connectivity (ours) | 69.8 / 76.8 | 95.2 / 98.6 | 91.8 / 97.4 | 91.4 / 96.9 | 93.7 / 98.3 |
| CIFAR-100 | LID | 72.9 / 81.1 | 76.5 / 85.0 | 79.0 / 86.9 | 58.9 / 64.4 | 61.8 / 67.2 |
|  | Mahalanobis | 90.5 / 96.3 | 73.5 / 81.3 | 76.3 / 82.1 | 89.2 / 95.3 | 89.0 / 94.7 |
|  | InputMFS | 98.4 / 95.5 | 89.1 / 94.1 | 90.9 / 95.1 | 58.8 / 62.2 | 53.3 / 54.6 |
|  | LayerMFS | 99.5 / 100 | 97.1 / 99.5 | 97.0 / 99.7 | 83.8 / 91.0 | 87.1 / 93.0 |
|  | LayerPFS | 96.9 / 99.3 | 90.3 / 96.7 | 92.6 / 97.6 | 78.8 / 84.4 | 79.1 / 84.0 |
|  | Mode connectivity (ours) | 67.3 / 72.8 | 84.3 / 92.5 | 88.9<br>/ 95.2 | 86.8 / 94.0 | 92.9 / 97.3 |

### 4.3 Towards optimal input manifold

Synthetic images offer a controlled environment for examining input space mode connectivity. Here, images were generated using the feature visualization by optimization technique on GoogLeNet trained on ImageNet. Starting from Gaussian noise $\mathcal{N}(0,1)$, we optimized a surrogate objective function (dot product $\times$ sqrt of cosine similarity $\times$ $1/2$), instead of directly optimizing for cross-entropy. We used this heuristic approach to generate synthetic inputs that better match human visual perception, as cross-entropy optimization, for unclear reasons, is less effective for this purpose \citepolah_discussion. Through varied regularizations and transformations during optimization, we obtained two distinct modes, each exhibiting virtually zero cross-entropy loss, as illustrated in Figure 7. Mode A exhibits partial resemblance to natural objects of its class (golf ball). Mode B contains only high-frequency patterns or noise, lacking obvious semantic structure, and was chosen intentionally for this purpose. The bottom row of Figure 7
demonstrates that even such different types of synthetic modes can be connected. Moreover, since the modes exhibited effectively zero loss, there are no secondary barriers after optimizing the max loss intermediate point B (almost up to the numerical precision).

Figure: Figure 7: Synthetic modes. Synthetic images generated through input optimization from Gaussian noise. Top row: Modes A and C, interpolated high-loss point B and its optimized counterpart B’. Bottom row: The primary loss barrier was bypassed by a single round of optimization. The new path segments A$\rightarrow$B’ and B’$\rightarrow$C are barrier-free up to several orders lower loss threshold.
Refer to caption: extracted/5843237/figures/synthetic.png

It is evident that a continuum of optimal inputs exists for a given class within the model. By employing a systematic approach to find and connect these optimal modes, the class-optimal manifold can be partially explored and analyzed. This approach would provide a novel perspective on DNN interpretability, especially as it extends the concept of feature visualization by optimization \citepOlah2017, beyond discrete optimal inputs or activation atlases.

### 4.4 The existence of connectivity in untrained models

Finally, we show that class-optimal inputs are connected even in the case of untrained, randomly initialized models. This experiment was inspired by findings in Section 5, but we present it here, preceding the section, to maintain the consistency of the manuscript.

As there are no natural datasets for untrained models, we followed the analogous strategy as in the previous subsection and computed synthetic optimal inputs. The optimization procedure failed to converge on GoogLeNet, likely due to the high input dimension (3, 224, 224). Using the ResNet18, adapted for CIFAR10 (input shape (3, 32, 32), output (10)), starting from Gaussian noise $\mathcal{N}(0,0.01)$, we were able to find inputs with losses below the specified threshold 0.0005. Adam optimizer with learning rate 0.05 and weight decay 1e-7 was used for a maximum of 4096 iterations or until reaching the desired loss. A diversity of inputs was achieved through high-frequency penalization with a weight 2.5e-7 of one of the inputs in each pair.

The two modes were linearly interpolated, and the loss curve is shown in Fig. 8 left. After two iterations of the standard mode-connecting procedure, we obtained a four-segment piece-wise linear path. A$\rightarrow$B${}^{\prime}_{S1}$$\rightarrow$B^′$\rightarrow$B${}^{\prime}_{S2}$$\rightarrow$C that has los below $\delta=0.001$ everywhere. Note that points B${}^{\prime}_{S1}$ and B${}^{\prime}_{S2}$ were obtained by optimizing the secondary barriers BS1 and BS2. All the loss curves and barriers are depicted in Fig. 8. In Appendix D.1, we also show how the connectivity (primary loss curve, i.e., loss on the linear interpolant path) changes during the training.

Figure: Figure 8: Input connectivity in untrained model. Loss curves for synthetic optimal inputs computed for an untrained model. Left: Primary loss curve, connecting the two optimal inputs. Middle: Secondary loss curves, connecting two original inputs through the intermediate point B^′ (optimized from the primary barrier). Right: Tertiary loss curves, four-segment path connecting two original inputs through intermediate points B${}^{\prime}_{S1}$, B^′, and B${}^{\prime}_{S2}$ (optimized first secondary barrier, optimized primary barrier, optimized second secondary barrier, respectively).
Refer to caption: extracted/5843237/figures/random_model_loss_curves.png

## 5 Towards a theoretical explanation of input space connectivity

### 5.1 Definitions

This section establishes the theoretical foundations underlying the phenomenon of input space mode connectivity. We begin by introducing some definitions.

We denote our input and output spaces as $X=\mathbb{R}^{d_{X}}$ and $Y=B^{d_{y}}=\left\{y\in\mathbb{R}^{d_{y}}\mid\left\|y\right\|\leq 1\right\}
\subseteq\mathbb{R}^{d_{y}}$, respectively. A path connecting $x(0)\in X$ to $x(1)\in X$ is defined as a continuous function $x:[0,1]\rightarrow X$.

We define a network that maps the input space to the output space as any function within the framework of the tensor program formalism [TensorProgramsi, TensorProgramsii, TensorProgramsiib], featuring Lipschitz continuity-bounded point-wise nonlinearities. Specifically, for a parameter vector $\theta$, such a network accepts inputs and returns outputs:

$$ $f(\cdot;\theta):X\rightarrow Y.$ (4) $$

Given any $\delta>0$, a network $f$, a parameter vector $\theta$, and a loss function $\mathcal{L}:Y\times Y\rightarrow\mathbb{R}^{+}$, we say that a path $x(\cdot)$ is $\delta$-connected around $y\in Y$ for this loss function if and only if:

$$ $\forall\alpha\in[0,1]:\mathcal{L}(f(x(\alpha);\theta),y)\leq\delta,$ (5) $$

with arbitrarily large probability.

A detailed description of our network class, and the requirements from the loss function is provided in appendix C.1. Further assumptions and limitations are discussed in appendix F.1.

### 5.2 Geometric Mode Connectivity

We present the concept of geometric mode connectivity, suggesting that almost all inputs on which a neural network makes similar predictions tend to be connected, as $d_{X}$ grows to infinity.
We find this is the case empirically for both trained networks and untrained, randomly initialized networks.
We believe the latter finding can be proven as a consequence of high-dimensional geometry, and formalize it in the following conjecture:

###### Conjecture 5.1 (Geometric Input Space Connectivity) .

Given a subset of the input space $X^{\prime}\subseteq X$, a network $f(\cdot;\theta)$ at initialization, and a loss function $\mathcal{L}$, as described in appendix C.1,
the following holds: For any probability $0<p<1$ arbitrarily close to 1, and any arbitrarily small $0<\delta^{\prime}<\delta$ (assuming for simplicity that $\frac{1}{\delta}\in\mathbb{N}$), any two random inputs $x_{0},x_{1}\in X^{\prime}$ with similar predictions are almost always connected as $d_{X}\rightarrow\infty$:

$$ $P\left(x_{0},x_{1}\text{ are }\delta\text{-connected}\mid\mathcal{L}\left(f \left(x_{0};\theta\right),f\left(x_{1};\theta\right)\right)\leq\delta^{\prime} \right)=1-O\left(e^{-d_{X}\tilde{\delta}}\right),$ (6) $$

where $\tilde{\delta}=O\left(\delta\right)$, and $x_{0},x_{1},\theta$ are chosen randomly as described in appendix C.1.

We justify the conjecture for $\mathcal{L}\left(y,y^{\prime}\right)=\left\|y-y^{\prime}\right\|$, and the case where the network’s outputs are numbers between zero and one, $f(\cdot;\theta):X\rightarrow[0,1]$. The generalization to more general cases is straightforward.

We include a detailed proof sketch for this conjecture in appendix C, which we believe provides significant insight into the phenomenon of mode connectivity but note that it is not a fully complete and rigorous proof:

(i) First, in appendix C.2, we demonstrate that the network is Lipschitz continuous, by leveraging the Lipschitz continuity of the network’s activation functions, and its semi-linear structure.

Using this property, we show that for every $0<\delta$, there exists $0<\varepsilon$, such that if we divide the input space into $\varepsilon$-sized hypercubes, then for every cube inside the lattice, all the points’ outputs ($f\left(x;\theta\right)$) belong to one of the following overlapping intervals:

$$ $Y_{\delta}=\left\{[0,\delta],\left[\frac{\delta}{2},\frac{3\delta}{2}\right],[ \delta,2\delta],\ldots,[1-\delta,1]\right\}.$ (7) $$

We can then label each input by the interval (or intervals), that corresponds to the output of all the inputs in the cube.

We show that if there exists a sufficiently small $\varepsilon$, then for any two points $x_{0},x_{1}\in X^{\prime}$ that satisfy the conjecture’s condition ($\mathcal{L}\left(f\left(x_{0};\theta\right),f\left(x_{1};\theta\right)\right)
\leq\delta^{\prime}$), their respective cubes share the same interval. This $\varepsilon$ is chosen as the length of our graph’s hypercubes.

(ii) Next, we demonstrate in appendix C.3 that to find a $\delta$-connected path between the two inputs, it suffices to find a connected path of cubes between the cube of the first input and the cube of the second, with the same interval-label.

Assuming the cube’s intervals are drawn randomly and independently from each other with similar probability $p\approx\delta$, we encounter a classic high-dimensional percolation problem [hugo2017_percolation, percolationAharony2018, PercolationBollob2006, PercolationProgress2017, PercolationContinuum1996], where the cubes represent the points in the graph, and they are connected if they share the same interval. It is well known that in such a case, the probability that two points are connected grows rapidly with the dimension, as shown in the conjecture 5.1.

It is important to note that the assumption of independent probability is not realistic, as there are strong correlations among nearby inputs of wide neural networks, even at initialization.
This is why we decided not to consider statement 5.1 as a theorem, but rather as a conjecture.
However, we expect that in general, assuming independence only underestimates the true connectivity in the system, as the correlation between outputs of nearby inputs in neural networks at initialization tends to be positive.

###### Conjecture 5.1 (Geometric Input Space Connectivity) .

### 5.3 (Approximate) Linear Connectivity

As discussed above, we justified conjecture 5.1 only for neural networks at initialization, which raised the question, whether this property persists after training.
In practice, we observed that not only do the inputs tend to remain connected, but they also tend to be connected approximately linearly, with only a relatively small barrier.
Furthermore, by combining only a few linear paths, we can almost completely eliminate this barrier.
This tendency is strong enough to be useful in adversarial detection, as we shown in section 4.2.
We speculate that this phenomenon results from implicit regularization.

Implicit regularization refers to an inherent tendency of a learning system to prefer simpler hypothesis functions [ImplicitSeparable2018, ImplicitNeyshabur2017, ImplicitBarrett2020, ImplicitLinear2019, belkin2018understand, ConvergenceOverparameterization2019, WideNNEvLinGD2019, ImplicitFunctionSpace].
We propose that one kind of simplicity preferred by deep learning is generally not to change between similar inputs if possible. This tendency, combined with geometric considerations, could explain the observed behavior.
In appendix D, we present some ideas on the mechanisms responsible for this tendency; however, more work
is needed to substantiate this.

## 6 Conclusion and future work

We demonstrated mode connectivity in the input space of deep networks trained for image classification, extending the original concept beyond parameter space. This phenomenon was shown with both real and synthetic images in various controlled setups. For tested examples, we were always able to find low-loss paths between any two modes. We explored potential applications of this connectivity, particularly for the adversarial detection and interpretability of DNNs. Our findings reveal that natural inputs can be distinguished from adversarial attacks by the height of the loss barrier on the linear interpolant path between modes. While for real–real mode pairs, the loss barrier is small or even negligible, real–adversarial pairs often have high and complex barriers. By exploring connections between different types of class-optimal inputs we obtained a novel perspective on DNN interpretability. The new evidence for mode connectivity beyond the parameter space supports the hypothesis that mode connectivity is an intrinsic property of high-dimensional geometry and can be studied through percolation theory. This hypothesis, however, requires additional investigation to fully understand its implications.

Future work can focus on formalizing the theory for our conjecture of geometric mode connectivity and explain minimal requirements for its manifestation. An additional direction involves developing a proper theory and conducting further experiments to better understand the implicit regularization phenomenon in the input space. Regarding the potential applications, creating an efficient implementation of the proposed naïve algorithm for adversarial example detection is an important next step. Leveraging insights from the input space connectivity
might also
inform more effective adversarial training, e.g., through enhanced sampling of adversarial examples along low-loss paths for model retraining – a concept analogous to utilizing parameter space connectivity for improving deep ensembles \citepFort2020. Additionally, investigating the geometric properties of the (input space) loss landscape around significant points and exploring the entire class-optimal manifold could provide deeper insights into model interpretability.

## Appendix A Percolation theory

Percolation theory, originally developed to describe the structure of a porous material, turned into a widely studied model in statistical physics and graph theory \citephugo2017_percolation.

Let ${\cal G}$ be an $N\times N$ grid, where at each cell, one inserts a ball with (Bernoulli distribution) probability $p$ and leaves it empty with probability $1-p$. Site percolation theory considers the question: what is the probability that for any two nonempty cells $A$ and $B$ in ${\cal G}$,
there is a path of nonempty cells that connects the two.
When $p$ is small, the probability is zero, while when $p\rightarrow 1$, there is almost certainly a connecting path.
The latter phase case is called percolation.
In the limit $N\rightarrow\infty$ there is a sharp transition at a critical probability $p=p_{c}$, that separates the two phases. Figure 9 shows site percolation in two dimensions near the critical probability.

The percolation model has a straightforward generalization to higher dimensions, as well as to more than the two labels (empty and nonempty), and to a general probability distribution for choosing the labels. In particular, the choice of labels between different cells can be correlated. The structure of the correlation affects the
transition to percolation. Intuitively,
one expects that higher correlations imply a higher probability of having connecting paths. Correlated percolation is an active field
of research in physics and mathematics (see e.g. \citepPhysRevLett.55.1896,bricmont1987percolation,Rodriguez_2012,chalhoub2024universality).

Figure: Figure 9: An illustration of site percolation in two dimensions near the critical probability [chalhoub2024universality] (the critical probability for two-dimensional site percolation is around 0.59). In this illustration, an “infinite” cluster can be observed. However, it is notable that a significant number of points do not belong to it.
Refer to caption: extracted/5843237/figures/percolation.png

In the framework of our work, the grid is defined by the $\varepsilon$-cells in the data space, while the labels are
the intervals.
Since the dimension of the grid is very large, the percolation probability $p_{c}$, which is inversely proportional to the dimension,
is very small. Hence, our analysis at initialization is at the percolation phase.

We provide a dictionary (see Table 2) for the terms used in percolation theory in statistical physics and graph theory communities.

**Table 2: Dictionary for percolation theory terms used in statistical physics and graph theory.**
| statistical physics | graph theory |
| --- | --- |
| site | vertex (node) |
| bond | edge |
| cluster | connected component |
| infinite cluster | infinite connected component |
| percolation threshold | critical probability |
| order parameter | size of the largest component |
| lattice animal | connected subgraph (not infinite) |

## Appendix B Adversarial detection benchmark

Here, we briefly overview attacks employed in the benchmark by \citetHarder2021.

- •
Fast Gradient Sign Method (FGSM):
A rapid untargeted attack method that adjusts an input $x_{i}$ by adding a small perturbation in the direction of the loss function’s gradient:
$x_{i,\text{adv}}=x_{i}+\epsilon\cdot\text{sign}(\nabla_{x_{i}}\mathcal{L}(x_{i
},y)).$
(8)
- •
Basic Iterative Method (BIM):
An iterative enhancement of FGSM, applying small, repeated perturbations, ensuring each update remains within an $\epsilon$-bounded range:
$x_{i,\text{adv}}^{(n+1)}=\text{Clip}_{x_{i},\epsilon}(x_{i,\text{adv}}^{(n)}+
\epsilon\cdot\text{sign}(\nabla_{x_{i}}\mathcal{L}(x_{i,\text{adv}}^{(n)},y))).$
(9)
- •
Projected Gradient Descent (PGD):
A generalization of BIM that begins from a random point near $x_{i}$ within the $\epsilon$-ball.
- •
Deepfool (DF):
Iteratively modifies $x_{i}$ to cross the closest decision boundary by minimizing the perturbation required to alter the model’s classification.
- •
Carlini & Wagner (C&W):
A powerful optimization-based attack that minimizes the $L_{2}$ norm of the perturbation while ensuring misclassification by optimizing a loss function designed to reduce the model’s confidence in the correct class. The attack solves the following objective:
$\min\left\|\frac{1}{2}(\tanh(x_{i,\text{adv}})+1)-x_{i}\right\|^{2}+c\cdot f
\left(\frac{1}{2}(\tanh(x_{i,\text{adv}})+1)\right),$
(10)
where $f(z)$ is a function that encourages the logits to either lower the true class’s score (untargeted) or raise the target class’s score (targeted). The parameter $c$ is optimized to balance minimizing the perturbation and ensuring successful misclassification. The C&W attack can be applied in both targeted and untargeted forms.

## Appendix C Conjecture 5.1 - Proof Sketch

### C.1 Assumptions and Generalizations

#### C.1.1 The Network

We justify conjecture 5.1 for fully connected neural networks defined by a set of $L\in\mathbb{N}$ layers, characterized by $L$ weight matrices and $L$ bias vectors, denoted as $\{\theta^{l,l-1},\theta^{l}\mid l=1,\ldots,L\}$. The first layer is defined as:

$$ $f^{1}=\theta^{1,0}x+\theta^{1}.$ (11) $$

Each subsequent layer $l=2,\ldots,L$ satisfies:

$$ $f^{l}=\theta^{l,l-1}\phi(f^{l-1})+\theta^{l},$ (12) $$

where $\phi$ is a Lipschitz-bounded activation function that acts on the vector in a pointwise manner.

We then define the network’s prediction using a non-linear final activation $\varphi:\mathbb{R}\rightarrow[0,1]$ such that:

$$ $f=\varphi(f^{L}).$ (13) $$

The generalization to other networks within the tensor programs formalism [TensorProgramsi, TensorProgramsii, TensorProgramsiib] (and then using $\varphi$) is straightforward, as long as the nonlinearities are Lipschitz. The classes of networks
described by this formalism is very diverse, and includes most of the relevant types of neural networks, such as fully connected neural networks, recurrent neural networks, long short-term memory units, gated recurrent units, convolutional neural networks, residual connections, batch normalization, graph neural networks, and attention mechanisms.

The reason that we can generalize our result to any network in this class is that in our justification, we only use the semi-linear structure of fully connected neural networks, and, by definition, any network in this class can be described as a composition of global linear operations and pointwise non-linear functions.

#### C.1.2 Initialization and Input Distribution

As we will see, we can always divide the input space into sufficiently small hypercubes. Therefore, it is not crucial how we initialize our network, as long as it remains well-defined as $d_{x}\rightarrow\infty$.

The only requirement is that for every $0<p<1$ and $x\in X^{\prime}$, the probability for having every label in $Y_{\delta}$ is at least $\tilde{\delta}$, where $\tilde{\delta}=O(\delta)$, except for a subset of intervals, whose combined probability is less than $1-p$.

We conjecture that this holds for most well-normalized initializations and networks, and any finite, arbitrarily large $0<R$-radius balls:

$$ $X^{\prime}=B_{R}^{d_{x}}=\left\{x\in\mathbb{R}^{d_{x}}\mid\|x\|\leq R\right\}\ .$ (14) $$

#### C.1.3 The Loss Function

We work with $\mathcal{L}\left(y,y^{\prime}\right)=\left\|y-y^{\prime}\right\|$. However, the generalisation to any loss function that satisfies $\mathcal{L}:Y\times Y\rightarrow\mathbb{R}^{+}$, such as it is Lipschitz continues in both arguments, and for every $y\in Y$:

$$ $\mathcal{L}\left(y,y\right)=0\ ,$ (15) $$

is straightforward.

### C.2 Dividing the Input Space

Now that we have provided all of the necessary definitions, we can proceed to justify the conjecture. We will begin by demonstrating that small changes in the input space generate small changes in the network’s output.

###### Lemma C.1 (Lipschitz Continuity of the Network) .

A neural network, as described above, is almost always Lipschitz continuous at initialization. This means that for any probability arbitrarily close to one, $0<p<1$, there exists some $0<M$, such that for every $x,\Delta x\in X$:

$$ $\left\|f(x+\Delta x;\theta)-f(x;\theta)\right\|\leq M\left\|\Delta x\right\|.$ (16) $$

An immediate consequence of this lemma is that for the situation described in conjecture 5.1, for any probability arbitrarily close to one, $0<p<1$, there exists some $0<\varepsilon$ such that for every $x,\Delta x\in X$, if $\left\|\Delta x\right\|<\varepsilon$, then:

$$ $\left\|f(x+\Delta x;\theta)-f(x;\theta)\right\|\leq\delta-\delta^{\prime}\leq\delta.$ (17) $$

This result implies that we can divide our input space into $O(2N)$ classes, as in equation 7. This means that if we divide our input space into cubes of size $\frac{\varepsilon}{\sqrt{d_{x}}}$, not only does every input in each cube belong to the same class, but also that if two different inputs $x_{0},x_{1}\in X$ satisfy $\left\|f(x_{0};\theta)-f(x_{1};\theta)\right\|\leq\delta^{\prime}$, then their cubes share the same interval.

###### Proof of Lemma C.1 .

We prove the lemma by induction. We start with the induction base - the first layer. Since $\phi$ is Lipschitz continuous, we know that there exists some $0<m$ such that for every $r,\Delta r\in\mathbb{R}$:

$$ $\left|\phi(r+\Delta r)-\phi(r)\right|\leq m\left|\Delta r\right|,$ (18) $$

which means that for every $x,\Delta x\in\mathbb{R}^{d_{x}}$:

$$ $\left\|\phi(x+\Delta x)-\phi(x)\right\|^{2}=\sum_{i=1}^{d_{x}}\left(\phi(x_{i} +\Delta x_{i})-\phi(x_{i})\right)^{2}\leq\sum_{i=1}^{d_{x}}(m\Delta x_{i})^{2} =m^{2}\left\|\Delta x\right\|^{2}.$ (19) $$

Thus, for every $x,\Delta x$:

$$ $\left\|\phi(x+\Delta x)-\phi(x)\right\|\leq m\left\|\Delta x\right\|.$ (20) $$

Multiplying by $\theta^{1,0}$ and adding $\theta^{1}$, we get:

$$ $f^{1}(x+\Delta x)-f^{1}(x)=\theta^{1,0}\phi(x+\Delta x)+\theta^{1}-(\theta^{1, 0}\phi(x)+\theta^{1})=\theta^{1,0}(\phi(x+\Delta x)-\phi(x)).$ (21) $$

Using the subordinate norm of the matrix, we find:

$$ $\left\|f^{1}(x+\Delta x)-f^{1}(x)\right\|\leq\left\|\theta^{1,0}\right\|\left \|\phi(x+\Delta x)-\phi(x)\right\|\leq\left\|\theta^{1,0}\right\|m\left\| \Delta x\right\|.$ (22) $$

Which means that for every $0<p<1$, we can bound the change in $f^{1}(x+\Delta x)-f^{1}(x)$ by:

$$ $\left\|f^{1}(x+\Delta x)-f^{1}(x)\right\|\leq m^{\prime}\left\|\Delta x\right\|.$ (23) $$

We can continue this process by induction, showing that the same holds for every layer, which completes our proof.
∎

###### Remark C.1 .

It should be noted that the bound we found using the subordinate norm was sufficient for our needs, however, it is far from being the optimal one.

This is not a problem for our work, as all that we require is any Lipschitz bound, and then we can take $\varepsilon$ to be arbitrarily small. However, if one wishes to find a better bound, which also depends on the distance between inputs, or to investigate neural networks in the infinite limit appropriately, more care will be needed.

###### Lemma C.1 (Lipschitz Continuity of the Network) .

###### Proof of Lemma C.1 .

###### Remark C.1 .

### C.3 Finding the Path

To find now a $\delta$-connected path between the two inputs, all we need to do is to find a connected path of cubes between the cube of the first input to the cube of the second with the same intervals.

Assuming that the cube’s intervals are drawn randomly and independently from each other with similar probability $p=O(\delta)$, we encounter a classic high-dimensional percolation problem, where the cubes represent the points in the graph, and they are connected if they share the same interval. It is well known that in such cases, the probability that two points are connected grows rapidly with the dimension, as shown in the conjecture. Specifically, if we ask what is the probability that a certain point will be part of the infinite cluster, we know that in the high-dimensional limit, we can neglect closed loops [percolationAharony2018]. This is known as a “mean field approximation.”

The probability that one input is not part of the infinite cluster is the probability that all nearby cubes connected to it are also not part of the infinite cluster. Thus, the probability that a point is part of the infinite cluster $P$ satisfies:

$$ $1-P=\left(1-pP\right)^{d_{x}}\lesssim e^{-d_{x}pP}\rightarrow P\gtrsim 1-e^{-d _{x}pP}\ .$ (24) $$

Defining $q=d_{x}p$, we find a lower bound for $P$ by solving the equation:

$$ $P=1-e^{-qP}.$ (25) $$

Defining $Q=1-P$, we get:

$$ $\begin{array}[]{c}1-Q=1-e^{-q(1-Q)}=1-e^{-q}e^{qQ}\approx 1-e^{-q}(1-qQ+O(q^{2 }Q^{2}))\rightarrow\\ Q=e^{-q}(1-qQ+O(q^{2}Q^{2}))\rightarrow(1+qe^{q})Q=e^{-q}+O(q^{2}Q^{2}).\end{array}$ (26) $$

Which implies:

$$ $Q=\frac{e^{-q}}{1+qe^{q}}+O(q^{2}Q^{2})=O(e^{-q})=O(e^{-pd_{x}}),$ (27) $$

thus completing our justification.

## Appendix D Linear Connectivity

The next phenomenon we wish to address is the tendency of trained networks to exhibit linear paths. Intuitively, this is not particularly surprising. For any system to generalize effectively, it must exhibit a preference for simpler hypothesis functions. In the context of overparameterized models, this preference is often referred to as regularization, and when not explicitly imposed, it is termed “implicit regularization”. A reasonable form of simplicity involves not varying drastically between similar inputs.

Extensive research has been conducted on implicit regularization from the perspective of parameter space. However, its understanding from the input space perspective remains limited. A notable study [ImplicitFunctionSpace] demonstrated that at equilibrium, the second derivative of neural networks with respect to the inputs is bounded and can be minimized as the learning rate increases.

Another possible approach is to consider the Neural Tangent Kernel (NTK) limit. It is known that, in the infinite-width limit, neural networks exhibit linear-like behavior [ConvergenceOverparameterization2019, WideNNEvLinGD2019]. In this limit, their evolution over time can be described by a kernel, a two-point matrix function $\Theta(x,x^{\prime})$, which generally tends to be larger where the two inputs $x\simeq x^{\prime}$ are similar.

In this regime, for gradient descent, the final prediction can be viewed as an “averaged sum” [WideNNEvLinGD2019] of the data, where for every $x\in X$, more weight is assigned to label of inputs that were closer to $x$ (according to the kernel). And as it is reasonable to assume that a linear combination of two inputs will be closer to the original inputs than to any other input, that could partially explain the linear mode connectivity.

Another avenue that could be promising is to consider $f(\alpha x_{0}+(1-\alpha)x_{1},\theta)$, and decompose it as $f(\alpha x_{0},\theta)+f((1-\alpha)x_{1},\theta)$ plus an additional term, whose magnitude should be shown to be small. If both $f(\alpha x_{0},\theta)$ and $f((1-\alpha)x_{1},\theta)$ align in the same direction, we would obtain the correct label after applying the softmax function.

It is important to emphasize that the ideas presented here are speculative, and only represent our preliminary conjectures.
We have not yet validated these concepts, and more rigorous research is needed to confirm or refute these notions.

### D.1 Connectivity evolution throughout training

Following the observation of connectivity in untrained models (Sec. 4.4) and hypothesizing the role of implicit regularization in trained models, we studied the temporal evolution of the connectivity over training batches and epochs. To maintain comparability for the early stages of training, where the model performs poorly on real data, we again employed synthetic optimal inputs. The optimization process was adapted from Sec. 4.4 (ResNet18, input shape (3, 32, 32), output shape 10, starting from Gaussian noise $\mathcal{N}(0,0.01)$, Adam optimizer with learning rate 0.05 and weight decay 1e-7, maximum of 4096 iterations or until reaching the desired loss), with difference of using the loss threshold $\delta=0.005$ for convenience and faster convergence. A diversity of inputs was achieved through high-frequency penalization with weight 2.5e-7 of one of the inputs in each pair. We prepared 5 pairs for each class and computed primary loss curves. Averaged loss curves (over all pairs, classes and model stages) for the first 30 batches are shown in Fig. 10, and similarly for the first 30 epochs in Fig. 11.

Figure: Figure 10: Batch evolution of the averaged loss barriers. Batches are indexed starting from one; zero means an untrained model. Shaded area and error bars show standard deviation.
Refer to caption: extracted/5843237/figures/batch_loss_curves_and_metrics.png

Figure: Figure 11: Epoch evolution of the averaged loss barriers Epochs are indexed starting from one; zero means untrained model. Shaded area and error bars show standard deviation.
Refer to caption: extracted/5843237/figures/epoch_loss_curves_and_metrics.png

While we observe the increase of connectivity (decrease of loss barriers) in the early phases of training, it saturates and variance begins to grow at some point. There are likely more competing effects taking part over the training. It is important to note that the barrier height and complexity depend on the losses of the interpolated inputs.

## Appendix E Extra results for the Section 4.1

Here, we present additional examples of connectivity on pairs drawn from the validation datasets of ImageNet (see Figure 12) and CIFAR10 (see Figure 13), using GoogLeNet and ResNet18, respectively. Note that the loss barrier can be negligibly small for some pairs even before the initial round of barrier optimization.

Figure: Figure 12: GoogLeNet(ImageNet) loss curves. Representative examples of connectivity in a trained GoogLeNet for selected classes. Each row contains a pair of same-class images. The primary loss curve is obtained from linear interpolation A$\rightarrow$B, and a secondary loss curve A$\rightarrow$B’$\rightarrow$C. Note that the highest loss value in the secondary curves is at least one magnitude lower than in the primary curves.
Refer to caption: extracted/5843237/figures/GN_grid.png

Figure: Figure 13: ResNet18(CIFAR10) loss curves. Representative examples of connectivity in a trained ResNet18 for selected classes. Each row contains a pair of same-class images. The primary loss curve is obtained from linear interpolation A$\rightarrow$B, and a secondary loss curve A$\rightarrow$B’$\rightarrow$C. Note that the highest loss value in the secondary curves is at least one magnitude lower than in the primary curves.
Refer to caption: extracted/5843237/figures/RN_grid.png

## Appendix F Limitations

### F.1 Section 5.2

The main limitation, other than the basic assumptions discussed in section C.1, is that we treated our problem as a standard model of percolation, assuming no correlation between different sites. However, this assumption does not hold for neural networks, not even at initialization. We argue, however, that since correlations in neural networks are positive, the actual scenario should be more favorable. Nevertheless, diligent investigation and exact proofs are necessary to confirm this.

### F.2 Section 5.3

The ideas discussed in that section are speculative and represent our initial hypotheses. These concepts have not yet been validated, and further rigorous research is required to either confirm or disprove them.

### F.3 Section 4

Experiments were carried out on common vision models. The potential generalization of the concept to other data modalities was not tested. Our approach requires a continuous input space up to standard numerical precision. Therefore, technical adjustments would be necessary for applications beyond vision models, such as language models that use tokenization.

## Peer Reviews

confidence: 3
contribution: 2
initial_rating: 6
presentation: 2
questions: 1. Can we repeat the produce of finding A->B'-C for each segment recursively to obtain A->E'->D'->B'->F'->G'-C (maybe a longer path), such that there is no essential barrier existing?
2. How can we use the input mode connectivity to give a picture of the decision boundary of DNNs?
soundness: 3
strengths: 1. This topic is interesting. Investigating the model connectivity in the input space could help us to shape the decision boundary of DNNs.
2. The insight of mode connectivity is indeed an intrinsic property of high-dimensional geometry is important, as it might be able to explain various phenomena lied in the field of model connectivity, such as wide neural networks are easier to satisfy mode connectivity after accounting for permutation invariance.
3. The potential application towards adversarial examples is insightful, which might explain the existence of adversarial examples.
summary: The authors identify an interesting phenomenon, namely input mode connectivity, where samples with similar predictions could be approximately linearly interpolated such that the interpolated sample remains a low loss.
weaknesses: 1. The major issue of this work is that the investigation is not in-depth enough. For example, in Fig. 3, the path A->B'->C and A->B->C look similar but they differ significantly in terms of mode connectivity. 
    - How should we quantify such differences? or why the small difference B'-B (as shown in right bottom of Fig. 1) is significant in terms of model connectivity? 
    - Here is another example, in the adversarial example part, why real-adversarial pair shows a large barrier than real-real pair? An intuitive explanation is at least expected.

These are all important questions and represent the motivation why we are interested in investigating the mode connectivity in input space.

2. Their theory cannot explain the phenomenon they discovered. Their conjecture is only able to explain the mode connectivity for untrained NNs with infinity large input dimension. However, in their experiments, two real images with similar predictions are usually not connected unless another intermediate point is found, say B'. Clearly, their theory cannot explain the realistic scenarios.

---

confidence: 4
contribution: 2
initial_rating: 5
presentation: 2
questions: 1. Do you have any intuition whether results would fundamentally change if other architectures were considered? E.g. [1] find that mode connectivity in the parameter-sense is influenced by the choice of architecture, i.e. there is different behaviour for vision transformers or multi-layer perceptrons.
2. I’m a bit confused regarding the adversarial example detector; Are you comparing loss barriers after a single iteration of your algorithm in both cases, or after two iterations in case of the adversarial setting? I thought that in both cases the barriers became very small? 

[1] Disentangling Linear Mode-Connectivity, Altintas et al., 2023
soundness: 3
strengths: 1. The role of the input when it comes to loss behaviour is somewhat understudied and the authors develop new ideas in this direction while keeping things very analagous to the results observed for parameter loss landscapes.
2. The authors give further credibility to their results by mathematically proving them in an idealized setting assuming independence. While this is not realistic, I do find the argument of the authors convincing that correlations in this case will most likely help connectivity.
summary: This paper studies input space mode connectivity, where instead of studying the loss surface as a function of the parameters, the authors consider varying the inputs (for a fixed set of parameters). More specifically, the authors investigate paths connecting two sets of inputs and the resulting behaviour of the loss, in complete duality to the well-known mode connectivity in parameter space. Several choices for “modes” in this context are explored: (1) Validation data points that achieve very low loss, (2) a validation data point and an adversarial example optimized towards the same class but based on a datapoint of different class and (3) synthetic “optimal" points optimized to maximise a given logit. For all these cases, the authors show how simple piecewise linear paths suffice to connect such points, while limiting the barrier to very small values. Adversarial examples exhibit larger barriers in a significant manner, allowing a detector to leverage this difference to classify whether an image is adversarial or not.
weaknesses: 1. The biggest weakness is the lack of motivation presented in this paper for input space connectivity. Why is this an interesting quantity to study? In case of the parameter loss landscape where this notion originated, the motivation was from an optimisation point of view; is SGD attracted to a convex region of the parameter space? Does it find isolated minima or are there entire regions of low loss? ﻿There might be good motivations for input space connectivity as well (I’m not an expert in this area) but the paper does not do a good job at presenting it in its current form. In general I also have no intuition whether it is surprising that real-real images can be connected with two segments or not, etc. 

2. I like the idea of using the difference in barrier between real-real and real-adversarial inputs, but as usual in adversarial robustness, I think that new threat models need to be investigated when taking this idea into account. I.e. can one now develop adversarial examples that are designed to mimick the barrier of real examples, thus fooling the new classifier? I don’t expect the authors to necessarily develop such an algorithm but this possibility should at least be discussed in the paper.

3. I also have a hard time interpreting the adversarial example results. It is not that surprising that it requires more segments to connect things properly compared to the real-real scenario (the image is still very different after all). How does this compare to simply two images coming from different classes and their barriers in between? 

4. The writing of the paper is not very satisfying. The notation is rather sloppy (e.g. "0.1*MSE for image deviation and 1e-7*high-frequency penalty"),  optimization details are listed without defining them (e.g. high-frequency penalty). The actual algorithm to obtain a piece-wise linear curve is never properly defined.

---

confidence: 3
contribution: 3
initial_rating: 5
presentation: 2
questions: - I don't understand the algorithm presented in Section 4.2.1. In my understanding, the claim is that if one of the endpoints is from an adversarial attack, then the method of optimizing $B$ to find a connected (piecewise linear) path will not work. However, the algorithm of detecting adversarial attack is to use the interpolation loss curve and logits as the input and do a classification. I don't see how this proposed algorithm is related to the finding.
- The wording of Section 4.3 is too confusing that I totally can not understand. What does "natural datasets for untrained models" mean? What does "starting from Gaussian noise" mean (start from it and do what?) What does "high-frequency penalization" mean?
- In Conjecture 5.1, why does the condition has "for any probability $0 < p < 1$", but $p$ is never used in the statement? What does "almost always connected" mean?
soundness: 3
strengths: - This phenomenon is interesting and potentially valuable for understanding the behaviour of deep neural networks and the geometry of high-dimensional spaces.
- This finding has a practical useness that it can be used to detect adversarial attacks.
summary: This paper presents an interesting phenomenon, that given two input points $A,C$ which are classified as the same class by the model (i.e. have similar output), there exists a point $B'$, such that the linear interpolation between $A,B'$ and $B',C$ are all classifed as the same class. The authors refer to this phenomenon as "input space mode connectivity", despite they are not actually linear connected. The authors also presented a analysis under a very strong and unrealistic condition, conjecturing that this phenomenon is intrinsic to high-dimensional spaces.
weaknesses: - The presentation is kind of confusing. See Questions for concrete issues.
- In my understanding, the finding in this paper is not really linear connectivity as the path found by the proposed method is actually a piecewise lienear path with 2 pieces. This makes the title and introduction kind of misleading. 
- The experiments are only on a few image classification tasks and models. It is not clear if this phenomenon is general enough. 
- It seems that the thoretical explanation presented in Section 5.2 (even if we omit the too strong assumption of randomized labeling of each grid) only explains why there can exist a connected path, but does not guarantee that the path is linear, which is inconsistent with Conjecture 5.1.
- In Conjecture 5.1, why do you need to assume "a subset of input space $X' \subseteq X$"? Does the conjecture hold even if $X'$ itself is unconnected? Moreover, there is a statement "two random inputs $x_0, x_1 \in X'$". What is the distribution of the randomness? If it is uniform, then there must be extra constraints on $X'$ (such as compactness), since not every subset of a Euclidean space has a uniform distribution. (For example, you can not draw two points uniformly from a 2d plane).

Meta-review: This paper identifies a new phenomenon, input space mode connectivity, that different images with similar predictions are generally connected by a simple path. The paper also presents some theoretical intuition suggesting that such a phenomenon could be generically true in high-dimensional spaces. The paper makes valuable contributions toward understanding the behavior of neural networks and the geometry of high-dimensional spaces. I believe this work is worth sharing with the community and recommend acceptance.

Decision: Accept (Poster)