Topology and geometry of data manifold in deep learning

German Magai, Anton AyzenbergarXiv 2022

Abstract

Despite the widespread success of deep neural networks (DNNs), their internal mechanisms for transforming raw input into abstract classifications remain largely opaque. This paper investigates the "manifold untangling" hypothesis—the idea that DNNs work by progressively flattening complex, high-dimensional data surfaces. Using Topological Data Analysis (TDA), specifically Persistent Homology, we quantify the complexity of internal representations across various architectures. Our results demonstrate that successful training leads to a consistent reduction in topological complexity, measured by the Persistent Homology Fractal Dimension ($PHdim$). We find a strong inverse correlation ($r \approx -0.9$) between the topological simplicity of a model's final layers and its ability to generalize to unseen data.

Introduction

A central challenge in deep learning theory is understanding how networks transform "tangled" input data (like a set of pixel values) into linearly separable classes. The manifold untangling theory posits that data lies on a complex, high-dimensional surface that the network must unfold layer by layer. This study seeks to provide mathematical evidence for this process by analyzing the geometric and topological properties of data as it passes through modern convolutional neural networks (CNNs).

Methodology: Persistent Homology

To measure the "shape" of data within a network, the authors employ Persistent Homology. This technique involves growing $n$-dimensional spheres around each data point in a high-dimensional space. As these spheres expand and merge, they form simplicial complexes (shapes made of points, edges, and triangles). TDA tracks the "birth" and "death" of topological features—such as connected components ($H_0$) and cycles/holes ($H_1$)—across different scales.

Conceptual overview of Persistent Homology: tracking the birth and death of topological features as data points merge.

These birth and death events are summarized in barcodes or persistence diagrams. From these, the authors derive the Persistent Homology Fractal Dimension ($PHdim$), a metric that estimates the intrinsic dimension of the data manifold. A lower $PHdim$ indicates a simpler, more "untangled" representation.

Key Insights and Results

The Untangling Process

The study analyzed several architectures, including ResNet, VGG, MobileNetV2, and SE-ResNet, using datasets like CIFAR-10 and SVHN. A consistent trend emerged: as data moves from the input toward the output, its topological complexity decreases. This simplification is not uniform; for instance, ResNet begins untangling data in its earliest blocks, while MobileNetV2, which utilizes linear bottlenecks, delays significant simplification until the middle of the network.

Topological complexity (Lifespans and PHdim) across network depth for various architectures. Brighter colors indicate higher test accuracy.

Simplicity as a Predictor of Generalization

One of the most significant findings is the relationship between topology and performance. There is a statistically significant inverse correlation between the topological complexity of the final layer and the model's test accuracy. Models that are more effective at simplifying the data manifold tend to generalize better. Crucially, because $PHdim$ can be calculated using only the training set, it serves as a potential "topological predictor" of generalization that does not require a separate validation set.

Impact of Activation Functions and Adversarial Attacks

The choice of activation function significantly impacts a network's ability to untangle manifolds. Modern non-linearities like Swish and ReLU are more effective at topological simplification than older functions like Sigmoid or Tanh. Conversely, adversarial attacks appear to "re-tangle" the manifold. While an attack might move data closer to a decision boundary (appearing simpler in a local sense), it typically increases the overall intrinsic dimension by introducing high-dimensional noise.

Conclusion and Future Work

This research provides a robust mathematical framework for visualizing the "black box" of deep learning. By treating DNNs as topological simplifiers, we can better understand why certain architectures and activation functions outperform others. While this study focused on CNNs for computer vision, future research will explore whether these topological principles hold for Recurrent Neural Networks (RNNs) and Transformers, potentially leading to new metrics for model selection and optimization.

Summary updated

BibTeX
@misc{magai2022topology,
  author = {German Magai and Anton Ayzenberg},
  title = {{Topology and geometry of data manifold in deep learning}},
  year = {2022},
  eprint = {2204.08624},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.08624},
}
Figure