Skip to content

Optimizing mode connectivity of deep neural networks via neuron alignmentOptimizing Mode Connectivity via Neuron Alignment

arXiv· arXiv:2009.02439· N. Joseph Tatro, Pin-Yu Chen, Payel Das, Igor Melnyk, Prasanna Sattigeri, Rongjie LaiDept. of Mathematical Sciences, Rensselaer Polytechnic Institute; IBM ResearchIndexed by this site · 27 days ago· Originally publishedAlignment

Quick read

Analysis and theory

Based on the paper PDF (AI-generated); refer to the original

The authors propose using neuron alignment to permute the endpoint weights before learning a low-loss curve, and state that on 3 datasets and 3 architectures it outperforms unaligned curves and reduces the robust loss barrier.

Questions
Existing mode connectivity curve learning does not consider weight permutation symmetry, and may fail to learn a genuinely low-loss connecting path between two networks; the authors argue that this causes the intrinsic connectivity between models to be underestimated.
Methods
Generalize curve learning to jointly optimize the endpoint weight permutation and the curve parameters, and use neuron alignment based on activation cross-correlation (solving the assignment problem with the Hungarian algorithm) to approximate the optimal permutation, then learn the connecting path with a quadratic Bezier curve.
Experiments and results
On CIFAR10, CIFAR100, Tiny ImageNet and TinyTen, ResNet32, GoogLeNet, the authors report that the aligned curves' average and lowest test accuracies are both better than the unaligned curves; for robust models, alignment greatly alleviates the robust loss barrier, and at the midpoint of ResNet32/CIFAR100 the clean and robust accuracies rise by 5.3% and 1.3% respectively relative to the endpoints.
Limitations and future work
The authors note that the GoogLeNet robust curve requires early stopping at about 20 epochs due to overfitting in adversarial training; the theoretical tightness holds only for one class of networks with ReLU+RMSE; the experiments cover 3 image datasets and 3 architectures, the curves are limited to a quadratic Bezier parameterization, and PAM runs only a single outer iteration.
Experimental setupTinyTen、ResNet32 et al. · CIFAR10、CIFAR100 et al. · average/minimum test accuracy along the curve、training loss et al.
Evaluated models
TinyTenResNet32GoogLeNet
Benchmarks
CIFAR10CIFAR100Tiny ImageNet
Metrics
average/minimum test accuracy along the curvetraining lossrobust test accuracy (PGD)
AI summaryThe researchers propose a general framework for mode connectivity that accounts for network weight permutations, and introduce a low-cost neuron alignment heuristic to approximate the optimal permutation. Its mechanism is to promote similarity of the intermediate activation distributions of models along the curve, and theoretical analysis proves the benefits of alignment. Experiments show that optimizing weight permutations is key to efficiently learning simple, flat, low-loss and generalizable curves, alignment can significantly alleviate the robust loss barrier between two adversarially robust models, and more robust and more accurate models are found.

