A Swiss Army Infinitesimal Jackknife

Ryan Giordano, William T. Stephenson, Runjing Liu, Michael I. Jordan, Tamara Broderick

Abstract

The error or variability of machine learning algorithms is often assessed by repeatedly refitting a model with different weighted versions of the observed data. The ubiquitous tools of cross-validation and the bootstrap are examples of this approach. However, for modern, large-scale datasets, the computational cost of re-fitting can be prohibitive. This paper introduces a "Swiss Army Infinitesimal Jackknife" (IJ), providing a fast, mathematically rigorous way to estimate model uncertainty and perform cross-validation without the grueling cost of repeated re-fitting. By utilizing a linear approximation based on the model's Hessian, we achieve an order-of-magnitude speedup while providing the first finite-sample error bounds that accommodate models with unbounded gradients.

Introduction

In modern machine learning, assessing model stability is critical. Techniques like Cross-Validation (CV)—which involves leaving out data subsets and re-fitting—and the Bootstrap—sampling with replacement and re-fitting—are standard for estimating error and variance. However, for massive datasets and complex models, re-fitting a model hundreds or thousands of times is often computationally impossible.

While the "Infinitesimal Jackknife" (IJ) is a classical statistical tool designed to approximate these changes using derivatives, its application in modern ML has been limited. Historically, it was used primarily for theoretical proofs and required restrictive assumptions, such as bounded gradients, which do not hold for many common models. This research aims to transform the IJ into a practical, reliable tool for the modern practitioner by providing new theoretical guarantees and leveraging modern automatic differentiation tools.

Methodology

The core principle of the IJ is to treat the model's optimal parameters ($\hat{\theta}$) as a function of the weights assigned to each data point. The process involves three primary steps:

  1. Initial Fit: The model is trained once on the full dataset, where every data point is assigned a weight of 1.
  2. Linear Approximation: Instead of re-optimizing the model when weights change (e.g., setting a weight to 0 to "remove" a point for CV), a first-order Taylor expansion is employed.
  3. The IJ Formula: The approximation is calculated as: $$\hat{\theta}_{IJ}(w) \approx \hat{\theta}_1 - H_1^{-1} G(\hat{\theta}_1, \Delta w)$$ where $H_1$ represents the Hessian (the matrix of second derivatives) and $G$ represents the gradient.

This approach offers several advancements. The authors provide finite-sample error bounds, proving the proximity of this approximation to the "true" re-fitted result. Furthermore, they remove the requirement for bounded gradients, making the theory applicable to common models like squared error loss or Poisson regression. Finally, the integration with automatic differentiation tools (like Autograd or PyTorch) simplifies the calculation of these complex derivatives for the end-user.

Empirical Evaluation

The method was evaluated using simulated Generalized Linear Models (GLMs) and a real-world genomics dataset involving time-series gene expression in mice. The genomics task required clustering 1,000 genes over 14 time points, resulting in a complex optimization problem with approximately 39,000 parameters.

Computational Efficiency

The primary advantage of the IJ is its speed. In the genomics experiment, the initial optimization took approximately 42 seconds. While the one-time Hessian calculation required about 360 seconds, subsequent IJ approximations for various cross-validation folds were nearly instantaneous. As shown in Figure 1, the time required for the IJ grows much more slowly than exact CV as the data size $N$ increases.

Figure 1: Comparison of computation time between Exact CV and the Infinitesimal Jackknife (IJ) as data size N increases.

Predictive Accuracy and Model Selection

Across both simulated and real-world tests, the IJ consistently tracked the "Exact CV" error curves. In the genomics application, the IJ successfully captured the trend of overfitting, allowing for correct model selection, such as determining the appropriate degrees of freedom for a spline. As illustrated in Figure 5, the IJ MSE closely follows the test error and exact CV curves across different model complexities.

Figure 5: MSE on held-out timepoints for the genomics dataset, showing IJ closely tracking Exact CV and Test error across different degrees of freedom.

Discussion and Future Directions

The IJ provides a "Large $N$" advantage: as datasets grow, the influence of any single data point diminishes, making linear approximations increasingly accurate in the regimes where they are most needed. Furthermore, the method is applicable to broad "M-estimators," including multi-stage pipelines.

However, limitations remain. The method requires the objective function to be twice continuously differentiable, meaning it cannot be directly applied to models with "kinks," such as those using ReLU activations or $L_1$ (Lasso) regularization. Additionally, for extremely high-dimensional models like deep neural networks, inverting the full Hessian is computationally prohibitive. Future work may involve integrating the IJ with stochastic second-order methods or higher-order expansions to address these challenges.

Summary updated

BibTeX
@inproceedings{giordano2019swiss,
  author = {Ryan Giordano and William T. Stephenson and Runjing Liu and Michael I. Jordan and Tamara Broderick},
  title = {{A Swiss Army Infinitesimal Jackknife}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2019},
  url = {https://openreview.net/forum?id=h5LdeLT_5hB},
}
Figure