Robust Representation via Dynamic Feature Aggregation

Haozhe Liu, Haoqin Ji, Yuexiang Li, Nanjun He, Haoqian Wu, Feng Liu, Linlin Shen, Yefeng ZhengarXiv 2022 · DOI · arXiv

Abstract

Deep neural networks are often "brittle" because their internal feature spaces are sparse, leaving ample room for adversarial attacks to exploit "empty" regions. This paper introduces Dynamic Feature Aggregation (DFA), a method that compresses these feature spaces by pulling data points toward a central "pivot." Combined with an orthogonal classifier to maintain class separation, DFA creates a model that is significantly more robust to adversarial attacks and superior at detecting out-of-distribution (OOD) data. Unlike traditional adversarial training, DFA achieves these gains without massive computational overhead or significant degradation in clean image accuracy.

1. Introduction: The Sparsity Problem

Standard Convolutional Neural Networks (CNNs) are notoriously vulnerable to adversarial attacks—tiny, invisible perturbations that cause misclassification. The authors argue that a primary reason for this vulnerability is the sparsity of the embedding space. In a typical high-dimensional feature space, data points are scattered far apart, leaving vast "empty" areas. An attacker can nudge a feature point into these regions to cross a decision boundary without noticeably changing the input image.

Conceptual comparison of feature space density and its impact on adversarial robustness. (a) Vanilla models have sparse spaces with "blind spots." (b) The proposed method pushes features together to eliminate these gaps.

While adversarial training (training on attacked images) can mitigate this, it is computationally expensive and often reduces performance on "clean" images. DFA addresses this by structurally regularizing the feature space itself.

2. Methodology

The proposed framework employs a two-pronged strategy to densify the embedding space while maintaining class discriminability.

2.1 Dynamic Feature Aggregation (DFA)

Instead of training solely on individual images, the model selects two samples ($x_i, x_j$) and creates a "pivot" ($\hat{x}_{ij}$) using a convex combination of their features. The model is then regularized via an Aggregation Loss ($\mathcal{L}_a$) to pull the features of the original samples closer to this pivot. This forces the model to learn a more compact, dense representation where "empty space" is minimized. This strategy helps the model satisfy the Lipschitz constraint, a mathematical property linked to model stability.

The DFA architecture: features $v_i$ and $v_j$ are extracted and pulled toward a pivot feature derived from a convex combination of inputs.

2.2 Orthogonal Classifier

Compressing a feature space risks a "trivial solution" where the model collapses all classes into a single point. To prevent this, the authors replace the final fully-connected layer with an orthogonal classifier. The weight vectors for different classes are constrained to be perpendicular (orthogonal), ensuring that classes remain mathematically separated even as the overall space is compressed.

3. Experimental Results

The researchers evaluated DFA on standard benchmarks including CIFAR-10, CIFAR-100, and Tiny ImageNet.

3.1 Adversarial Robustness

On CIFAR-10, the proposed method achieved an average accuracy of 56.91% against various adversarial attacks (e.g., PGD and CW). This significantly outperforms the strong Mixup baseline, which achieved only 19.60%. Notably, DFA improved clean accuracy by approximately 0.69% on CIFAR-10, avoiding the accuracy trade-off common in adversarial training.

3.2 Out-of-Distribution (OOD) Detection

A compact feature space naturally improves OOD detection. By defining tight clusters for known data, the model more easily identifies "alien" data points. Using CIFAR-10 as in-distribution and LSUN as OOD, the method achieved an F1 score of 0.937, outperforming specialized OOD detection frameworks.

3.3 Efficiency

Because DFA relies on a novel loss function rather than generating adversarial examples during training, it avoids the 3x-10x slowdown typical of adversarial training, making it a highly efficient alternative for building robust models.

4. Conclusion

Dynamic Feature Aggregation demonstrates that density in the embedding space is a key component of model robustness. By "packing" the feature space and enforcing class orthogonality, DFA provides a scalable and efficient defense against adversarial perturbations and improves OOD detection without sacrificing standard performance. Future work may involve auto-adapting the noise terms used in the aggregation loss and scaling the method to larger datasets like ImageNet-1K.

Summary updated

Abstract

Deep convolutional neural network (CNN) based models are vulnerable to the adversarial attacks. One of the possible reasons is that the embedding space of CNN based model is sparse, resulting in a large space for the generation of adversarial samples. In this study, we propose a method, denoted as Dynamic Feature Aggregation, to compress the embedding space with a novel regularization. Particularly, the convex combination between two samples are regarded as the pivot for aggregation. In the embedding space, the selected samples are guided to be similar to the representation of the pivot. On the other side, to mitigate the trivial solution of such regularization, the last fully-connected layer of the model is replaced by an orthogonal classifier, in which the embedding codes for different classes are processed orthogonally and separately. With the regularization and orthogonal classifier, a more compact embedding space can be obtained, which accordingly improves the model robustness against adversarial attacks. An averaging accuracy of 56.91% is achieved by our method on CIFAR-10 against various attack methods, which significantly surpasses a solid baseline (Mixup) by a margin of 37.31%. More surprisingly, empirical results show that, the proposed method can also achieve the state-of-the-art performance for out-of-distribution (OOD) detection, due to the learned compact feature space. An F1 score of 0.937 is achieved by the proposed method, when adopting CIFAR-10 as in-distribution (ID) dataset and LSUN as OOD dataset. Code is available at https://github.com/HaozheLiu-ST/DynamicFeatureAggregation.
BibTeX
@misc{liu2022robust,
  author = {Haozhe Liu and Haoqin Ji and Yuexiang Li and Nanjun He and Haoqian Wu and Feng Liu and Linlin Shen and Yefeng Zheng},
  title = {{Robust Representation via Dynamic Feature Aggregation}},
  year = {2022},
  eprint = {2205.07466},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.07466},
}
Figure