Source-linked AI summary

FastIF: Scalable Influence Functions for Efficient Model Interpretation and Debugging

Han Guo, Nazneen Fatema Rajani, Peter Hase, Mohit Bansal, Caiming Xiong

arXiv:2012.15781v2cs.LGcs.AIcs.CL

TL;DR

Influence functions are useful for interpreting and debugging model behavior, but their computational cost scales poorly with model and training-set size. FastIF combines kNN candidate selection, faster inverse-Hessian estimation, and parallelization, achieving over 80× speedup while supporting applications in explanation, visualization, and error correction.

  • Problem

    Influence functions can identify how training data-points affect test predictions, but their computational cost does not scale well with model and training data size.

  • Method

    FastIF uses kNN to pre-select influential candidates, optimized inverse-Hessian-vector-product estimation, and a parallel implementation to accelerate influence computation.

  • Results

    More than 80× faster computation enables applications including simulatability analysis, influence-interaction visualization, and correcting model predictions with influential data-points.

  • Takeaways & Limitations

    FastIF makes influence functions practical for large models and datasets and demonstrates their potential for model interpretation and correcting model errors.

  • Takeaways & Limitations

    Applying FastIF to large-scale datasets and models may remain restricted to users with adequate computing power because the operations are still expensive.

Abstract

from arXiv · show

Influence functions approximate the "influences" of training data-points for test predictions and have a wide variety of applications. Despite the popularity, their computational cost does not scale well with model and training data size. We present FastIF, a set of simple modifications to influence functions that significantly improves their run-time. We use k-Nearest Neighbors (kNN) to narrow the search space down to a subset of good candidate data points, identify the configurations that best balance the speed-quality trade-off in estimating the inverse Hessian-vector product, and introduce a fast parallel variant. Our proposed method achieves about 80X speedup while being highly correlated with the original influence values. With the availability of the fast influence functions, we demonstrate their usefulness in four applications. First, we examine whether influential data-points can "explain" test time behavior using the framework of simulatability. Second, we visualize the influence interactions between training and test data-points. Third, we show that we can correct model errors by additional fine-tuning on certain influential data-points, improving the accuracy of a trained MultiNLI model by 2.5% on the HANS dataset. Finally, we experiment with a similar setup but fine-tuning on datapoints not seen during training, improving the model accuracy by 2.8% and 1.7% on HANS and ANLI datasets respectively. Overall, our fast influence functions can be efficiently applied to large models and datasets, and our experiments demonstrate the potential of influence functions in model interpretation and correcting model errors. Code is available at https://github.com/salesforce/fast-influence-functions

1 Introduction

FASTIF addresses the poor scalability of influence functions by reducing candidate searches, accelerating inverse-Hessian estimation, and parallelizing computation. These changes support faster analysis and applications including simulatability, influence visualization, and model error correction.

  • Influence functions avoid repeated retraining but remain expensive, taking more than 2 hours for one evaluation example in a moderate 14.7M-parameter, 390K-example setting.The main bottlenecks are enumerating the training set, estimating the inverse Hessian, and serial computation.
  • FASTIF combines kNN candidate selection, faster inverse-Hessian estimation, and parallel computation to improve influence-function runtime by approximately two orders of magnitude.The three modifications reduce the search space, cut inverse-HVP computation time, and add parallel speedup.
  • The paper applies fast influence functions to simulatability, training-test influence visualization, and correcting model predictions through fine-tuning.The introduction also reports improvements on HANS and ANLI datasets from fine-tuning influential examples.

2 Related Work

Prior work studies model explanations and influence-based diagnostics, including applications to NLP predictions, data quality, training history, and error correction. FASTIF differs by targeting influence-function runtime at inference time without changing model training.

  • Prior explainable-machine-learning methods interpret inputs, representations, predictions, or decision boundaries using feature, attention, gradient, perturbation, prototype, and related approaches.
  • Influence functions have been used for data poisoning, prediction trust, embedding-bias tracing, important training groups, and NLP model analysis.
  • FASTIF differs from prior NLP approaches by accelerating individual influence computations and reducing their number through inference-time changes that require no model-training modification.

3 FASTIF: Method Details

