Instance-wise Linearization of Neural Network for Model Interpretation

Zhimin Li, Shusen Liu, Kailkhura Bhavya, Peer-Timo Bremer, Valerio PascucciarXiv 2023 · arXiv

TL;DR

This paper introduces instance-wise linearization, a method that simplifies the complex, non-linear forward pass of a neural network into a single linear equation, $F(x) = W \cdot x + b$, for any specific input. By mathematically aggregating every layer—including convolutions, pooling, and batch normalization—into a single "explainable matrix," the authors provide a way to see exactly how each input feature contributes to a model's final decision.

What Problem Does This Paper Address?

Despite their success, neural networks remain "black boxes." We know they work, but we often don't know why they make specific decisions. Traditional interpretability methods, like feature attribution (heatmaps), provide importance scores for input pixels but fail to explain the internal mechanics of how those features are processed.

The core challenge is non-linearity, usually introduced by activation functions like ReLU. However, the authors point out a crucial observation: for a single specific input, the "activation pattern" (which neurons are on or off) is fixed. In this local neighborhood, the model actually behaves linearly. The authors seek to exploit this local linearity to provide a mathematically exact decomposition of a model's prediction.

Methods

The authors propose a framework to reformulate every standard component of a Convolutional Neural Network (CNN) into a linear matrix operation for a given instance:

  • Linearization of Layers: They demonstrate how Fully Connected, Convolutional (Figure 3), and Pooling layers (Figure 2) can be represented as matrix multiplications. For example, a convolution operation is rephrased as a multiplication by a sparse, structured matrix.
  • Handling Activations: For piece-wise linear activations like ReLU, the operation is treated as a re-scaling factor ($\lambda$) that is either 0 or 1, effectively "pruning" inactive connections for that specific instance.
  • Layer Aggregation: By nesting these linear representations, the entire network's forward pass is collapsed into a single global weight matrix $W$ and a bias vector $b$.
  • Skip Connections & Batch Norm: The method also accounts for modern architectures by linearizing ResNet-style skip connections (Figure 4) and integrating batch normalization parameters directly into the linear weights and biases.
Figure 1. A prediction of neural network model has only one ac- tivation pattern and the complex prediction operation can be sim- plified as a linear matrix multiplication.

Datasets

The researchers evaluated their approach across several standard benchmarks to test its flexibility and accuracy:

  • MNIST: Hand-written digit recognition (used for LeNet5/LeNet300).
  • CIFAR-10 & CIFAR-100: Object recognition in small images (used for VGG, ResNet, and DenseNet).
  • ImageNet: Large-scale visual recognition (10,000 validation samples).
  • Iris Dataset: Used specifically to demonstrate the method's application in unsupervised learning via parametric t-SNE.

Key Insights and Ideas

  • The "Explainable Matrix" $W$: For piece-wise linear networks, the matrix $W$ is equivalent to the input-output Jacobian. It doesn't just show sensitivity; it represents the model's "unique footprint" for that specific prediction.
  • The Dominance of Bias: A surprising finding was the role of the bias term $b$. In simple models like LeNet on MNIST, the $W \cdot x$ term does most of the heavy lifting. However, in deeper models like ResNet on CIFAR or ImageNet, the bias term $b$ often dominates the final prediction score.
  • Neuron-Level Attribution: Because the method builds the global $W$ layer-by-layer, researchers can look at the "contribution" of input features to any internal neuron, not just the final output. This allows for a granular view of how features are transformed through the network (Figure 7).
Figure 7. Displaying the features that captured by top 5 positive neurons and 5 negative neurons with their contribution to a model’s final prediction in different layers of the LeNet5 model.

Key Results

  • Fidelity: The linearized equation $F(x) = W \cdot x + b$ perfectly matches the original model's output, proving the mathematical validity of the decomposition.
  • MNIST vs. Complex Data: On MNIST, removing the bias term $b$ barely affected accuracy (dropping from 0.992 to ~0.98). However, on CIFAR-10, the $W \cdot x$ term alone only achieved ~36% accuracy for LeNet5, while the bias term $b$ carried much more predictive weight.
  • Unsupervised Interpretation: The authors successfully applied the method to parametric t-SNE, showing that they could explain which features were responsible for clustering specific data points in a 2D projection.

Limitations and Future Work

  • Bias Dominance in Large Models: The fact that $b$ dominates in large models suggests that $W \cdot x$ (the part directly tied to input features) might not tell the whole story for complex architectures. The authors suggest training models without batch normalization to make $W$ more informative.
  • Non-Piece-Wise Activations: While the method works for ReLU, activations like GELU, SELU, or ELU are not strictly piece-wise linear. For these, the Jacobian cannot be used directly, and the linearization must be calculated carefully layer-by-layer, which is computationally more intensive.
  • Scalability: While mathematically sound, calculating these massive aggregated matrices for very deep networks with high-resolution inputs could face memory and computational bottlenecks.

Summary updated

Abstract

Neural network have achieved remarkable successes in many scientific fields. However, the interpretability of the neural network model is still a major bottlenecks to deploy such technique into our daily life. The challenge can dive into the non-linear behavior of the neural network, which rises a critical question that how a model use input feature to make a decision. The classical approach to address this challenge is feature attribution, which assigns an important score to each input feature and reveal its importance of current prediction. However, current feature attribution approaches often indicate the importance of each input feature without detail of how they are actually processed by a model internally. These attribution approaches often raise a concern that whether they highlight correct features for a model prediction. For a neural network model, the non-linear behavior is often caused by non-linear activation units of a model. However, the computation behavior of a prediction from a neural network model is locally linear, because one prediction has only one activation pattern. Base on the observation, we propose an instance-wise linearization approach to reformulates the forward computation process of a neural network prediction. This approach reformulates different layers of convolution neural networks into linear matrix multiplication. Aggregating all layers' computation, a prediction complex convolution neural network operations can be described as a linear matrix multiplication $F(x) = W \cdot x + b$. This equation can not only provides a feature attribution map that highlights the important of the input features but also tells how each input feature contributes to a prediction exactly. Furthermore, we discuss the application of this technique in both supervise classification and unsupervised neural network learning parametric t-SNE dimension reduction.
BibTeX
@misc{li2023instance,
  author = {Zhimin Li and Shusen Liu and Kailkhura Bhavya and Peer-Timo Bremer and Valerio Pascucci},
  title = {{Instance-wise Linearization of Neural Network for Model Interpretation}},
  year = {2023},
  eprint = {2310.16295},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.16295},
}
Figure