Source-linked AI summary

DataInf: Efficiently Estimating Data Influence in LoRA-tuned LLMs and Diffusion Models

Yongchan Kwon, Eric Wu, Kevin Wu, James Zou

arXiv:2310.00902v3cs.LGstat.ML

TL;DR

Influence functions quantify training-point impact, but their computational cost makes them challenging to apply to large language and text-to-image models. DataInf approximates influence using an easy-to-compute closed-form expression and is designed to suit parameter-efficient fine-tuning. DataInf better approximates exact influence than Hessian-free and LiSSA in correlation, and on GLUE-QQP computed 4,500 influence function values in 13 seconds versus 70 for LiSSA and 11,279 for Exact.

  • Problem

    Influence functions quantify training-point impact, but their computational cost makes them challenging to apply to large language and text-to-image models.

    Source: §1 · p. 1
  • Method

    DataInf approximates influence using an easy-to-compute closed-form expression and is designed to suit parameter-efficient fine-tuning.

    Source: §1 · pp. 1–2
  • Results

    DataInf better approximates exact influence than Hessian-free and LiSSA in correlation, and on GLUE-QQP computed 4,500 influence function values in 13 seconds versus 70 for LiSSA and 11,279 for Exact.

    Source: §4.1 · p. 6, §4.2 · p. 7
  • Takeaways & Limitations

    DataInf can support data-centric analysis of large models by identifying influential examples and helping detect mislabeled points.

    Source: §6 · p. 9

    Quantitative metrics for influence-score utility are scarce, so the evaluation uses proxies such as same-class influence and mislabeled-point effects on test loss.

    Source: §6 · p. 9

Abstract

from arXiv · show

Quantifying the impact of training data points is crucial for understanding the outputs of machine learning models and for improving the transparency of the AI pipeline. The influence function is a principled and popular data attribution method, but its computational cost often makes it challenging to use. This issue becomes more pronounced in the setting of large language models and text-to-image models. In this work, we propose DataInf, an efficient influence approximation method that is practical for large-scale generative AI models. Leveraging an easy-to-compute closed-form expression, DataInf outperforms existing influence computation algorithms in terms of computational and memory efficiency. Our theoretical analysis shows that DataInf is particularly well-suited for parameter-efficient fine-tuning techniques such as LoRA. Through systematic empirical evaluations, we show that DataInf accurately approximates influence scores and is orders of magnitude faster than existing methods. In applications to RoBERTa-large, Llama-2-13B-chat, and stable-diffusion-v1.5 models, DataInf effectively identifies the most influential fine-tuning examples better than other approximate influence scores. Moreover, it can help to identify which data points are mislabeled.

1 INTRODUCTION

Influence functions can quantify how individual training examples affect predictions, but their computational costs make them difficult to apply to large language and diffusion models. DataInf proposes a closed-form approximation and reports improved efficiency and data identification.

Motivation

  • Influence functions quantify the impact of individual training points, with applications including mislabeled-data detection, subset selection, interpretation, and bias investigation.The motivation is that model errors and biased outputs often arise from training-data issues.Source: §1 · p. 1
  • Computing influence functions is challenging at scale because inverse-Hessian calculations are expensive and existing approaches often require iterations, eigenvalue decompositions, or many model trainings.These costs have made influence computation difficult for large language and diffusion models.Source: §1 · p. 1

Our contributions

  • DataInf uses an easy-to-compute closed-form expression to improve the computational and memory efficiency of influence estimation.The paper reports that it is faster and more effective than existing algorithms at retrieving the most or least influential training points.Source: §1 · pp. 1–2

2 PRELIMINARIES

The preliminaries define the empirical-risk setting and explain influence as the effect of up-weighting a training example on parameter estimates and validation loss. They then describe computational obstacles and existing approximations for deep networks.

2 PRELIMINARIES

  • The paper formulates empirical risk minimization over a training set of input-label pairs, with each point’s loss differentiated with respect to model parameters.The input and label spaces are denoted X and Y.Source: §2 · p. 2

2.1 INFLUENCE FUNCTION

  • The influence function measures how an up-weighted training point changes parameter estimates and extends to its effect on validation loss.A positive value corresponds to increasing validation loss, while a negative value corresponds to decreasing it.Source: §2.1 · p. 2
  • Under negative log-likelihood, Bartlett’s second identity allows the Hessian to be replaced by a second moment of first-order gradients.The paper focuses on negative log-likelihood to obtain this simplified Hessian form.Source: §2.1 · pp. 2–3

