AtPatch:通过过注意力热修复调试Transformer
AtPatch: Debugging Transformers via Hot-Fixing Over-Attention
AI总结:
AtPatch通过动态重新分配注意力图,有效缓解后门攻击和不公平性,同时保留模型原始功能。
摘要:
基于深度神经网络(DNN)的Transformer在受到后门攻击和不公平性影响时,通常会表现出异常的注意力模式,导致过度关注后门触发器或受保护的属性。现有的神经元编辑缓解策略往往难以处理这种情况,大多数缺乏灵活性且容易扭曲特征表示。受这种过度注意力现象和软件工程范式如delta调试和热补丁的启发,我们提出了AtPatch,一种热修复方法,能够在模型推理过程中动态重新分配注意力图。具体来说,对于给定的输入,AtPatch首先从模型的推理过程中提取注意力图。然后,它使用预训练的检测器识别异常列,并将它们替换为统一的良性注意力。然后,AtPatch重新缩放其他列以减轻过度注意力的影响。最后,AtPatch将重新分配的注意力图返回给模型继续推理。值得注意的是,如果检测器没有报告任何异常列,AtPatch会直接将原始注意力图返回给模型。与现有技术不同,AtPatch选择性地重新分配注意力图,使其在保留模型原始功能方面更有效。此外,AtPatch的即插即用性质使其能够在不修改模型参数或重新训练的情况下工作,使其更适合部署模型。我们进行了广泛的实验来验证AtPatch。实验结果表明,与现有方法相比,AtPatch能够更有效地缓解后门攻击和不公平性,同时更好地保留模型的原始功能。
英文摘要:
Transformer-based deep neural networks (DNNs) affected by backdoor attacks and unfairness typically exhibit anomalous attention patterns, leading to over-attend to backdoor triggers or protected attributes. Existing neuron-editing mitigation strategies often struggle to handle such situation and most of them lack flexibility and tend to distort feature representations. Motivated by such over-attention phenomenon and software engineering paradigms such as delta debugging and hot patching, we propose AtPatch, a hot-fix method that dynamically redistributes attention maps during model inference. Specifically, for a given input, AtPatch first extracts the attention map from the model's inference process. Then, it uses a pre-trained detector to identify anomalous columns and replace them with unified benign attention. Then, AtPatch rescales other columns to mitigate the impact of over-attention. Finally, AtPatch returns the redistributed attention map to the model for continued inference. Notably, if the detector does not report any anomalous columns, AtPatch directly returns the original attention map to the model. Unlike existing techniques, AtPatch selectively redistributes the attention map, making it better at preserving the model's original functionality. Furthermore, AtPatch's on-the-fly nature allows it to work without modifying model parameters or retraining, making it better suited for deployed models. We conducted extensive experiments to validate AtPatch. Experimental results show that, compared to existing methods, AtPatch can more effectively mitigate backdoor attacks and unfairness while better preserving the model's original functionality.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。