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

大型语言模型如何编码上下文知识?一项逐层探测研究

How Large Language Models Encode Context Knowledge? A Layer-Wise Probing Study

School of Electronic Information and Electrical Engineering, Shanghai Jiao Tong University(上海交通大学电子信息与电气工程学院);Shandong University(山东大学);Southeast University(东南大学);Leiden University(莱顿大学)

Tianjie Ju, Weiwei Sun, Wei Du, Xinwei Yuan, Zhaochun Ren, Gongshen Liu

AI总结:

本文利用ChatGPT构建探测数据集并以 $\mathcal V$-usable information 为指标,揭示LLM在不同层编码上下文知识的位置、扩散与遗忘规律。

摘要:

先前的工作展示了大型语言模型(LLM)在检索事实和处理上下文知识方面引人关注的能力。然而,关于LLM逐层编码知识的能力,现有研究仍然有限,这挑战了我们对其内部机制的理解。在本文中,我们首次尝试通过探测任务研究LLM的逐层能力。我们利用ChatGPT强大的生成能力构建探测数据集,提供与各种事实相对应的多样且连贯的证据。我们采用 $\mathcal V$-usable information($\mathcal V$ 可用信息)作为验证指标,以更好地反映不同层编码上下文知识的能力。我们在冲突知识和新获得知识上的实验表明,LLM:(1)倾向于在上层编码更多上下文知识;(2)在下层主要将上下文知识编码在与知识相关的实体词元内,而在上层逐渐将更多知识扩展到其他词元中;(3)当提供无关证据时,会逐渐遗忘中间层保留的较早上下文知识。代码公开于 https://github.com/Jometeorie/probing_llama。

英文摘要:

Previous work has showcased the intriguing capability of large language models (LLMs) in retrieving facts and processing context knowledge. However, only limited research exists on the layer-wise capability of LLMs to encode knowledge, which challenges our understanding of their internal mechanisms. In this paper, we devote the first attempt to investigate the layer-wise capability of LLMs through probing tasks. We leverage the powerful generative capability of ChatGPT to construct probing datasets, providing diverse and coherent evidence corresponding to various facts. We employ $\mathcal V$-usable information as the validation metric to better reflect the capability in encoding context knowledge across different layers. Our experiments on conflicting and newly acquired knowledge show that LLMs: (1) prefer to encode more context knowledge in the upper layers; (2) primarily encode context knowledge within knowledge-related entity tokens at lower layers while progressively expanding more knowledge within other tokens at upper layers; and (3) gradually forget the earlier context knowledge retained within the intermediate layers when provided with irrelevant evidence. Code is publicly available at https://github.com/Jometeorie/probing_llama.

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

↑