arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.03940cs.CLcs.AI
收藏

并非所有 token 生来平等:用于 AI 生成文本检测的困惑度注意力加权网络

Not all tokens are created equal: Perplexity Attention Weighted Networks for AI generated text detection

Pablo Miralles-González, Javier Huertas-Tato, Alejandro Martín, David Camacho

AI总结:

提出困惑度注意力加权网络(PAWN),通过 LLM 最后隐藏状态和位置加权下一 token 分布指标特征,以更少参数实现优于基线的 AI 生成文本检测性能,并提升跨域、跨模型及多语言泛化能力与鲁棒性。

摘要:

大型语言模型(LLMs)的快速发展显著提升了其生成连贯且与上下文相关文本的能力,引发了对 AI 生成内容被滥用的担忧,使得检测此类内容变得至关重要。然而,该任务仍具挑战性,特别是在未见过的领域或不熟悉的 LLMs 中。利用 LLM 的下一 token 分布输出提供了一种理论上具有吸引力的检测方法,因为它们包含了模型在多样化语料库上进行广泛预训练的见解。尽管前景广阔,但试图将这些输出实际应用的零样本方法却收效有限。我们假设问题之一在于它们使用均值来聚合跨 token 的下一 token 分布指标,而某些 token 本质上更容易或更难预测,理应赋予不同权重。基于此想法,我们提出了困惑度注意力加权网络(PAWN),该方法利用 LLM 的最后隐藏状态和位置,对基于序列长度上下一 token 分布的一系列指标特征加权和。虽然不是零样本,但我们的方法允许将最后隐藏状态和下一 token 分布指标缓存在磁盘上,大大降低了训练资源需求。PAWN 在分布内表现出与最强基线(微调 LMs)相当甚至更好的性能,且仅使用其一小部分可训练参数。我们的模型对未见过的领域和源模型也具有更好的泛化能力,在分布偏移下决策边界的变异性更小。它对对抗性攻击也更具鲁棒性,并且如果骨干网络具有多语言能力,它对监督训练期间未见过的语言展现出不错的泛化性,其中 LLaMA3-1B 在九种语言的交叉验证中达到了 81.46% 的平均宏平均 F1 分数。

英文摘要:

The rapid advancement in large language models (LLMs) has significantly enhanced their ability to generate coherent and contextually relevant text, raising concerns about the misuse of AI-generated content and making it critical to detect it. However, the task remains challenging, particularly in unseen domains or with unfamiliar LLMs. Leveraging LLM next-token distribution outputs offers a theoretically appealing approach for detection, as they encapsulate insights from the models' extensive pre-training on diverse corpora. Despite its promise, zero-shot methods that attempt to operationalize these outputs have met with limited success. We hypothesize that one of the problems is that they use the mean to aggregate next-token distribution metrics across tokens, when some tokens are naturally easier or harder to predict and should be weighted differently. Based on this idea, we propose the Perplexity Attention Weighted Network (PAWN), which uses the last hidden states of the LLM and positions to weight the sum of a series of features based on metrics from the next-token distribution across the sequence length. Although not zero-shot, our method allows us to cache the last hidden states and next-token distribution metrics on disk, greatly reducing the training resource requirements. PAWN shows competitive and even better performance in-distribution than the strongest baselines (fine-tuned LMs) with a fraction of their trainable parameters. Our model also generalizes better to unseen domains and source models, with smaller variability in the decision boundary across distribution shifts. It is also more robust to adversarial attacks, and if the backbone has multilingual capabilities, it presents decent generalization to languages not seen during supervised training, with LLaMA3-1B reaching a mean macro-averaged F1 score of 81.46% in cross-validation with nine languages.

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

↑