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

超越下一 token 概率:在 LLM 输出分布上可学习、快速地检测幻觉与数据污染

Beyond Next Token Probabilities: Learnable, Fast Detection of Hallucinations and Data Contamination on LLM Output Distributions

Guy Bar-Shalom, Fabrizio Frasca, Derek Lim, Yoav Gelberg, Yftah Ziser, Ran El-Yaniv, Gal Chechik, Haggai Maron

AI总结:

本文提出将完整下一 token 分布序列表示为 LOS,并用轻量注意力模型 LOS-Net 检测 LLM 幻觉与数据污染,在多基准上实现更优性能、低延迟和良好迁移性。

摘要:

自动检测幻觉和训练数据污染对于大语言模型(LLM)的安全部署至关重要。在无法访问模型内部信息的场景中,这些任务尤其具有挑战性。当前适用于这种设置的方法通常只利用文本中实际 token 的概率,并依赖简单的、针对特定任务的启发式规则。关键在于,它们忽视了完整的下一 token 概率分布序列中包含的信息。我们提出超越人工制定的决策规则,直接从 LLM 完整的可观测输出中学习——这些输出不仅包括下一 token 概率,还包括完整的下一 token 分布序列。我们将其称为 LLM Output Signature(LOS),并把它作为检测幻觉和数据污染的参考数据类型。为此,我们提出 LOS-Net,这是一种基于注意力的轻量级架构,在 LOS 的高效编码上进行训练,并且可证明能够近似适用于这两项任务的一大类现有技术。实验上,LOS-Net 在不同基准和 LLM 上均取得更优性能,同时保持极低的检测延迟。此外,它还展现出良好的跨数据集与跨 LLM 迁移能力。完整代码可在 https://github.com/BarSGuy/Beyond-next-token-probabilities 获取。

英文摘要:

The automated detection of hallucinations and training data contamination is pivotal to the safe deployment of Large Language Models (LLMs). These tasks are particularly challenging in settings where no access to model internals is available. Current approaches in this setup typically leverage only the probabilities of actual tokens in the text, relying on simple task-specific heuristics. Crucially, they overlook the information contained in the full sequence of next-token probability distributions. We propose to go beyond hand-crafted decision rules by learning directly from the complete observable output of LLMs -- consisting not only of next-token probabilities, but also the full sequence of next-token distributions. We refer to this as the LLM Output Signature (LOS), and treat it as a reference data type for detecting hallucinations and data contamination. To that end, we introduce LOS-Net, a lightweight attention-based architecture trained on an efficient encoding of the LOS, which can provably approximate a broad class of existing techniques for both tasks. Empirically, LOS-Net achieves superior performance across diverse benchmarks and LLMs, while maintaining extremely low detection latency. Furthermore, it demonstrates promising transfer capabilities across datasets and LLMs. Full code is available at https://github.com/BarSGuy/Beyond-next-token-probabilities.

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

↑