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

重新审视大型语言模型中的上下文学习推理回路

Revisiting In-context Learning Inference Circuit in Large Language Models

Japan Advanced Institute of Science and Technology(日本先进科学技术学院);RIKEN(理化学研究所)

Hakaze Cho, Mariko Kato, Yoshihiro Sakai, Naoya Inoue

AI总结:

本文提出将 ICL 推理分解为输入编码、语义合并、特征检索与复制的综合回路,统一解释多种现象,并通过消融验证其主导作用。

摘要:

上下文学习(In-context Learning,ICL)是语言模型(Language Models,LMs)上一种新兴的少样本学习范式,其内部机制尚未得到充分探索。已有工作描述了 ICL 的内部处理过程,但难以捕捉大型语言模型中的全部推理现象。因此,本文提出一个综合回路来建模推理动态,并尝试解释观察到的 ICL 现象。具体而言,我们将 ICL 推理划分为三个主要操作:(1)输入文本编码:LMs 将每一段输入文本(包括示范和查询)编码为隐藏状态中的线性表示,其中包含解决 ICL 任务所需的充分信息。(2)语义合并:LMs 将示范的编码表示与其对应的标签标记合并,生成标签与示范的联合表示。(3)特征检索与复制:LMs 在任务子空间中搜索与查询表示相似的示范联合表示,并将搜索到的表示复制到查询中。随后,语言模型头在一定程度上捕获这些被复制的标签表示,并将其解码为预测标签。通过细致测量,所提出的推理回路成功捕捉并统一了 ICL 过程中观察到的许多碎片化现象,使其成为对 ICL 推理过程全面且实用的解释。此外,通过禁用所提出步骤进行的消融分析会严重损害 ICL 性能,表明该推理回路是一种主导机制。另外,我们确认并列出了一些与所提出回路并行解决 ICL 任务的旁路机制。

英文摘要:

In-context Learning (ICL) is an emerging few-shot learning paradigm on Language Models (LMs) with inner mechanisms un-explored. There are already existing works describing the inner processing of ICL, while they struggle to capture all the inference phenomena in large language models. Therefore, this paper proposes a comprehensive circuit to model the inference dynamics and try to explain the observed phenomena of ICL. In detail, we divide ICL inference into 3 major operations: (1) Input Text Encode: LMs encode every input text (in the demonstrations and queries) into linear representation in the hidden states with sufficient information to solve ICL tasks. (2) Semantics Merge: LMs merge the encoded representations of demonstrations with their corresponding label tokens to produce joint representations of labels and demonstrations. (3) Feature Retrieval and Copy: LMs search the joint representations of demonstrations similar to the query representation on a task subspace, and copy the searched representations into the query. Then, language model heads capture these copied label representations to a certain extent and decode them into predicted labels. Through careful measurements, the proposed inference circuit successfully captures and unifies many fragmented phenomena observed during the ICL process, making it a comprehensive and practical explanation of the ICL inference process. Moreover, ablation analysis by disabling the proposed steps seriously damages the ICL performance, suggesting the proposed inference circuit is a dominating mechanism. Additionally, we confirm and list some bypass mechanisms that solve ICL tasks in parallel with the proposed circuit.

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

↑