# If influence functions are not approximating leave-one-out, how are they supposed to help?

*Thanks to Roger Grosse for helping me understand his intuitions and hopes for influence functions. This post combines highlights from some influence function papers, some of Roger Grosse’s intuitions (though he doesn’t agree with everything I’m writing here), and some takes of mine.*

Influence functions are informally about some notion of influence of a training data point on the model’s weights. But in practice, for neural networks, “influence functions” do not approximate well “what would happen if a training data point was removed”. Then, what are influence functions about, and what can they be used for?

From leave-one-out to influence functions
=========================================

*Ideas from *[*Bae 2022*](https://arxiv.org/abs/2209.05364) *(If influence functions are the answer, what is the question?).*

The leave-one-out function is the answer to “what would happen, in a network trained to its global minima, if one point was omitted”: $LOO(\hat x,\hat y) = \text{argmin}_\theta \frac 1 N\sum_{(x,y)\sim D-\{(\hat x,\hat y)\}}L(f_\theta(x),y)$

Under some assumptions such as a strongly convex loss landscape, influence functions are cheap-to-compute approximation to leave-one-out function, thanks to the Implicit Function Theorem, which tells us that under those assumptions $LOO(\hat x,\hat y) \approx IF(\hat x,\hat y) \stackrel{\text{def}}{=} \theta^* + (\nabla^2_\theta J(\theta^*))^{−1}\nabla_\theta L(f(\theta^*, \hat x), \hat y) / N$

But these assumptions don't hold for neural networks, and [Basu 2020](https://arxiv.org/abs/2006.14651) shows that **influence functions are a terrible approximation of leave-one-out** in the context of neural networks, as shown in this figure from [Bae 2022](https://arxiv.org/abs/2209.05364) (left is for Linear Regression, where the approximation hold, right is for MultiLayer-Perceptron, where it doesn’t):

![](https://lh5.googleusercontent.com/erUllhvPmb7q_ebh7-qOxeRL4u8GKSm93OMyqLtZdDZprrG4nPxddjMrNxKtkY5nLDADVNCppmg-w6b5qKIzYBqLbjvfOr2jIarL5k6sxVp1tNl-UT-L0xyyvWEUmOKX9_DQDs722iE9mwFvfUuV1z8)

Moreover, even the leave-one-out function is about parameters at convergence, which is not the regime most deep learning training runs operate in. Therefore, influence functions are even less about answering the question “what would happen if this point had more/less weight in the (incomplete) training run?”.

So every time you see someone introducing influence functions as an approximation of the effect of up/down-weighting training data points (as in [this LW post about interpretability](https://www.lesswrong.com/posts/GEPX7jgLMB8vR2qaK/opinions-on-interpretable-machine-learning-and-70-summaries)), remember that this does not apply when they are applied to neural networks.

What are influence functions doing
==================================

[Bae 2022](https://arxiv.org/abs/2209.05364) shows that influence functions (not leave-one-out!) can be well approximated by the minimization of another training objective called PBRF, which is the sum of 3 terms:

*   $E_{x \sim D}[L(f_\theta(x), f_{\theta_t}(x))]$, The loss function with the soft labels as computed by the studied function with weights after training $\theta_t$: the new $\theta$ should not change the output of the function much.
*   $- \frac 1 NL(f_\theta(\hat x), \hat y)$, The opposite of the loss function on the target point: the new $\theta$ should give a high loss on the considered data point
*   $\lambda || \theta - \theta_t||^2$, A penalization of weights very different from the final training weights (Roger told me the specific value of $\lambda$ didn’t have a huge influence on the result.)

This does not answer the often advertised question about leave-one-out, but this does answer something which looks related, and which happens to be much cheaper to compute than the leave-one-out function (which can only be computed by retraining the network and doesn’t have cheaper approximations).

Influence functions are currently among the few options to say anything about the intuitive “influence” of individual data points in large neural networks, which justifies why they are used. (Alternatives have roughly the same kind of challenges as influence functions.)

*Note: this explanation of what influence function are doing is not the only way to describe their behavior, and other works may shine new lights on what they are doing.*

What are influence functions useful for
=======================================

Current empirical evidence
--------------------------

To this date, there has been almost no work externally validating that influence functions tell us anything about the influence of data points on neural networks behaviors beyond:

*   “It looks reasonable” when running it on individual examples of influence function approximations results [on large language models](https://arxiv.org/pdf/2308.03296.pdf)
*   Influence functions are useful for identifying mislabeled examples: if 10% of MNIST labels are changed, and flag points as suspicious if they have a large influence on themselves, then about 60% of mislabeled points are in the top-10% of the most suspicious points. (See last appendix of [Bae 2022](https://arxiv.org/abs/2209.05364))

(These two methods are common in the influence function literature and were not introduced by the two papers I cite here.)

\[Edit\] Other empirical evidence since the initial post date: influence functions correctly [predict](https://arxiv.org/pdf/2308.03296.pdf) that [LLMs don't generalize from "A is B" to "B is A"](https://owainevans.github.io/reversal_curse.pdf).

I would be excited about future work using influence functions to make specific predictions about the effect of removing some points from the training set and retraining the network to see if those predictions were accurate. I would be even more interested if those predictions were about generalization properties of LLMs outside their training distribution.

Speculations about what influence functions won't and will be useful for
------------------------------------------------------------------------

The main practical use case I see is formulating hypotheses about what kind of dataset modification would lead to what changes in behavior. I say “formulating hypotheses” and not something stronger like “making suggestions” because I currently see no strong evidence that influence functions can make reliable predictions about effects of modifying training datasets.

If in the future, influence functions are shown to be a good way to suggest and predict effects of dataset modifications, how would that be differentially useful for AI safety? I see 3 paths forward:

1.  Influence functions might help generate hypothesis about what makes adversarial training work best, and thus improve its sample efficiency significantly (while capabilities of frontier models might benefit differentially more from scale alone);
2.  Influence functions localization suggestions might help steer inductive biases of models by suggesting freezing some parts of the models during some crucial fine-tuning stages (e.g. by favoring changes to possible motives as opposed to superficial word choices);
3.  Influence functions might lead to better intuitions of how models' internal work: since influence functions describe influence of points on specific weights, they could tell us which weights would be influenced as a result of dataset changes, which could help formulate hypotheses about the inner workings of neural networks.