《Understanding Black-box Predictions via Influence Functions》笔记

文章探讨了在训练模型过程中,通过优化和扰动分析,尤其是通过influence函数I_up,loss来衡量训练点对测试点预测的影响。强调了梯度关联的重要性,特别是在非参数自由模型中,如逻辑回归。文章还讨论了Hessian正定性和算子范数在近似Hessian逆中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[1] 通过升权( § 2.1 \S 2.1 §2.1)、扰动( § 2.2 \S 2.2 §2.2)两种方式研究某个 training point z = ( x , y ) z=(x,y) z=(x,y) 对(优化后的)模型参数 θ ^ \hat\theta θ^、模型在某个 test point z test = ( x test , y test ) z_\text{test} = (x_\text{test}, y_\text{test}) ztest=(xtest,ytest) 的 prediction 的影响。

其在 § 2.3 \S 2.3 §2.3 对比在找与 z test z_\text{test} ztest 最相关的 z 时,(2) 式提出的影响函数 I up,loss ( z , z test ) I_\text{up,loss}(z,z_\text{test}) Iup,loss(z,ztest) 与(normalised x 后的)欧氏距离 x T x test x^T x_\text{test} xTxtest 的分别。以 logistic regression 为例,算出此时 I up,loss I_\text{up,loss} Iup,loss 的表达式,提了两点分别:

  • σ ( − y θ T x ) \sigma(-y\theta^Tx) σ(yθTx) 一项会使 loss 大的 training point 有更大的 influence。由 loss 的表达式 L ( z , θ ) = log ⁡ [ 1 + exp ⁡ ( − y θ T x ) ] L(z,\theta)=\log[1+\exp(-y\theta^Tx)] L(z,θ)=log[1+exp(yθTx)],loss 更大意味着 − y θ T x -y\theta^Tx yθTx 更大,从而 σ ( − y θ T x ) \sigma(-y\theta^Tx) σ(yθTx) 更大,确实会令 I up,loss I_\text{up,loss} Iup,loss 的绝对值更大,即有更大的 influence。

  • H θ ^ − 1 H^{-1}_{\hat\theta} Hθ^1 一项的作用,[2,5,6] 没解释,[3,4] 简单翻译一笔带过。看了 [1] 的 talk,还是看回 (2) 式好理解些: I up,loss ( z , z test ) = − ∇ θ L ( z test , θ ^ ) T H θ ^ − 1 ∇ θ L ( z , θ ^ ) I_\text{up,loss}(z,z_\text{test}) = - \nabla_\theta L(z_\text{test},\hat\theta)^T H^{-1}_{\hat\theta} \nabla_\theta L(z,\hat\theta) Iup,loss(z,ztest)=θL(ztest,θ^)THθ^1θL(z,θ^) 先忽略中间的 H θ ^ − 1 H^{-1}_{\hat\theta} Hθ^1也忽略负号,因为是讨论 influence「大小」,不看方向),只看 ∇ θ L ( z test , θ ^ ) T ∇ θ L ( z , θ ^ ) \nabla_\theta L(z_\text{test},\hat\theta)^T \nabla_\theta L(z,\hat\theta) θL(ztest,θ^)TθL(z,θ^),则 (2) 相当于说要找最相关的 z,不是看数据层面的关联(即 x T x test x^T x_\text{test} xTxtest),因为这里不是 kNN 这种 parameter-free 的模型,training data 是通过影响模型参数 θ \theta θ 来影响 test data 的 prediction 的,所以从「梯度关联」(内积)的视角看更准确:梯度反映模型要 fit 此数据要做出的调整,梯度越相关,意味着模型为 fit z 做出的调整对 predict z test z_\text{test} ztest 越适用。
    再考虑整个训练集:如果有其它 z ′ z' z 带来的梯度跟 z test z_\text{test} ztest 的梯度也很相关,那 z 就相对没那么重要了,极端情况 z ′ = z z'=z z=z,那有 z 没 z 都无所谓,所以加上 H θ ^ − 1 H^{-1}_{\hat\theta} Hθ^1 来考虑这点,文中

    ∇ θ L ( z , θ ^ ) \nabla_\theta L(z,\hat\theta) θL(z,θ^) points in a direction of little variation

    「direction」应是指梯度的方向、「variance」指梯度的方差。参考 [7-9],此时 H θ ^ − 1 H^{-1}_{\hat\theta} Hθ^1 应该会相对放大这个梯度内积(联想一维正态分布的情况会比较直观,高维的协方差逆相当于一维时方差放在分母,方差越小整个分式越大),于是数值上 I up,loss ( z , z test ) I_\text{up,loss}(z,z_\text{test}) Iup,loss(z,ztest) 更大;而联系 PCA 中关于 variance 的描述,这应该是表明很少有其它 training points 的梯度方向与 z 的相近,于是 z 对模型的影响(及此影响于 predict z test z_\text{test} ztest 的适用性)无可替代,所以应当认为 z 对 z test z_\text{test} ztest 的 influence 更大。

