无需训练和查询,用kNN机制让代理模型精准识别大模型生成文本。
$k$NNProxy: Efficient Training-Free Proxy Alignment for Black-Box Zero-Shot LLM-Generated Text Detection

- 用kNN检索构建轻量数据存储,实现无训练的代理模型对齐。
- 在多个数据集上达到90%以上检测准确率,优于现有零样本方法。
- 适合需要低成本、高鲁棒性的大模型生成内容检测场景。
大语言模型生成文本(LGT)检测对于可靠的内容溯源和防范滥用至关重要。现有方法分为基于学习和零样本两类,其中零样本方法因无需训练而更具潜力,但其可靠性依赖于预设代理模型与未知源模型对齐的假设,该假设在真实黑盒场景中往往不成立。现有对齐方法通常需微调代理模型或频繁调用商业API,导致部署成本高、易受接口变动影响且对领域迁移鲁棒性差。为此,本文提出kNNProxy,一种无需训练、查询高效的代理对齐框架,将kNN-LM检索机制重用于固定代理模型的领域适配。通过一次构建目标反映的LGT语料数据存储(可基于固定预算查询或现成数据集),推理时利用最近邻证据生成词级预测分布,并与代理输出加权融合,实现无需微调或逐标记API调用的对齐预测。为进一步提升领域迁移下的鲁棒性,扩展为多代理混合(MoP),根据输入路由至对应领域数据存储进行一致性检索。大量实验表明,该方法检测性能优异,在多个数据集上均达90%以上准确率。
原文摘要 · Abstract (English)
LLM-generated text (LGT) detection is essential for reliable forensic analysis and for mitigating LLM misuse. Existing LGT detectors can generally be categorized into two broad classes: learning-based approaches and zero-shot methods. Compared with learning-based detectors, zero-shot methods are particularly promising because they eliminate the need to train task-specific classifiers. However, the reliability of zero-shot methods fundamentally relies on the assumption that an off-the-shelf proxy LLM is well aligned with the often unknown source LLM, a premise that rarely holds in real-world black-box scenarios. To address this discrepancy, existing proxy alignment methods typically rely on supervised fine-tuning of the proxy or repeated interactions with commercial APIs, thereby increasing deployment costs, exposing detectors to silent API changes, and limiting robustness under domain shift. Motivated by these limitations, we propose the $k$-nearest neighbor proxy ($k$NNProxy), a training-free and query-efficient proxy alignment framework that repurposes the $k$NN language model ($k$NN-LM) retrieval mechanism as a domain adapter for a fixed proxy LLM. Specifically, a lightweight datastore is constructed once from a target-reflective LGT corpus, either via fixed-budget querying or from existing datasets. During inference, nearest-neighbor evidence induces a token-level predictive distribution that is interpolated with the proxy output, yielding an aligned prediction without proxy fine-tuning or per-token API outputs. To improve robustness under domain shift, we extend $k$NNProxy into a mixture of proxies (MoP) that routes each input to a domain-specific datastore for domain-consistent retrieval. Extensive experiments demonstrate strong detection performance of our method.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。