2.2 INFLUENCE FUNCTION FOR DEEP NEURAL NETWORK MODELS

  • For deep networks, the gradient second-moment matrix may be non-invertible when the parameter dimension exceeds the sample size, and may be too large to compute.Its rank is at most the sample size.Source: §2.2 · p. 3
  • A common deep-network approximation adds positive diagonal damping and replaces the gradient second-moment matrix with layer-wise diagonal blocks.This stabilizes and simplifies the Hessian computation, but remains costly when a layer dimension is large.Source: §2.2 · p. 3
  • Existing influence methods can require iterations, eigenvalue decompositions, or many model trainings, limiting their feasibility for large models.Accelerated LiSSA can match the proposed method’s stated big-O complexities, while DataInf avoids an expensive iterative algorithm.Source: §2.2 · pp. 3–4

3 DATAINF: EFFICIENT INFLUENCE COMPUTATION

DataInf approximates influence scores with a closed-form expression that swaps the order of matrix inversion and averaging. Its layerwise computation avoids iterative operations and reduces computational and memory costs relative to existing methods.

3 DATAINF: EFFICIENT INFLUENCE COMPUTATION

  • DataInf swaps matrix inversion and averaging to obtain a closed-form approximation of the inverse-Hessian component of influence.The authors use the Sherman–Morrison formula to simplify the resulting expression.Source: §3 · p. 4
  • Equation 5 gives an easy-to-compute expression for each DataInf influence score.The expression combines terms across layers and training examples.Source: §3 · p. 4
  • DataInf avoids iterative operations and Hessian-matrix storage, with better computational and memory complexity than LiSSA.The stated operation and memory bounds are O(P∑_{l=1}^L nd_l) and O(max_{l∈[L]} d_l), respectively.Source: §3 · p. 4

2. Here, we denote the spectral norm of a ma-

The analysis bounds the spectral norm associated with the approximation under bounded-gradient and damping conditions. It also identifies smaller layer dimensions, including those in LoRA fine-tuning, as a setting where approximation error is more tolerable.

2. Here, we denote the spectral norm of a ma-

  • For equal-width multilayer perceptrons, Table 1 reports better computational and memory efficiency for DataInf than Exact and LiSSA.The comparison is scoped to models whose layers have the same number of neurons.Source: Table 1 · p. 5
  • The spectral-norm bound scales as O(d_l^2) when first-order gradients and λ_l are bounded.The theorem bounds the spectral norm of the difference involved in the approximation.Source: §2 · pp. 4–5
  • DataInf is particularly well-suited to LoRA fine-tuning because its approximation error becomes more tolerable as layer dimension d_l decreases.The authors note that the total error bound may be pessimistic.Source: §2 · p. 5

4 EXPERIMENTS

The experiments compare DataInf with Hessian-free, LiSSA, and exact influence calculations across approximation, mislabeled-data detection, and influential-data identification tasks. Across these settings, DataInf generally gives stronger influence estimates or identification results while reducing computation time.

4 EXPERIMENTS

  • The evaluation covers RoBERTa with LoRA for approximation and mislabeled-data experiments, and Llama-2-13B-chat and stable-diffusion-v1.5 for influential-data identification.The identification experiments include text and text-to-image tasks; datasets include synthetic label noise and demonstrations spanning sentence, math, style, and subject generation.Source: §4 · p. 5, §4.3 · p. 7

4.1 APPROXIMATION ERROR ANALYSIS

  • DataInf is significantly more correlated with exact influence values than Hessian-free and LiSSA at LoRA ranks 1, 2, and 4.For GLUE-MRPC at rank 1, correlations are 0.64 for DataInf, 0.50 for Hessian-free, and 0.45 for LiSSA; DataInf's correlation generally decreases as rank increases.Source: Figure 1 · p. 6, §4.1 · p. 6

4.2 MISLABELED DATA DETECTION

  • On GLUE-QQP, DataInf takes 13 seconds, versus 70 seconds for LiSSA and 11279 seconds for Exact to compute 4500 influence values.Across four datasets, DataInf averages 5.5 times faster than LiSSA and 1149.6 times faster than Exact; its detection ability is better than or comparable to Exact and significantly exceeds Hessian-free and LiSSA.Source: §4.2 · pp. 6–7, Figure 2 · p. 7

