arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.14161cs.LG
收藏

当基准谎言:在真实分布偏移下评估恶意提示分类器

When Benchmarks Lie: Evaluating Malicious Prompt Classifiers Under True Distribution Shift

Zenity

Max Fomin

AI总结:

研究通过LODO评估揭示了现有方法在真实分布偏移下的局限性,并展示了SAE特征在提升分类器解释性方面的潜力。

摘要:

检测提示注入和劫持攻击对于安全部署基于大语言模型(LLM)的代理至关重要。随着代理越来越多地处理来自电子邮件、文档、工具输出和外部API的不受信任的数据,稳健的攻击检测变得至关重要。然而,当前的评估实践和生产系统存在根本性的局限性。我们使用涵盖有害请求、劫持、间接提示注入和提取攻击的18个数据集的多样化基准,进行了全面分析。我们提出了一种留一数据集法(LODO)评估,以衡量真正的分布偏移泛化能力,发现标准做法从同一数据集源进行训练-测试分割严重高估了性能:汇总指标显示AUC膨胀了8.4个百分点,但每个数据集的差距范围从1%到25%的准确率,暴露了异质性的失败模式。为了理解为什么分类器无法泛化,我们分析了稀疏自动编码器(SAE)特征系数在LODO折叠中的情况,发现28%的顶部特征是数据集依赖的捷径,其类别信号依赖于特定数据集的组成,而不是语义内容。我们系统地比较了生产防护措施(PromptGuard 2、LlamaGuard)和LLM-as-judge方法在我们的基准中的表现,发现所有三种方法在针对代理的间接攻击(7-37%的检测)上都失败,并且PromptGuard 2和LlamaGuard由于架构限制无法评估代理工具注入。最后,我们展示了LODO稳定的SAE特征能通过过滤数据集伪影提供更可靠的分类器决策解释。我们发布我们的评估框架在https://github.com/maxf-zn/prompt-mining以建立LODO作为提示攻击检测研究的适当协议。

英文摘要:

Detecting prompt injection, jailbreak attacks, and harmful requests is critical for deploying LLM-based agents safely, yet current evaluation practices in this literature overestimate generalization. We train activation-based classifiers (linear probes on LLM hidden states) on a benchmark of 18 datasets (prompt attacks plus benign sources) and propose Leave-One-Dataset-Out (LODO) evaluation, where the held-out dataset is never seen during training. Across four LLMs from three families (Llama-3.1-8B, Gemma-3-27B, Qwen-3.5-2B/4B), standard cross-validation reports a pooled AUC 8.0-16.5 points higher than LODO; per-dataset held-out-test-vs-LODO accuracy gaps span 1-25 points. To understand the gap, we analyze the LODO stability of a linear probe's per-feature classifier coefficients, defining a retention metric for sparse-autoencoder (SAE) features that flags dataset-dependent shortcuts. 28-44% of top SAE features are shortcuts across models, a dataset-identity classifier reaches 96.6%, and the dataset-identifying and safety-relevant subspaces partially overlap. Standard domain-generalization fixes such as adversarial training, subspace projection, sample reweighting, and class balancing do not close the gap. Finally, we show LODO-weighted SAE attributions filter dataset artifacts for more reliable per-prompt explanations. We release our framework at https://github.com/maxf-zn/prompt-mining so future prompt-attack classifiers can be evaluated under LODO alongside CV.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