Sparsity-Probe: Analysis tool for Deep Learning Models

Ido Ben-Shaul, Shai Dekel

Abstract

We propose a probe for the analysis of deep learning architectures that is based on machine learning and approximation theoretical principles. Given a deep learning architecture and a training set, during or after training, the Sparsity Probe allows to analyze the performance of intermediate layers by quantifying the geometrical features of representations of the training set. We show how the Sparsity Probe enables measuring the contribution of adding depth to a given architecture, to detect under-performing layers, etc., all this without any auxiliary test data set.

Introduction

Despite their success, Deep Neural Networks (DNNs) are often treated as "black boxes." Practitioners frequently rely on trial-and-error to design architectures, and it is notoriously difficult to quantify the specific contribution of an individual layer to the final result. Standard evaluation relies on auxiliary test sets to estimate performance; however, these metrics do not explain where or why a model might be failing internally. Existing diagnostic tools, like linear probes, attempt to classify data at intermediate layers using simple linear models. However, many datasets are inherently non-linear, making it unclear if a linear probe's failure stems from a poor layer representation or simply a "crumpled" data geometry that a linear model cannot resolve.

Methodology

The authors propose the Sparsity-Probe, which treats each layer as a mathematical mapping. The core idea is that a well-trained network "uncrumples" data as it passes through the layers, making the mapping from features to labels increasingly "smooth" and "simple."

The concept of 'uncrumpling' data representations through successive layers.

To measure this simplicity, the probe utilizes:

  1. Wavelet Decomposition of Random Forests: A Random Forest is trained to map a layer's features to the target labels. These trees are then decomposed into "geometric wavelets."
  2. $\tau$-Sparsity: A sparsity index ($\tau^*$) is calculated based on these wavelets. In approximation theory, a function represented by fewer wavelets (high sparsity) is considered simpler.
  3. $\alpha$-Score: An $\alpha$-score is derived from the sparsity index. A higher $\alpha$-score indicates a better, more separable representation of the data.

Unlike linear probes, this method handles complex, non-linear geometries by relying on the adaptive partitioning of Random Forests.

Experimental Setup

The Sparsity-Probe was validated across several settings:

  • Synthetic Datasets: Non-linearly separable problems such as Spirals, Circles, and Gaussian Quantiles.
  • Computer Vision Benchmarks: CIFAR-10 and Fashion-MNIST.
  • MNIST-1D: A 1D version of the digit dataset used to study signal intertwining.
  • Fourier-MNIST: A version of MNIST using only the magnitude of Fourier coefficients to strip away spatial correlations.

Analysis and Insights

The paper formalizes the intuition that deep learning is essentially a process of unfolding a high-dimensional "paper ball" of data. The Sparsity-Probe provides a concrete metric to track this progress.

UMAP visualization showing how data clusters become cleaner across network layers.

Key observations include:

  • Sparsity vs. Accuracy: The $\alpha$-score calculated from training data alone shows a remarkably high correlation with final test accuracy. This suggests model quality can be evaluated without a validation set during architecture search.
  • Identifying Bottlenecks: The probe can pinpoint exactly where a network fails. For instance, increasing the stride of a convolutional layer excessively results in a sharp dip in the $\alpha$-score at that specific layer, indicating information loss.
  • Max-Pooling Dips: MaxPooling layers often cause a temporary drop in the $\alpha$-score. As a non-learned, coarse discretization, MaxPooling temporarily makes the representation "messier" before subsequent layers refine it.

Results

On synthetic datasets where linear probes failed, the Sparsity-Probe correctly identified the underlying separability of the data. When comparing architectures, the probe clearly distinguished between effective models (like ResNet) and poorly designed ones, with $\alpha$-scores rising in the former and declining in the latter. Furthermore, in high-performing models, the $\alpha$-score correlated strongly (up to 0.96) with classical clustering metrics like the Adjusted Rand Index, while remaining informative in shallow layers where standard indices become vague.

Conclusion

The Sparsity-Probe offers a mathematically grounded diagnostic tool for "peeking" inside deep neural networks. By measuring representation sparsity, it allows researchers to debug architectures and optimize depth using only training data. While the computational cost of training Random Forests for every layer is significant, the tool provides unique insights into the internal mechanics of DNNs. Future work will focus on extending this analysis to generative models and regression tasks.

Summary updated

Abstract

We propose a probe for the analysis of deep learning architectures that is based on machine learning and approximation theoretical principles. Given a deep learning architecture and a training set, during or after training, the Sparsity Probe allows to analyze the performance of intermediate layers by quantifying the geometrical features of representations of the training set. We show how the Sparsity Probe enables measuring the contribution of adding depth to a given architecture, to detect under-performing layers, etc., all this without any auxiliary test data set.
BibTeX
@misc{benshaul2021sparsity,
  author = {Ido Ben-Shaul and Shai Dekel},
  title = {{Sparsity-Probe: Analysis tool for Deep Learning Models}},
  year = {2021},
  eprint = {2105.06849},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2105.06849},
}
Figure