§ 3 \S 3 §3 的 stochastic estimation 近似 H θ ^ − 1 H^{-1}_{\hat\theta} Hθ^1 中,其 Taylor 展开为 H θ ^ − 1 = ∑ i = 0 ∞ ( I − H ) i H^{-1}_{\hat\theta} = \sum_{i=0}^\infin (I-H)^i Hθ^1=i=0(IH)i,参考 [10,11],此展开成立的前提是 ∥ I − H ∥ < 1 \|I-H\|<1 IH<1算子范数),后文有说用 ∇ θ 2 L ( z i , θ ^ ) \nabla^2_\theta L(z_i,\hat\theta) θ2L(zi,θ^) 作 H 的无偏估计,而同一页的脚注 2 有讲假设 ∀ i , ∇ θ 2 L ( z i , θ ^ ) ⪯ I \forall i, \nabla^2_\theta L(z_i,\hat\theta) \preceq I i,θ2L(zi,θ^)I 成立,应该是类似的意思。这在实数域中的类比是 ∣ x ∣ < 1 |x|<1 x<1 ( 1 − x ) − 1 = 1 1 − x (1-x)^{-1}=\frac{1}{1-x} (1x)1=1x1 几何级数展开,见 [10,11]。

⪯ \preceq 是偏序的符号,用在向量上是 majorization,但这里是用在矩阵上。经 [12] 评论提醒,应是 Loewner 偏序[13],跟矩阵正定有关,相关笔记可见 [14]。下面解释它跟 Neumann 序列[11]的关系。

由 [10],要将 H − 1 H^{-1} H1 展开成 ∑ i = 1 ∞ ( I − H ) i \sum_{i=1}^\infin (I-H)^i i=1(IH)i 的形式(即 Neumann 序列),前提是 ∥ I − H ∥ < 1 \|I-H\|<1 IH<1算子范数)。有关算子范数及相关知识参考 [15-19],简单来说,矩阵 A 的算子范数为 sup ⁡ ∥ x ∥ = 1 ∥ A x ∥ \sup_{\|x\|=1} \|Ax\| supx=1Ax。易算得单位阵 I I I 的算子范数为 sup ⁡ ∥ x ∥ = 1 ∥ I x ∥ = sup ⁡ ∥ x ∥ = 1 ∥ x ∥ = 1 \sup_{\|x\|=1}\|Ix\| = \sup_{\|x\|=1}\|x\| = 1 supx=1Ix=supx=1x=1。由 [14] 的笔记,有 A ≺ ( 或 ⪯ ) B ⇔ ∀ x ≠ 0 , ∥ A x ∥ < ( 或 ≤ ) ∥ B x ∥ A \prec (或 \preceq) B \Leftrightarrow \forall x \ne 0, \|Ax\| < (或 \leq) \|Bx\| A()Bx=0,Ax<()Bx 又因为有假设 ∀ i , 0 ≺ ∇ θ 2 L ( z i , θ ^ ) ⪯ I \forall i, 0 \prec \nabla^2_\theta L(z_i,\hat\theta) \preceq I i,0θ2L(zi,θ^)I[1] 中 § 2.1 \S2.1 §2.1 有假设 Hessian 正定),故 0 ≺ H θ ^ = 1 n ∑ i = 1 n ∇ θ 2 L ( z i , θ ^ ) ⪯ I I ≻ I − H θ ^ ⪰ 0 \begin{aligned} 0 &\prec H_{\hat\theta} = \frac{1}{n} \sum_{i=1}^n \nabla_\theta^2 L\left(z_i, \hat{\theta}\right) &\preceq I \\ I &\succ I - H_{\hat\theta} &\succeq 0 \end{aligned} 0IHθ^=n1i=1nθ2L(zi,θ^)IHθ^I0 所以 I − H θ ^ I - H_{\hat\theta} IHθ^ 的算子范数 ∥ I − H θ ^ ∥ = sup ⁡ ∥ x ∥ = 1 ∥ ( I − H θ ^ ) x ∥ < sup ⁡ ∥ x ∥ = 1 ∥ I x ∥ = sup ⁡ ∥ x ∥ = 1 ∥ x ∥ = 1 \begin{aligned} \|I - H_{\hat\theta}\| &= \sup_{\|x\|=1}\|(I - H_{\hat\theta})x\| \\ & < \sup_{\|x\|=1} \|Ix\| = \sup_{\|x\|=1} \|x\| =1 \end{aligned} IHθ^=x=1sup(IHθ^)x<x=1supIx=x=1supx=1 满足 [11] Neumann 序列的前提,所以展开成立。

References

  1. (ICML 2017) Understanding Black-box Predictions via Influence Functions - paper, talk, code
  2. ICML 2017 Best Paper Award论文解读(1)
  3. ICML 2017 Best Paper理解
  4. 论文笔记understanding black-box predictions via influence functions
  5. ICML 2017最佳论文:为什么你改了一个参数,模型预测率突然提高了|分享总结
  6. 论文笔记:Understanding Black-box Predictions via Influence Functions
  7. What is the Covariance Matrix?
  8. Understanding the Covariance Matrix
  9. 如何直观地理解「协方差矩阵」?
  10. Taylor Expansion of inverse of a matrix (need verification that this is completely wrong)
  11. Neumann series
  12. 矩阵论记号约定
  13. Loewner orderLoewner Order
  14. 《Data Cleansing for Models Trained with SGD》笔记
  15. 第一课:线性代数基础(一)第八课:向量的范数第九课:矩阵的范数第十课:算子范数(一)第十课:算子范数(二)
  16. 【矩阵论笔记】诱导范数
  17. 泛函分析学习笔记(七)
  18. 向量范数与矩阵范数
  19. 矩阵基础 | 向量范数与矩阵范数
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值