The researchers propose a general framework for mode connectivity that accounts for network weight permutations, and introduce a low-cost neuron alignment heuristic to approximate the optimal permutation. Its mechanism is to promote similarity of the intermediate activation distributions of models along the curve, and theoretical analysis proves the benefits of alignment. Experiments show that optimizing weight permutations is key to efficiently learning simple, flat, low-loss and generalizable curves, alignment can significantly alleviate the robust loss barrier between two adversarially robust models, and more robust and more accurate models are found.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors study how weight permutation symmetry affects mode connectivity, and propose using neuron alignment to approximate the optimal permutation in order to learn low-loss connecting curves.

    Core problem: existing mode connectivity curve learning algorithms ignore the loss-surface symmetry induced by network weight permutation, and may fail to find a genuinely low-loss connecting curve between two networks.

    • Problem setting: the loss surface of deep networks is highly non-convex, but empirically local minima can be connected by a curve along which the loss is almost constant (mode connectivity). The authors argue that the indices of hidden-layer neurons have permutation ambiguity, that many equivalent points exist in model space, and that ignoring the optimal path underestimates the intrinsic connectivity between models.
    • Shortcomings of existing methods: the authors state that curve learning algorithms such as Garipov et al. (2018) and Draxler et al. (2018) do not consider the effect of weight permutation on loss-surface connectivity.
    • Core observation: networks trained with the same architecture share part of their structure (Figure 1a shows that after alignment the cross-correlation of corresponding neurons in each layer increases), so the curve should interpolate weights of similar filters.
    • Proposed in the paper: generalize curve learning into a framework that jointly optimizes the endpoint weight permutation P and the curve parameters φ, and propose a cheap neuron alignment heuristic to approximate the optimal permutation; give a theoretical analysis (Theorem 3.1) showing that alignment yields a tighter loss upper bound, and use Proximal Alternating Minimization (PAM) to test the local optimality of the aligned permutation.
    • Application motivation: the authors state that the method can alleviate the robust loss barrier between adversarially robust models found by Zhao et al. (2020), and find more accurate and more robust models along the path.
  2. What related research exists?

    Related work is divided into four groups: mode connectivity curve learning, weight symmetry, network similarity/alignment, and adversarial robustness; the baseline is the curve learning of Garipov et al. (2018).

    Mode connectivity and curve learning

    • Freeman & Bruna (2016)—an earlier rigorous proof that single-hidden-layer rectified networks become asymptotically connected as width increases.
    • Garipov et al. (2018) and Draxler et al. (2018)—respectively learn Bezier curves and use nudged elastic band energy to learn curves with nearly constant loss; Gotmare et al. (2018) show that such algorithms also apply to models trained with different hyperparameters; Kuditipudi et al. (2019) analyze connectivity between ε-dropout stabilized networks.
    • Goodfellow et al. (2014)—a study of linear averaging of models, which the authors regard the above work as an extension of.

    Weight symmetry

    • Chen et al. (1993)—an early formal study of the symmetry group of the network weight space.
    • Cho & Lee (2017)—a regularization method based on weight scaling, belonging to the weight-scaling ambiguity direction.
    • Brea et al. (2019)—studies permutation plateaus: neurons within a layer can be permuted as a whole at the same cost.

    Network similarity and alignment

    • Kornblith et al. (2019)—surveys network representation similarity and proposes CKA; CKA improves on the CCA technique of Raghu et al. (2017), further explored by Morcos et al. (2018).
    • Li et al. (2016)—a neuron alignment algorithm; empirically, two networks of the same architecture learn similar feature subsets; the correlation alignment in this paper follows its c(x, y) := 1 − correlation(x, y) cost.
    • Singh & Jaggi (2019) and Wang et al. (2018)—applications of alignment in model averaging and federated learning.

    Adversarial robustness

    • Madry et al. (2017)—PGD attack and adversarial training; Goodfellow et al. (2015) also proposed adversarial training.
    • Zhao et al. (2020)—found loss barriers between adversarially robust models and used mode connectivity to recover tampered models under limited clean data; Section 5 of this paper directly targets the barrier they found.
    • Rice et al. (2020)—observed that overparameterized models overfit in adversarial training, which this paper uses to explain the overfitting of the GoogLeNet robust curve.

    Baseline and benchmarks: the comparison baseline is the unaligned curve learning of Garipov et al. (2018) (denoted Unaligned (Garipov) in the table), and the datasets are CIFAR10, CIFAR100, Tiny ImageNet.

    The authors position this paper as: generalizing curve learning to jointly optimize permutation and curve parameters, and using neuron alignment to approximate the optimal permutation; it is the first work under this framework to simultaneously handle weight symmetry and give theoretical bounds (stated by the authors as contributions, without using the word "first").

  3. How does the paper address this problem?

    Generalize curve learning to jointly optimize the weight permutation and the curve parameters, use cross-correlation neuron alignment to approximate the optimal permutation, then learn the connecting path with a quadratic Bezier curve.

    Overall approach: first generalize the objective of mode connectivity to also include the weight permutation P of the endpoint θ2 in the optimization; then use the cheap heuristic of neuron alignment to approximate the optimal permutation P*, and finally learn a curve between the aligned endpoints in the manner of Garipov et al. (2018).

    Problem setting and formalization

    • Classical curve learning (Garipov et al., 2018): under arc-length parameterization, find r∗ = argminr (∫t∈[0,1] L(r(t))|r′(t)|dt)/(∫t∈[0,1] |r′(t)|dt), subject to r(0)=θ1, r(1)=θ2, i.e., minimizing the average loss along the path.
    • Weight symmetry: for an L-layer feedforward network, permuting hidden layers by Pi does not change the network function; P = blockdiag(P1, ..., PL−1) acts on the weights to give P θ; the order of the input and output layers is fixed and not permuted.
    • Generalized objective: minϕ, P Et[L(rϕ(t))], subject to rφ(0)=θ1, rφ(1)=P θ2, i.e., jointly optimizing the curve parameters φ and the permutation P.

    Neuron alignment

    • Alignment means finding a bipartite matching of neurons in the same layer: Pl∗ = argminPl ∈ ΠKl ∑i ∈ Kl c(Xl,i(1), Xl,Pl(i)(2)), where X is the channel activation and the cost c is 1 − correlation(x, y) (following Li et al., 2016).
    • Implementation (Algorithm 1): forward-propagate a subset of the training data to collect post-activations of each layer, normalize them, compute the cross-correlation matrix, solve the assignment problem layer by layer with the Hungarian algorithm, and permute the weights of θ2.
    • Cost: for L layers and maximum width M, solving all assignments is O(LM³) and storage is O(LM), which the authors describe as being on the same order as one forward pass and relatively cheap; for CIFAR100 models, the alignment computed on subsets of 2,500/5,000/10,000 is the same.

    Theoretical analysis

    • Theorem 3.1 (as stated by the authors): under assumptions such as Lipschitz-continuous σ and loss, when alignment is done by minimizing the expected L2 distance of pre-activations (corresponding to Wasserstein-2 optimal transport), the loss upper bound Ba of the aligned linear interpolation does not exceed the unaligned upper bound Bu, and this bound extends to the optimal curve.
    • Proof idea: by induction layer by layer, after alignment the upper bound on the distance of each layer's pre-activations to the endpoints is tighter, and then via the Lipschitz loss a tighter loss upper bound is obtained (full proof in Appendix C.1).
    • Tightness: Appendix C.2 states that for a class of networks with ReLU activation + RMSE loss, specific choices of weights and biases can make each inequality an equality; the main-text experiments align using cross-correlation of post-activations, and Figure 2 shows it outperforms pre-activation and L2 alignment.

    PAM to test local optimality

    • Proximal Alternating Minimization (Attouch et al., 2010) is used to alternately optimize P and φ (with a proximal penalty), as a baseline for judging whether a solution is locally optimal; Theorem E.1 gives a convergence guarantee under certain assumptions.
    • Implementation: a single outer iteration; the permutation subproblem uses 20 rounds of projected SGD onto the doubly stochastic matrix (20 alternating projections), then projects back to the permutation set; the curve subproblem uses 250 rounds of SGD; the control points and the permutation are coupled (Appendix E.1).

    Curve parameterization and connection to robust models

    • The curve uses a quadratic Bezier: rφ(t) = (1−t)²θ1 + 2(1−t)tθc + t²θ2, and the learnable parameter is the control point θc.
    • Connection to robust models: the curve itself is trained with a robust loss, and the input at each point on the path is subjected to a PGD attack; the training scheme follows Zhao et al. (2020), with an initial learning rate of 1E−1.
  4. What experiments did the paper conduct?

    Comparing aligned/unaligned/PAM curves on 3 datasets and 3 architectures, the authors report that the aligned curves are better across the board and alleviate the robust loss barrier of robust models.

    Experimental setup

    • Architectures tested: TinyTen (0.09M parameters, 10-layer narrow CNN), ResNet32 (0.47M), GoogLeNet (10.24M), all image classification networks.
    • Datasets: CIFAR10, CIFAR100, Tiny ImageNet, with the default train/test splits; loss is cross-entropy; 20% of training images are used to compute the alignment.
    • Curve categories: Unaligned (Garipov et al., 2018 baseline), Aligned (aligned endpoints), PAM Unaligned / PAM Aligned (initialized with I and with the aligned permutation, respectively).
    • Sample size: for each architecture-dataset, 6 models with different random initializations are trained, forming 3 independent model pairs; the table uses curves generated with different random seeds, and the figures use the same seed.
    • Training details: endpoint models are trained with SGD for 250 epochs (learning rate 1E−1, decayed by 0.5 every 20 epochs, weight decay 5E−4); curve training runs 250 epochs with batch size 128 (curve learning rate 1E−1 for CIFAR100, 1E−2 for the rest); NVIDIA 2080 Ti.
    • Metrics: average/minimum test accuracy and training loss of models on the curve; the robustness experiments additionally measure robust test accuracy on PGD adversarial examples.

    Main results

    Table 1: average/minimum test accuracy (%) on the curve for each dataset × architecture × curve category.

    Swipe horizontally to read the table

    ModelCurve categoryCIFAR10 avg/minCIFAR100 avg/minTiny ImageNet avg/min
    TinyTenEndpoints89.0 ± 0.158.1 ± 0.534.2 ± 0.2
    TinyTenUnaligned87.4/82.856.0/53.232.5/30.0
    TinyTenPAM Unaligned87.6/84.057.3/55.933.6/32.5
    TinyTenPAM Aligned88.4/87.658.8/57.734.2/33.4
    TinyTenAligned88.5/87.858.7/57.734.4/33.7
    ResNet32Unaligned92.2/89.166.5/64.748.2/45.2
    ResNet32Aligned92.7/92.267.7/66.649.5/48.8
    GoogLeNetUnaligned93.3/92.173.1/69.851.9/48.7
    GoogLeNetAligned93.4/93.173.4/72.952.4/51.4

    (According to Table 1; the PAM rows for ResNet32 and GoogLeNet and some endpoint rows are omitted, ResNet32 endpoints are 92.9/67.1/50.2, GoogLeNet endpoints are 93.4/73.2/51.6.)

    • The authors state that aligned curves outperform unaligned curves in all combinations, and in most cases the average accuracy is close to the endpoint models; the minimum accuracy shows that aligned curves do not have the generalization gap that unaligned curves have.
    • The authors state that the largest gains are for under-parameterized networks (largest improvement on TinyTen/Tiny ImageNet) and the smallest for GoogLeNet/CIFAR10, consistent with the observation of Freeman & Bruna (2016).
    • Figure 3 (CIFAR100): the authors state that the aligned initialization has a better objective value and converges faster in training (on TinyTen/CIFAR100 the aligned curve takes 100 fewer epochs to reach the converged training accuracy of the unaligned curve), and that the unaligned curve has a clear accuracy barrier.

    Alignment promotes similarity of intermediate activations

    • Figure 1b/1c: comparison of the similarity of intermediate activations between the curve midpoint and the endpoint models; the authors state that the midpoint and endpoint activations of aligned curves are more similar (the caption states that under aligned curves the two correlation curves almost coincide).
    • The authors state that even when the endpoints are unaligned, the midpoints learned by unaligned curves are mostly aligned with the endpoints, indicating that this distributional similarity matters for mode connectivity and that the curve is smoothly interpolating features.

    PAM and local optimality

    • In Table 1, PAM Unaligned outperforms Unaligned (e.g., TinyTen/CIFAR100 average 57.3 vs. 56.0), and the authors state that starting from the unaligned initialization does indeed find a better permutation.
    • PAM Aligned is comparable to Aligned, and PAM Unaligned still does not exceed Aligned; on this basis the authors state that the aligned permutation is close to locally optimal, and that this optimality is hard to obtain without some kind of infeasible search.

    Robust model connectivity

    • Setup: adversarially trained CIFAR100 robust models, with the curve trained using a robust loss (the input at each point on the path is subjected to a PGD attack), following the scheme of Zhao et al. (2020).
    • Figure 4: the authors state that unaligned robust curves have barriers in both clean and robust accuracy (consistent with what Zhao et al. report), and that after alignment the clean-accuracy barrier is eliminated or greatly reduced and the robust-accuracy barrier is alleviated.
    • The authors report that for ResNet32 the clean and robust accuracy at the midpoint of the aligned curve increase by 5.3% and 1.3%, respectively, relative to the endpoints; for TinyTen both also increase at the midpoint, whereas on the unaligned curve no model better than the endpoints exists; for GoogLeNet, due to overfitting in adversarial training (Rice et al., 2020), the curve is the result of early stopping at about 20 epochs, and only the aligned curve avoids the robust-accuracy barrier.

    Other ablations and analyses

    • Comparison of alignment methods (Figure 2, TinyTen): post-activation alignment outperforms pre-activation, and maximizing cross-correlation outperforms minimizing L2 distance; all alignment methods outperform unaligned.
    • Hyperparameter sensitivity (Table 3, TinyTen/CIFAR100, 3 learning rates × 3 batch sizes): aligned curve accuracy 57.4–59.0, unaligned 54.2–56.0, and the lowest aligned value is still higher than the highest unaligned value.
    • Training loss (Appendix Table 2): under each combination, the converged training loss of Aligned and PAM Aligned is lower than Unaligned (e.g., ResNet32/CIFAR100: 0.975/1.011 vs. 1.124).
    • Alignment data subset: for CIFAR100 models, the alignment computed on subsets of 2,500/5,000/10,000 is the same.
  5. What are some points that can be further explored?

    The authors point out that the GoogLeNet robustness curve overfits and requires early stopping, and that the theoretical tightness is limited to a specific class of networks; the experiments cover 3 datasets, 3 architectures, and quadratic Bezier curves.

    Limitations and future directions noted by the authors

    • The GoogLeNet robust curve overfits the training data during adversarial training, and the result is the curve after early stopping at about 20 epochs, which the authors say makes its result more complex (Section 5).
    • The theoretical tightness holds only for one class of nontrivial networks: ReLU activation + RMSE loss, and requires specific weight and bias choices so that each inequality holds with equality (Appendix C.2).
    • The theory of post-activation alignment is more complex: due to the nonlinearity of σ, constraints must be added to establish an upper bound, and that bound is not necessarily as tight as for pre-activation alignment (Appendix C.3).
    • The convergence guarantee of Theorem E.1 does not extend to ReLU (rectified) networks; huberized ReLU and an additional stopping criterion are needed to obtain a monotonically decreasing sequence (Appendix E.3.2).
    • The authors believe the hyperparameter insensitivity brought by alignment "will" generalize to other architectures and datasets, but this has not been verified (Appendix F).

    Scope of experiments

    • The architectures tested are TinyTen, ResNet32, and GoogLeNet, 3 in total; the datasets are CIFAR10, CIFAR100, and Tiny ImageNet, 3 in total (Section 4).
    • For each architecture-dataset combination, 6 models are trained to form 3 independent model pairs; the curve categories are Unaligned, Aligned, PAM Unaligned, PAM Aligned (Section 4).
    • The curve parameterization uses only quadratic Bezier curves; PAM performs only a single outer iteration, and the permutation subproblem samples M=32 block permutation matrices (Appendices E.2, E.4).
    • The robust experiments are done on CIFAR100 with three architectures, with CIFAR10 results in Appendix Figure 9; the attack uses only PGD (l∞ bounded), and the training scheme follows Zhao et al. (2020) (Sections 2.3, 5).
    • The paper does not report the number of repetitions or standard deviations for the robust experiments; the robust results are given only as curves in Figures 4, 8, 9.
  6. Summarize the main content of the paper

    The authors propose neuron alignment to approximate the optimal weight permutation in order to learn low-loss connecting curves; on 3 datasets and 3 architectures it outperforms unaligned curves and alleviates the robust loss barrier.

    An analysis paper on loss-surface geometry: it studies the effect of weight permutation symmetry on mode connectivity and gives a practical approximate solution.

    • Problem: existing curve learning algorithms (e.g., Garipov et al., 2018) do not consider the weight symmetry caused by hidden-layer neuron permutation, which the authors argue leads to underestimation of the intrinsic connectivity between models.
    • Method: generalize curve learning to jointly optimize the endpoint permutation P and the curve parameters φ; use neuron alignment based on post-activation cross-correlation (assignment solved by the Hungarian algorithm, complexity O(LM³)) to approximate the optimal permutation, then learn a quadratic Bezier curve; Theorem 3.1 gives a tighter loss upper bound after alignment, and PAM is used to test local optimality.
    • Main results: on CIFAR10/CIFAR100/Tiny ImageNet and TinyTen/ResNet32/GoogLeNet, the authors report that the average and minimum test accuracy of aligned curves are both better than unaligned curves (Table 1), e.g., TinyTen/Tiny ImageNet average 34.4 vs. 32.5; under-parameterized networks benefit the most.
    • Optimality evidence: PAM Aligned is comparable to Aligned, and PAM Unaligned still falls short of Aligned, on which basis the authors state that the aligned permutation is close to locally optimal; aligned curves converge faster (100 fewer epochs on TinyTen/CIFAR100).
    • Robust connectivity: for PGD adversarially trained CIFAR100 models, the authors state that alignment greatly alleviates the robust loss barrier found by Zhao et al. (2020); for ResNet32 the clean and robust accuracy at the midpoint of the aligned curve increase by 5.3% and 1.3%, respectively, relative to the endpoints.
    • Authors' conclusion: handling symmetry is key to learning flat low-loss curves, robust models are in fact connected on the loss surface, and curve learning can serve as a means to find more accurate robust models and avoid expensive hyperparameter tuning; limitations include that the GoogLeNet robustness curve overfits and requires early stopping, and that the theoretical tightness is limited to a specific class of networks.
Read originalarxiv.org