On the Functional Similarity of Robust and Non-Robust Neural Representations

András Balogh, Márk JelasityICML 2023

Introduction

By "stitching" together halves of different neural networks, researchers have found that while robust and non-robust models learn fundamentally different internal features, their final layers are surprisingly interchangeable. While robustness is a fragile property that can vanish in the middle of a "Frankenstein" network, the final layers of almost any model trained on the same task can be swapped with minimal loss in standard accuracy.

The Problem: Are Robust Models Fundamentally Different?

In deep learning, different models trained on the same task often learn similar internal representations—a concept known as functional similarity. However, "robust" models (those explicitly trained to resist adversarial attacks) seem to be an exception. Previous research suggests they are qualitatively different: they are more "invertible" (allowing image reconstruction from internal features) and rely on a different set of features than standard, non-robust models.

This paper asks a fundamental question: Are these two types of models truly incompatible? Can we take the "head" (early layers) of a robust model and the "tail" (later layers) of a non-robust model and still have a functioning classifier? By answering this, the authors shed light on whether robustness is a holistic property that permeates the entire network or if it is localized to specific stages of processing.

Methodology: Adversarial Stitching

The primary tool used to investigate this is Model Stitching. This technique involves taking the first $l$ layers of a "front" model and connecting them to the remaining layers of an "end" model using a simple, trainable 1x1 convolutional layer (an affine transformation). The resulting stitched network is then evaluated for performance.

To evaluate robustness, the authors introduce a novel variation called Adversarial Stitching. Unlike standard stitching, which only optimizes for plain accuracy, adversarial stitching trains the connecting layer using adversarial examples. This allows researchers to test if the robustness of a representation can be preserved or transferred across the stitched boundary. The study primarily uses CIFAR-10, alongside SVHN, MNIST, and Fashion-MNIST, testing architectures like ResNet-18 and VGG-11 with state-of-the-art robust models from RobustBench.

Key Insights and Results

Accuracy is Universal, Robustness is Fragile

One of the most striking findings is that you can stitch almost any two models together and maintain plain accuracy. However, robust accuracy is much harder to preserve.

Stitching a non-robust front to a robust end

As shown above, if you stitch a non-robust front to a robust end, robustness is completely lost after the first few layers (the orange line drops to zero). Conversely, when stitching a robust front to a non-robust end, plain accuracy remains high, but robust accuracy drops significantly in the middle layers before recovering towards the end.

Stitching a robust front to a non-robust end

The "Abstract Task" Layer

The final layers of neural networks appear to be highly interchangeable, regardless of whether the model is robust or not, or even if it was trained on a different dataset (e.g., stitching a CIFAR-10 front to an SVHN end). The authors argue this is because the final layers care more about the abstract task (e.g., "classify into 10 categories") than the specific input distribution. Replacing the last few layers of a CIFAR-10 model with layers from an SVHN model resulted in nearly perfect accuracy recovery.

Representation Clustering and Invertibility

The paper suggests that as data moves through a network, it becomes increasingly "clustered" by class. This clustering makes the representations in the final layers much easier to align linearly, explaining why the "tails" of models are so interchangeable. Furthermore, even if the "tail" of a network is non-robust, the full stitched model remains "invertible" if the "front" is robust. This proves that the information-preserving nature of robust models is maintained through the early and middle layers.

The Robustness-Accuracy Trade-off

In a surprising sanity check, the authors found that adding a stitching layer to a robust model and optimizing for plain accuracy actually improved its standard accuracy while decreasing its robustness. This suggests that the internal features of robust models are "good enough" for high accuracy, but the standard weights are intentionally sub-optimal to maintain a safety margin against attacks.

Limitations and Future Work

  • Computational Cost: Adversarial stitching is extremely expensive, requiring roughly one full "GPU year" of computation for these experiments. This limited the number of architectures and datasets that could be exhaustively tested.
  • The "Why" of Clustering: While visualizations show that representations cluster more in later layers, a formal, theoretical link between clustering and "stitchability" remains an open area for research.
  • Scaling Up: Future work could investigate if these findings hold for much larger models (like Transformers) or more complex datasets like ImageNet, where the "abstract task" is significantly more difficult.

Summary updated

BibTeX
@inproceedings{balogh2023functional,
  author = {András Balogh and Márk Jelasity},
  title = {{On the Functional Similarity of Robust and Non-Robust Neural Representations}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=5auAtbCGuS},
}
Figure