DNA-GPT:用于免训练检测GPT生成文本的发散N元语法分析
DNA-GPT: Divergent N-Gram Analysis for Training-Free Detection of GPT-Generated Text
AI总结:
针对大语言模型生成文本检测难、传统方法灵活性与可解释性不足的问题,提出免训练的DNA-GPT检测策略,通过文本截断重生成与差异分析实现检测,性能超越OpenAI分类器,兼具可解释性、抗改写攻击与模型溯源能力。
摘要:
大语言模型(LLMs)显著提升了机器生成文本的流畅性与多样性,但这一进展也给文本来源检测带来了巨大挑战,当前检测方法的研究滞后于LLMs的快速迭代。传统基于训练的检测方法在灵活性上存在局限,尤其是在适配新领域时表现不佳,且通常缺乏可解释性。为填补这一空白,我们提出了一种全新的免训练检测策略,名为发散N元语法分析(Divergent N-Gram Analysis,DNA-GPT)。对于给定文本,我们首先将其从中间截断,仅将前半部分作为输入传入LLMs,以重新生成新的后半部分。通过黑盒模式下的N元语法分析或白盒模式下的概率散度,分析原始后半部分与新生成后半部分的差异,我们发现机器生成文本与人类撰写文本的分布存在显著差异。我们对OpenAI旗下最先进的LLMs(包括text-davinci-003、GPT-3.5-turbo和GPT-4)以及GPT-NeoX-20B、LLaMa-13B等开源模型开展了大量实验。结果表明,我们的零样本方法在4个英文数据集和1个德文数据集上区分人类文本与GPT生成文本的表现达到了当前最优水平,性能优于OpenAI基于数百万文本训练的自有分类器。此外,我们的方法能为检测结论提供合理的解释与证据,这是可解释检测的独有特性。该方法在文本改写攻击下也具备鲁棒性,还可额外解决模型溯源问题。代码已开源至https://github.com/Xianjun-Yang/DNA-GPT。
英文摘要:
Large language models (LLMs) have notably enhanced the fluency and diversity of machine-generated text. However, this progress also presents a significant challenge in detecting the origin of a given text, and current research on detection methods lags behind the rapid evolution of LLMs. Conventional training-based methods have limitations in flexibility, particularly when adapting to new domains, and they often lack explanatory power. To address this gap, we propose a novel training-free detection strategy called Divergent N-Gram Analysis (DNA-GPT). Given a text, we first truncate it in the middle and then use only the preceding portion as input to the LLMs to regenerate the new remaining parts. By analyzing the differences between the original and new remaining parts through N-gram analysis in black-box or probability divergence in white-box, we unveil significant discrepancies between the distribution of machine-generated text and the distribution of human-written text. We conducted extensive experiments on the most advanced LLMs from OpenAI, including text-davinci-003, GPT-3.5-turbo, and GPT-4, as well as open-source models such as GPT-NeoX-20B and LLaMa-13B. Results show that our zero-shot approach exhibits state-of-the-art performance in distinguishing between human and GPT-generated text on four English and one German dataset, outperforming OpenAI's own classifier, which is trained on millions of text. Additionally, our methods provide reasonable explanations and evidence to support our claim, which is a unique feature of explainable detection. Our method is also robust under the revised text attack and can additionally solve model sourcing. Codes are available at https://github.com/Xianjun-Yang/DNA-GPT.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。