4.3 INFLUENTIAL DATA IDENTIFICATION

  • Class detection AUC compares negative influence values with same-class pseudo-labels, while recall measures the same-class share among the s smallest-influence training points.Both metrics assess whether same-class training examples are identified as more helpful than different-class examples.Source: §4.3 · pp. 7–8
  • DataInf significantly outperforms Hessian-free in AUC and recall across five influential-data tasks; LiSSA is excluded because it often fails to converge.The results also report LiSSA instability and invalid influence values in some runs.Source: Table 2 · p. 8, §4.3 · p. 8

5 RELATED WORKS

Related work includes marginal-contribution data valuation, gradient-based influence functions, and alternative data-contribution approaches. The paper situates DataInf against methods whose computational demands or model scale constrain their use with LLMs and diffusion models.

5 RELATED WORKS

  • Marginal-contribution methods include leave-one-out and Shapley-based approaches [Ghorbani & Zou, 2019; Jia et al., 2019; Kwon & Zou, 2022; Wang & Jia, 2023; Wang et al., 2023], alongside reinforcement-learning and out-of-bag methods [Yoon et al., 2020; Kwon & Zou, 2023].Influence functions instead use gradients to represent data values; Jiang et al. (2023) is cited for a broader review.Source: §5 · p. 8
  • Many data-contribution methods often outperform influence functions on downstream tasks, while methods requiring numerous model trainings are impractical for LLMs and diffusion models [Park et al., 2023; Jiang et al., 2023; Feldman & Zhang, 2020].Initialization-based methods avoid training but have mostly been examined on relatively small neural networks.Source: §5 · p. 8
  • EK-FAC was proposed as an efficient influence algorithm for LLMs, but its architecture dependence complicates application to LoRA-tuned models, and its implementation is not public [Grosse et al., 2023].Figure 3 illustrates DataInf-selected high- and low-influence examples for Llama-2-13B-chat and stable-diffusion-v1.5; the most influential examples are more relevant to test prompts.Source: §5 · p. 9, Figure 3 · p. 9

6 CONCLUSION

The conclusion presents DataInf as an efficient influence-computation algorithm suited to parameter-efficient fine-tuning and large language and diffusion models. The appendix algorithm takes training and validation data and produces influence values, while the authors note limits in quantitative evaluation of influence utility.

6 CONCLUSION

  • DataInf is designed for parameter-efficient fine-tuning and deployment to large language models and diffusion models.The authors report orders-of-magnitude speedups over state-of-the-art influence methods and memory efficiency, with practical potential for data-centric analysis of large models.Source: §6 · p. 9
  • The authors identify scarce quantitative metrics for influence-score utility as a limitation and use same-class influence and mislabeled-point loss as proxies.Further downstream evaluation of influence-score utility for generative AI is left as future work.Source: §6 · p. 9

A PROPOSED ALGORITHM

  • Algorithm 1 takes training and validation datasets, an objective, and a deep neural network, and outputs DataInf influence values for training points.Its listed stages compute first-order gradients, an inverse Hessian-vector product, and influence functions.Source: A PROPOSED ALGORITHM · p. 14

B PROOF OF THEOREM 1

The proof uses matrix inequalities and a bound on the trace of positive semidefinite matrices in its approximation-error argument. It also identifies a Taylor expansion as a result presented in Bach (2022).

B PROOF OF THEOREM 1

  • The proof's Taylor expansion is attributed to Bach (2022).Source: B PROOF OF THEOREM 1 · p. 14
  • The proof bounds the spectral norm using the triangle inequality and the largest-eigenvalue inequality for real symmetric matrices.The passage defines λmax(A) as a matrix's largest eigenvalue.Source: B PROOF OF THEOREM 1 · p. 15
  • For positive semidefinite S_li, the proof uses ||S_li||_2 = λmax(S_li) ≤ tr(S_li) and a trace bound proportional to d_l.The passage states that tr(S_li) + tr(...) ≤ M d_l for some constant M > 0.Source: B PROOF OF THEOREM 1 · p. 15

C EXISTING METHODS

This section describes EK-FAC/KFAC and retraining-based influence methods, including their computational trade-offs and limits for LoRA or transformer models. It also points to implementation details for datasets, models, and losses.

C EXISTING METHODS

  • EK-FAC uses a layerwise Kronecker factorization to approximate the Hessian, with smaller factor matrices enabling more efficient inversion than naive matrix inversion.KFAC approximates the layer Hessian using eigenvalue decompositions of its factors; EK-FAC improves the diagonal approximation.Source: C EXISTING METHODS · pp. 15–16
  • EK-FAC can be faster than naive LiSSA, but its required gradient factorization may not hold for LoRA-fine-tuned or transformer models.The method is architecture-dependent and is described for multilayer perceptrons.Source: C EXISTING METHODS · p. 16
  • Retraining-based influence measures a data point’s effect through differences in model outputs, but requires training numerous models.The method is flexible about the model used for fθ.Source: C EXISTING METHODS · p. 16

