梯度短路:通过特征干预实现高效的分布外检测
Gradient Short-Circuit: Efficient Out-of-Distribution Detection via Feature Intervention
AI总结:
本文利用ID与OOD样本周围梯度方向一致性的差异,提出在推理阶段对特征坐标进行梯度短路干预,并用一阶近似避免额外前向计算,以轻量方式显著提升OOD检测性能。
摘要:
分布外(OOD)检测对于在开放世界环境中安全部署深度模型至关重要,因为在这些环境中输入可能位于训练分布之外。在对仅使用分布内(ID)数据训练的模型进行推理时,我们观察到一个显著的梯度现象:在ID样本周围,用于“增强”该样本预测类别的局部梯度方向保持相对一致,而OOD样本——训练中未见过的样本——在同一邻域内表现出杂乱或相互冲突的梯度方向。受这一观察的启发,我们提出了一种推理阶段技术,用于短路那些被虚假梯度利用来抬高OOD置信度的特征坐标,同时使ID分类基本不受影响。为了避免在梯度短路后重新计算logits的开销,我们进一步引入了一种局部一阶近似方法,该方法无需第二次前向传播即可准确捕捉修改后的输出。在标准OOD基准上的实验表明,我们的方法带来了显著的改进。此外,该方法轻量且对标准推理流程的改动极小,为实际应用中的鲁棒OOD检测提供了一条实用路径。
英文摘要:
Out-of-Distribution (OOD) detection is critical for safely deploying deep models in open-world environments, where inputs may lie outside the training distribution. During inference on a model trained exclusively with In-Distribution (ID) data, we observe a salient gradient phenomenon: around an ID sample, the local gradient directions for "enhancing" that sample's predicted class remain relatively consistent, whereas OOD samples--unseen in training--exhibit disorganized or conflicting gradient directions in the same neighborhood. Motivated by this observation, we propose an inference-stage technique to short-circuit those feature coordinates that spurious gradients exploit to inflate OOD confidence, while leaving ID classification largely intact. To circumvent the expense of recomputing the logits after this gradient short-circuit, we further introduce a local first-order approximation that accurately captures the post-modification outputs without a second forward pass. Experiments on standard OOD benchmarks show our approach yields substantial improvements. Moreover, the method is lightweight and requires minimal changes to the standard inference pipeline, offering a practical path toward robust OOD detection in real-world applications.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。