Recently, test-time adaptation (TTA) has been proposed as a promising solution for addressing distribution shifts. It allows a base model to adapt to an unforeseen distribution during inference by leveraging the information from the batch of (unlabeled) test data. However, we uncover a novel security vulnerability of TTA based on the insight that predictions on benign samples can be impacted by malicious samples in the same batch. To exploit this vulnerability, we propose Distribution Invading Attack (DIA), which injects a small fraction of malicious data into the test batch. DIA causes models using TTA to misclassify benign and unperturbed test data, providing an entirely new capability for adversaries that is infeasible in canonical machine learning pipelines. Through comprehensive evaluations, we demonstrate the high effectiveness of our attack on multiple benchmarks across six TTA methods. In response, we investigate two countermeasures to robustify the existing insecure TTA implementations, following the principle of "security by design". Together, we hope our findings can make the community aware of the utility-security tradeoffs in deploying TTA and provide valuable insights for developing robust TTA approaches.
翻译:近期,测试时自适应(TTA)作为一种应对分布偏移的有效方案被提出。该方法通过利用测试批次中(未标注)数据的分布信息,使基础模型在推理阶段适应未知数据分布。然而,我们基于"同批次中恶意样本可能影响良性样本预测结果"这一洞见,揭示了TTA的新型安全漏洞。为利用该漏洞,我们提出分布入侵攻击(DIA),通过在测试批次中注入少量恶意数据,使得采用TTA的模型错误分类良性且未受扰动的测试数据——这为攻击者提供了传统机器学习流程中无法实现的全新攻击能力。通过全面评估,我们在六种TTA方法的多个基准测试中验证了攻击的高效性。作为回应,我们遵循"安全设计"原则,研究了两种加固现有不安全TTA实现的防御措施。我们期望这些发现能引起学界对部署TTA时效用-安全性权衡的重视,并为开发鲁棒的TTA方法提供重要启示。