Z0-Inf: Zeroth Order Approximation for Data Influence

Narine Kokhlikyan, Kamalika Chaudhuri, Saeed Mahloujifar

TL;DR

Estimating how individual training examples influence a machine learning model's predictions is crucial for debugging and data curation, but existing gradient-based methods scale poorly to Large Language Models (LLMs). This paper introduces Z0-Inf, a highly efficient zeroth-order approximation method that computes data influence using only intermediate checkpoint loss values. Z0-Inf achieves an order-of-magnitude reduction in time and memory footprint while delivering superior accuracy for self-influence and competitive results for train-test influence in LLMs.

What Problem Does This Paper Address?

Understanding data influence—quantifying how much a specific training data point affects a model's final predictions—is essential for tasks like data selection, outlier detection, and model debugging. The gold standard for measuring this is the "remove-and-retrain" approach, which physically removes a data point and retrains the model from scratch to see what changes. Obviously, this is computationally impossible to do for every single training point in modern deep learning, let alone for LLMs.

To bypass retraining, researchers use influence approximations. These generally fall into two categories: second-order methods (which compute inverse Hessian-vector products) and first-order methods (like TracIn, which track gradients across training checkpoints). However, as models grow larger and more complex, first-order gradient approximations become increasingly inaccurate, and computing high-dimensional gradients or Hessians becomes prohibitively expensive in terms of compute and memory.

Methods

The authors propose Z0-Inf, a zeroth-order approximation that completely bypasses gradient and Hessian computations:

  1. Finite Difference Directional Gradient ($Z_{inf}$): Instead of calculating exact gradients, Z0-Inf fits a vector to approximate the finite difference in losses between successive checkpoints ($\theta_i$ and $\theta_{i+1}$). This is formulated as a least-squares linear regression problem with a closed-form solution, requiring only scalar loss values and checkpoint weight differences. To make it robust, they average this across closely related checkpoints within a certain distance threshold.
  2. Variance-Based Self-Influence ($ZS_{inf}$): For the special case of self-influence (how a point affects its own prediction), the authors mathematically prove that self-influence is upper-bounded by a constant multiplied by the empirical variance of the losses across checkpoints. This means self-influence can be estimated purely by calculating the variance of scalar loss values over time, completely avoiding high-dimensional weight vector operations.
  3. Optimizations: They utilize dot-product expansion rules to pre-compute the Gram matrix of checkpoint weights once, significantly accelerating train-test influence calculations.

Datasets

The paper evaluates the method on both vision and language models to demonstrate scalability:

  • Vision: MNIST, CIFAR-10
  • Language (LLM Fine-tuning): GSM8K (math reasoning), MATH-500 (advanced math), Dolly (instruction following)
  • Synthetic: A linearly separable 2-class classification dataset (20k examples, 5k features)

Key Insights and Ideas

  • The Gradient Approximation Breakdown: A core assumption of first-order methods like TracIn is that gradients provide a good linear approximation of loss changes between checkpoints. The authors show that this assumption breaks down drastically as models grow larger and more complex.
Spearman correlation of gradient approximation accuracy vs. model size
  • Self-Influence as a Scalar Problem: By leveraging the Cauchy-Schwarz inequality, the authors show that self-influence reduces to the empirical variance of a training point's loss across checkpoints. This turns a massive high-dimensional problem into a trivial scalar calculation.
  • Semantic Alignment with True Influence: Traditional gradient-based methods measure influence based on gradient similarity (which heavily weights input feature resemblance). Zeroth-order methods rely purely on loss changes, aligning them much better semantically with the true "remove-and-retrain" baseline (SubSample-and-Retrain, or SSRT), which measures the total effect of sample elimination.

Key Results

  • Accuracy vs. Runtime Tradeoff: Z0-Inf drastically outperforms state-of-the-art methods like LoGra and TracIn for fine-tuned LLMs. For example, on datasets like GSM8K, MATH-500, and Dolly, Z0-Inf achieves significantly higher Spearman correlation with the SSRT baseline while being substantially faster.
Accuracy vs. runtime tradeoff for self-influence
  • Top-K Influential Data Overlap: LLMs show a much higher overlap (intersection percentage) of top-K influential examples with the true SSRT baseline when using Z0-Inf compared to first- or second-order methods.
Common subset of top-k influential examples between SSRT and approximation methods
  • Efficiency: Around 80-90% of Z0-Inf's runtime is spent simply computing losses, which can be precomputed offline once and reused across any test set evaluation.

Limitations and Future Work

  • Train-Test Influence Noise: While Z0-Inf excels at self-influence, the correlation with the true baseline is lower and noisier for train-test influence across all methods. This is due to complex sample-level interactions where many training examples have unremarkable individual impacts on a specific test point.
  • Future Directions: The authors suggest extending this zeroth-order framework to group influence (measuring the impact of groups of similar training examples together) to alleviate the confounding effects and noise found in pairwise train-test influence. They also plan to evaluate Z0-Inf directly on downstream tasks like data pruning and safety auditing.

Summary updated

BibTeX
@inproceedings{kokhlikyan2026z,
  author = {Narine Kokhlikyan and Kamalika Chaudhuri and Saeed Mahloujifar},
  title = {{Z0-Inf: Zeroth Order Approximation for Data Influence}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=2iqx5fDrTU},
}
Figure