D IMPLEMENTATION DETAILS

  • The implementation-details section covers datasets, models, and loss functions, and provides Python implementation code.The code is available at the paper’s linked repository.Source: D IMPLEMENTATION DETAILS · p. 16

D.1 APPROXIMATION ERROR ANALYSIS AND MISLABELED DATA DETECTION

The supplied passages describe the datasets, LoRA model configurations, and losses for RoBERTa classification, Llama text generation, and stable-diffusion image generation. They also report text-generation accuracy improvements and explain the image-generation evaluation setup.

D.1 APPROXIMATION ERROR ANALYSIS AND MISLABELED DATA DETECTION

  • For GLUE approximation and detection experiments, RoBERTa-large is LoRA-tuned on binary classification datasets, with training examples evaluated against validation loss.The setup uses ranks 1, 2, 4, or 8 and a negative log-likelihood loss.Source: §D.1 · pp. 16–17
  • At r=8, the Exact method takes more than 18 hours on GLUE-MRPC using one NVIDIA A40 GPU, so that setting is excluded from its evaluation.The authors note that smaller LoRA ranks can yield similar model performance to r=8.Source: §D.1 · p. 17

D.2.1 TEXT GENERATION

  • Across three Llama-2-13B-chat text-generation tasks, fine-tuning substantially improves test accuracy, with further gains from adding an intermediate reasoning step to math problems.The setup uses LoRA and negative log-likelihood of the generated response as its loss.Source: §D.2.1 · p. 17

D.2.2 TEXT-TO-IMAGE GENERATION - STYLE GENERATION

  • For style generation, prompts add a style description, and image-generation performance is evaluated by comparing test-set FID before and after LoRA fine-tuning.The styles include cartoon, pixel art, and black-and-white line sketch.Source: §D.2.2 · pp. 17–18

D.2.3 TEXT-TO-IMAGE GENERATION - SUBJECT GENERATION

  • Subject generation uses DreamBooth’s 31 subjects, with three examples per subject for training and the remaining examples for validation.Unique random strings distinguish subjects in the prompts; this task uses LoRA rank 4.Source: §D.2.3 · p. 18

E ADDITIONAL EXPERIMENTAL RESULTS

Additional experiments report that DataInf’s correlation advantage over Hessian-free and LiSSA holds on clean and noisy data. It also shows competitive mislabeled-data detection at low runtime across additional LoRA ranks.

Approximation error analysis

  • On clean data, DataInf is more correlated with exact influence than Hessian-free and LiSSA across datasets and ranks, consistent with the noisy-data finding.Figure 5 compares the three methods under settings matching Figure 1 except for the presence of noisy data.Source: E ADDITIONAL EXPERIMENTAL RESULTS · pp. 18–19, Figure 5 · p. 21

Mislabeled data detection task

  • For r∈{1, 2, 8}, DataInf shows competitive mislabeled-data detection with short runtime; at r=8 it takes under 25 seconds while Exact exceeds the 12-hour limit.Figure 6 presents results for ranks 1, 2, and 8, with 95% confidence intervals from 20 runs.Source: E ADDITIONAL EXPERIMENTAL RESULTS · p. 19, Figure 6 · p. 21

F DATA SELECTION TASK

In data selection experiments, DataInf’s selected subset generally yields stronger accuracy than influence-method baselines and often Full, with an early-epoch advantage. The selection procedure uses the top 70% most beneficial points and evaluates retraining on a holdout set.

F DATA SELECTION TASK

  • The experiment selects the top 70% most beneficial points, retrains from scratch on that subset, and measures accuracy on the holdout test set.Comparators include Hessian-free, LiSSA, random selection, and the full dataset.Source: F DATA SELECTION TASK · p. 22
  • DataInf usually achieves its best accuracy in the first one to three epochs, and the selected subset is described as representative and easier to learn.The authors say this selection helps accelerate model training.Source: F DATA SELECTION TASK · p. 22
  • DataInf significantly outperforms Hessian-free and LiSSA on all four datasets, and beats Full except on MRPC.Figure 7 reports classification accuracy; the authors attribute the advantage over Full to detecting low-quality points, with 20% of the original datasets mislabeled.Source: Figure 7 · p. 22, F DATA SELECTION TASK · p. 22
Loading 2310.00902v3…