FastIF makes influence-function computation more scalable by narrowing the candidate search with kNN, accelerating inverse-Hessian estimation, and parallelizing computations.

  • 3.1 Background: Influence functions estimate how up-weighting a training point changes loss on a test point, avoiding the need to retrain another model.The method computes a tractable approximation using the trained model parameters and Hessian information.
  • 3 FASTIF: Method Details: FastIF combines kNN candidate selection, faster inverse-Hessian estimation, and parallel computation to address influence-function scalability.These modifications target dataset-wide search, inverse-Hessian computation, and serial execution.
  • 3.2 Speeding up the arg max using kNN: kNN restricts the arg max search to the top-k nearest training examples, reducing computation while targeting likely influential points.Nearest neighbors are selected using ℓ2 distance between extracted final representations and searched efficiently with FAISS.
  • 3.3 Speeding up the Inverse Hessian: Inverse-Hessian estimation uses implicit Hessian-vector products, stochastic mini-batches, and Neumann-series iterations instead of explicitly inverting the Hessian.The recursive estimator repeats independent runs and averages their inverse-Hessian-vector estimates.
  • 3.3 Speeding up the Inverse Hessian: Parallel execution computes inverse-Hessian estimates asynchronously, averages them with all-reduce, and then computes influences for the kNN-selected subset.Multiple repetitions provide the parallel-computation opportunity.

4 Experimental Setup

Experiments use MultiNLI for analysis and several datasets for downstream applications, with a partially frozen pretrained BERTbase model to reduce computation.

  • 4 Experimental Setup: Experiments use MultiNLI for analysis and MultiNLI, HANS, ANLI, and Amazon-WILDS for applications.The datasets cover both influence-analysis experiments and downstream applications.
  • 4 Experimental Setup: The model is a pretrained BERTbase fine-tuned on downstream tasks with its first 9 layers frozen, leaving about 14.7M trainable parameters.Weight decay is set to 0.005 during training.
  • 4 Experimental Setup: When a MultiNLI model is used for both MultiNLI and HANS, it is trained on the 2-label variant of MultiNLI.The setup refers readers to the cited MultiNLI work for additional dataset details.

5 Experimental Results and Analysis

Experiments show that FastIF’s kNN search and Hessian approximations substantially reduce computation while retaining useful recall, estimation quality, and influence rankings.

  • 5.1 Summary of Computation Times: An 80× speedup reduces influence computation to about 1.5 minutes with k=1e3, fast stest approximation, and 4 GPUs, versus more than 2 hours for the original method.kNN reduces time by about an order of magnitude, fast stest adds a 55–70% reduction, and parallelism cuts time by more than twofold.
  • 5.2 Recall of kNN: Recall reaches about 60% for k=5×10^4 and 20% for k=5×10^3, both far above random selection despite using much smaller subsets than the full dataset.The full training set contains more than 3.9×10^5 examples, while random selection yields recall around 15% and 1.5% in the two settings.
  • 5.3 Inverse HVP Approximation: Smaller Hessian-approximation batches and moderate J trade a small quality loss for substantial speedups, while larger T can recover quality and is parallelizable.Computation grows with batch size and J, whereas estimation error generally decreases; the recommended combination is small B, medium J, and large T.
  • 5.4 Quality of Influence Estimations: Fast influence functions achieve over 95% correlation with full influence functions across the measures considered.The comparison evaluates influence values from the fast configuration against the full method.
  • 5.4 Quality of Influence Estimations: Retraining after removing helpful points increases loss, removing harmful points decreases loss, and FastIF performs similarly to full influence functions while generally outperforming random selection.The effect becomes larger as more points are removed, although individual points have limited generalization impact in large training sets.

6 Applications of FASTIF

FASTIF is applied to explain model behavior, visualize training–evaluation interactions, and correct errors through targeted fine-tuning or data augmentation.

  • 6.1 Explainability of Influential Examples: Influential examples improve simulator predictions of task-model behavior beyond random selection, supporting their use as explanations.Helpful points help when task predictions are correct, while harmful points help when predictions are incorrect.
  • 6.2 Effect Visualization: Influence visualizations reveal that a few highly helpful MultiNLI points can matter more for HANS than many weaker harmful points.Influence correlations also suggest that influential points tend to affect multiple data slices similarly.
  • 6.2 Effect Visualization: HANS training points from the Lexical Overlap subset are noticeably more influential across HANS evaluation subsets, exposing latent dataset structure.The visualization includes training points as inner nodes, evaluation points as outer nodes, and edge strength and color as influence values.
  • 6.3 Error Correction: Helpful MultiNLI points improve HANS accuracy by more than 5.8% through repeated fine-tuning, while harmful points worsen performance.Influence-based fine-tuning improves average accuracy by about 2.5% beyond directly fine-tuning on anchor points.
  • 6.3 Error Correction: Influence-guided augmentation improves average accuracy on HANS and ANLI by more than 5.9% and 2.7%, respectively, exceeding direct anchor use by about 2.8% and 1.7%.The augmented data come from datasets unseen during the model’s original training.
  • 6.3 Error Correction: The usefulness of influence-guided correction depends on selecting anchor points that adequately represent the evaluation dataset.On Amazon-WILDS, selected anchors and direct anchor fine-tuning had little impact, while harmful-point fine-tuning deteriorated performance.

7 Conclusions

