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

大型语言模型在分布外检测方面表现如何?

How Good Are LLMs at Out-of-Distribution Detection?

The Hong Kong Polytechnic University(香港理工大学);Sun Yat‐Sen University(中山大学)

Bo Liu, Liming Zhan, Zexin Lu, Yujie Feng, Lei Xue, Xiao-Ming Wu

AI总结:

本文实证评估 7B–65B LLaMA 在零梯度与生成式微调下的 OOD 检测能力,发现简单余弦距离检测器最优,并归因于 LLM 嵌入空间的各向同性。

摘要:

分布外(OOD)检测对于提升机器学习(ML)模型的可靠性具有重要作用。大型语言模型(LLM)的出现推动了机器学习领域的范式转变,展现出其在各类自然语言处理任务上的卓越能力。尽管已有研究探讨了使用 BERT、RoBERTa 和 GPT-2 等相对小规模 Transformer 进行 OOD 检测,但这些模型在规模、预训练目标和推理范式上的显著差异,使人们怀疑相关发现是否适用于 LLM。本文率先对 LLM 领域中的 OOD 检测开展实证研究,重点考察规模从 7B 到 65B 的 LLaMA 系列模型。我们全面评估了常用的 OOD 检测器,仔细审查其在零梯度和微调两种情形下的性能。值得注意的是,我们将以往的判别式分布内微调改为生成式微调,使 LLM 的预训练目标与下游任务保持一致。研究结果表明,一个简单的余弦距离 OOD 检测器表现出更优的效果,优于其他 OOD 检测器。我们通过强调 LLM 嵌入空间的各向同性本质,为这一现象提供了有趣的解释;这种性质与较小的 BERT 系列模型中观察到的各向异性形成鲜明对比。这一新认识增进了我们对 LLM 如何检测 OOD 数据的理解,从而提升其在动态环境中的适应性和可靠性。我们已在 https://github.com/Awenbocc/LLM-OOD 发布源代码,供其他研究人员复现结果。

英文摘要:

Out-of-distribution (OOD) detection plays a vital role in enhancing the reliability of machine learning (ML) models. The emergence of large language models (LLMs) has catalyzed a paradigm shift within the ML community, showcasing their exceptional capabilities across diverse natural language processing tasks. While existing research has probed OOD detection with relative small-scale Transformers like BERT, RoBERTa and GPT-2, the stark differences in scales, pre-training objectives, and inference paradigms call into question the applicability of these findings to LLMs. This paper embarks on a pioneering empirical investigation of OOD detection in the domain of LLMs, focusing on LLaMA series ranging from 7B to 65B in size. We thoroughly evaluate commonly-used OOD detectors, scrutinizing their performance in both zero-grad and fine-tuning scenarios. Notably, we alter previous discriminative in-distribution fine-tuning into generative fine-tuning, aligning the pre-training objective of LLMs with downstream tasks. Our findings unveil that a simple cosine distance OOD detector demonstrates superior efficacy, outperforming other OOD detectors. We provide an intriguing explanation for this phenomenon by highlighting the isotropic nature of the embedding spaces of LLMs, which distinctly contrasts with the anisotropic property observed in smaller BERT family models. The new insight enhances our understanding of how LLMs detect OOD data, thereby enhancing their adaptability and reliability in dynamic environments. We have released the source code at \url{https://github.com/Awenbocc/LLM-OOD} for other researchers to reproduce our results.

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

↑