The Memory-Perturbation Equation: Understanding Model's Sensitivity to Data

Peter Nickl, Lu Xu, Dharmesh Tailor, Thomas Möllenhoff, Mohammad Emtiyaz Khan

Abstract

Understanding how individual data points influence a machine learning model is critical for ensuring privacy, security, and data quality. However, traditional methods for measuring sensitivity—such as brute-force retraining or influence functions—are often computationally prohibitive or restricted to the end-of-training stationary points. This paper introduces the Memory-Perturbation Equation (MPE), a unifying Bayesian framework derived from the Bayesian Learning Rule (BLR). The MPE allows for the tracking of model sensitivity throughout the entire training trajectory, providing a computationally efficient way to estimate generalization and identify the "memory" of a model without requiring a separate test set.

Introduction

In modern machine learning, the relationship between a model and its training data is often a "black box." Determining which specific examples drive a model's predictions is vital for detecting data leakage, identifying malicious manipulations, and uncovering biases. Historically, researchers have relied on two primary methods for sensitivity analysis: brute-force retraining (removing data and retraining from scratch) and Influence Functions (using local derivatives to estimate change). While retraining is too expensive for deep learning, standard Influence Functions are limited by their reliance on differentiability and their restriction to converged models.

This work proposes the Memory-Perturbation Equation (MPE) to bridge these gaps. By viewing optimization through a Bayesian lens, the MPE provides a local perturbation method that is compatible with common algorithms like SGD, Adam, and Newton’s method, and remains applicable at any stage of training.

Theoretical Framework: The Memory-Perturbation Equation

The MPE is rooted in the Bayesian Learning Rule (BLR), which treats optimization algorithms as forms of Bayesian inference. The derivation follows a simple yet powerful mathematical intuition: in a Bayesian context, removing a data point from the training set is equivalent to dividing the posterior distribution by the likelihood of that specific point.

The "Natural" Advantage

When using conjugate exponential families, this division operation simplifies into the subtraction of "natural parameters." The MPE demonstrates that the sensitivity of a model to a specific group of examples is equal to the sum of their natural gradients. This leads to several key properties:

  1. Additivity: The sensitivity of a dataset subset is simply the sum of the individual natural gradients of its members. This makes calculating the impact of removing entire classes or batches trivial.
  2. The Error-Variance Product: For Gaussian models, sensitivity can be interpreted as the product of prediction error and prediction variance. This suggests that a model is most sensitive to data points where it is both highly uncertain and significantly incorrect.
  3. Unification: The authors prove that classic metrics, such as Cook’s distance in linear regression and standard Influence Functions in deep learning, are specific instances of the broader MPE framework.

Experimental Validation

The authors evaluated the MPE across several standard image classification benchmarks, including MNIST, Fashion-MNIST (FMNIST), CIFAR-10, and USPS. These tests utilized various architectures, ranging from Multi-Layer Perceptrons (MLPs) to more complex models like LeNet5 and ResNet-20.

Generalization Tracking

A significant finding is the MPE's ability to track generalization during training. By calculating a "Leave-One-Out" (LOO) score on the training data using the MPE, the researchers found that the resulting curve almost perfectly mirrors the actual Test Loss (Negative Log-Likelihood) throughout the training process. This allows practitioners to estimate how well a model will perform on unseen data using only the training set.

Model Memory and Sensitivity

As training progresses, the model’s sensitivity tends to concentrate on a small fraction of the data. These high-sensitivity examples—often ambiguous or mislabeled images—constitute the model's "memory." Perturbing these specific points has a disproportionate effect on the model's decision boundaries, whereas the model remains robust to perturbations of the remaining "easy" examples.

Key Results and Applications

  • High Fidelity: MPE estimates show a strong correlation with the "ground truth" results obtained through expensive retraining.
  • Hyperparameter Optimization: The MPE accurately predicts optimal weight decay ($\delta$) values, matching results typically obtained through exhaustive cross-validation.
  • Computational Efficiency: Since the MPE utilizes quantities already computed during standard training (gradients), it introduces negligible overhead, making it viable for real-time monitoring.

Conclusion and Future Work

The Memory-Perturbation Equation provides a robust, theoretically grounded framework for understanding data sensitivity. By enabling sensitivity analysis throughout the training trajectory, it opens new doors for monitoring generalization and data quality in real-time. Future research will focus on scaling the MPE to massive "foundation" models and exploring non-Gaussian posterior approximations, such as mixture models or ensembles, to further refine its predictive power.

Summary updated

BibTeX
@inproceedings{nickl2023memory,
  author = {Peter Nickl and Lu Xu and Dharmesh Tailor and Thomas Möllenhoff and Mohammad Emtiyaz Khan},
  title = {{The Memory-Perturbation Equation: Understanding Model's Sensitivity to Data}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=dqS1GuoG2V},
}
Figure