FASTIF accelerates influence-function computation through simple modifications while preserving performance, enabling applications in interpretation and model debugging.

  • 7 Conclusions: FASTIF combines kNN candidate preselection, inverse-HVP hyperparameter tuning, and parallelization to reduce influence-function computation without significant performance loss.The method supports applications including explainability, influence visualization, and prediction correction with original or new data.

8 Ethical Considerations

The paper discusses ethical uses of FASTIF for detecting memorization vulnerabilities while noting that substantial computational resources may still be required.

  • 8 Ethical Considerations: FASTIF may help detect training-data memorization vulnerabilities, but its remaining computational cost can restrict use on large models and datasets to adequately resourced users.The authors distinguish this defensive use from exploiting memorized sensitive information.

A Summary of Key Experiment Details

The appendix points readers to Table 3 for key experiment details.

  • A Summary of Key Experiment Details: Table 3 contains the paper’s key experiment details.

B Experimental Results and Analysis

The experiments evaluate kNN as a preselection method for influential data-points, focusing on recall against full-dataset influence rankings. kNN retrieves influential candidates while reducing the search space substantially.

  • B.1 Recall of kNN: The experiment measures whether kNN retrieves potentially influential points before expensive influence-function reranking.The selected subset must contain the most influential candidates for this preselection strategy to work.
  • B.1 Recall of kNN: kNN recall is defined as the percentage of top-m ground-truth influential data-points included in its retrieved subset.Ground truth uses the top-m influence-ranked points computed without kNN on the full dataset.
  • B.1 Recall of kNN: The evaluation selects k training points with kNN and computes R@m for m∈{10^1,10^2,10^3} across positive, negative, and absolute influence rankings.Ground-truth rankings are computed on MultiNLI without kNN, then compared with the retrieved subsets.
  • B.1 Recall of kNN: Nearly 60% recall for the most influential data-points is achieved with k=5×10^4, versus about 20% with k=5×10^3.These candidate sets are roughly an order of magnitude smaller than the more-than-3.9×10^5-example training dataset.

B.2 Inverse-Hessian-Vector-Product Approximation Speed-Quality Trade-Off

Fast influence estimation combines kNN preselection with faster inverse-Hessian-vector-product approximation and parallel computation. The resulting influence values closely match full computations while supporting retraining-based quality checks.

  • B.2 Inverse-Hessian-Vector-Product Approximation Speed-Quality Trade-Off: The inverse-Hessian approximation becomes more expensive as batch size and recursive iterations J increase, while its estimation error generally decreases.The error is measured relative to the most expensive configuration.
  • B.2 Inverse-Hessian-Vector-Product Approximation Speed-Quality Trade-Off: A small batch size, medium J, and large T provide a speed-quality trade-off with significant speed-up and only a small quality drop.Increasing batch size or recursive iterations raises computational cost while generally reducing estimation error; larger T can recover quality when B is small.
  • Experimental setup: The experiments assess kNN recall, inverse-Hessian speed-quality trade-offs, and correlations between influence values computed with and without the proposed techniques.These tests evaluate both individual components and their combined effect.
  • B.3 Quality of Influence Estimations: The quality evaluation compares Fast influence functions using kNN and fast approximation against Full influence functions without those modifications.Retraining tests also include random data-point selection as a baseline.
  • B.3 Quality of Influence Estimations: >95% correlations with full influence functions are achieved, while fast and full methods similarly outperform random selection in retraining tests.Removing helpful points increases evaluation loss, whereas removing harmful points decreases it.

C.3 Error Correction

The error-correction procedure repeatedly selects influential training examples using validation anchors and fine-tunes the model on them. Fine-tuning is used as a cheaper approximation to retraining with influential-example loss upweighted.

  • C.3 Error Correction: The correction loop evaluates a test slice, selects validation anchors, finds influential training points, fine-tunes on them, and repeats before reevaluating performance.The procedure repeats the anchor-selection and update steps multiple times.
  • C.3 Error Correction: Fine-tuning is motivated as a less expensive alternative to retraining the model with influential examples added to its training data.The paper contrasts this approach with the intuitive but expensive option of retraining.
  • C.3 Error Correction: Fine-tuning on influential examples approximates retraining with their loss upweighted, while avoiding the expense of recomputing a Hessian inverse for every update.Using a scalar learning rate reduces the procedure to vanilla fine-tuning in practice.
  • C.3 Error Correction: Experiments compare fine-tuning on helpful, harmful, random, and directly available anchor data-points across HANS and Amazon-WILDS settings.HANS evaluation uses its three dataset slices, while Amazon-WILDS uses out-of-distribution validation and test splits.
  • C.3 Error Correction: Each iteration samples validation anchors and updates the model with one gradient step on selected fine-tuning data-points.The reported setup uses 10 iterations, batches of 10 anchors and fine-tuning points, and learning rate 10^-4; Amazon-WILDS uses 50 anchors.
Loading 2012.15781v2…