arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2402.00743cs.LGcs.CLstat.ML
收藏

面向非结构化数据的浅层Transformer上下文学习的理论理解

Theoretical Understanding of In-Context Learning in Shallow Transformers with Unstructured Data

Michigan State University(密歇根州立大学);University of California Los Angeles(加州大学洛杉矶分校);Purdue University(普渡大学)

Yue Xing, Xiaofeng Lin, Chenheng Xu, Namjoon Suh, Qifan Song, Guang Cheng

AI总结:

本文针对现有ICL理论仅适用于结构化数据的局限,通过浅层Transformer与线性回归任务的理论分析,揭示了双层注意力与位置编码在非结构化数据ICL中的关键作用。

摘要:

大语言模型(LLMs)是一类强大的模型,能够在推理阶段通过上下文学习(ICL)习得概念。现有理论研究(如zhang2023trained的工作)虽尝试解释ICL的机制,但均假设每个示例的输入$x_i$和输出$y_i$位于同一token中(即结构化数据)。然而在实际场景中,示例通常为文本输入,所有词汇无论逻辑关系如何都存储在不同token中(即非结构化数据,参见wibisono2023role的研究)。为理解LLMs如何在ICL中从非结构化数据学习,本文研究了Transformer架构各组件的作用,为该架构的有效性提供理论解释。具体而言,我们采用含1-2层注意力的简单Transformer,针对线性回归任务开展ICL预测研究。研究发现:(1)带有前瞻注意力掩码的两层(自)注意力Transformer可从非结构化数据的提示中学习;(2)位置编码能够匹配$x_i$与$y_i$ token,从而实现更优的ICL性能。

英文摘要:

Large language models (LLMs) are powerful models that can learn concepts at the inference stage via in-context learning (ICL). While theoretical studies, e.g., \cite{zhang2023trained}, attempt to explain the mechanism of ICL, they assume the input $x_i$ and the output $y_i$ of each demonstration example are in the same token (i.e., structured data). However, in real practice, the examples are usually text input, and all words, regardless of their logic relationship, are stored in different tokens (i.e., unstructured data \cite{wibisono2023role}). To understand how LLMs learn from the unstructured data in ICL, this paper studies the role of each component in the transformer architecture and provides a theoretical understanding to explain the success of the architecture. In particular, we consider a simple transformer with one/two attention layers and linear regression tasks for the ICL prediction. We observe that (1) a transformer with two layers of (self-)attentions with a look-ahead attention mask can learn from the prompt in the unstructured data, and (2) positional encoding can match the $x_i$ and $y_i$ tokens to achieve a better ICL performance.

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

↑