Bayesian Neural Networks (BNN) have emerged as a crucial approach for interpreting ML predictions. By sampling from the posterior distribution, data scientists may estimate the uncertainty of an inference. Unfortunately many inference samples are often needed, the overhead of which greatly hinder BNN's wide adoption. To mitigate this, previous work proposed propagating the first and second moments of the posterior directly through the network. However, on its own this method is even slower than sampling, so the propagated variance needs to be approximated such as assuming independence between neural nodes. The resulting trade-off between quality and inference time did not match even plain Monte Carlo sampling. Our contribution is a more principled variance propagation framework based on "spiked covariance matrices", which smoothly interpolates between quality and inference time. This is made possible by a new fast algorithm for updating a diagonal-plus-low-rank matrix approximation under various operations. We tested our algorithm against sampling based MC Dropout and Variational Inference on a number of downstream uncertainty themed tasks, such as calibration and out-of-distribution testing. We find that Favour is as fast as performing 2-3 inference samples, while matching the performance of 10-100 samples. In summary, this work enables the use of BNN in the realm of performance critical tasks where they have previously been out of reach.
翻译:摘要:贝叶斯神经网络(BNN)已成为解释机器学习预测的重要方法。通过从后验分布采样,数据科学家可以估计推理的不确定性。然而,通常需要大量推理样本,其计算开销极大地阻碍了BNN的广泛应用。为缓解这一问题,先前研究提出直接通过网络传播后验的一阶矩和二阶矩。但该方法本身比采样更慢,因此需对传播的方差进行近似处理,例如假设神经节点间相互独立。由此产生的质量与推理时间之间的权衡甚至无法匹敌朴素蒙特卡洛采样。我们的贡献在于提出一种基于“尖峰协方差矩阵”的更规范的方差传播框架,可平滑地在质量与推理时间之间进行插值。这一框架通过一种新的快速算法实现,该算法可在多种运算下更新对角加低秩矩阵近似。我们针对多个下游不确定性任务(如校准和分布外测试),将算法与基于采样的MC Dropout和变分推断进行了对比测试。结果表明,Favour的运行速度与执行2-3次推理样本相当,同时性能可媲美10-100次样本。总之,本工作使得BNN可应用于此前难以企及的性能关键型任务领域。