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

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Xing, Yue, Lin, Xiaofeng, Xu, Chenheng, Suh, Namjoon, Song, Qifan, Cheng, Guang
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866913396298874880
author Xing, Yue
Lin, Xiaofeng
Xu, Chenheng
Suh, Namjoon
Song, Qifan
Cheng, Guang
author_facet Xing, Yue
Lin, Xiaofeng
Xu, Chenheng
Suh, Namjoon
Song, Qifan
Cheng, Guang
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2402_00743
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Theoretical Understanding of In-Context Learning in Shallow Transformers with Unstructured Data
Xing, Yue
Lin, Xiaofeng
Xu, Chenheng
Suh, Namjoon
Song, Qifan
Cheng, Guang
Machine Learning
Computation and Language
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.
title Theoretical Understanding of In-Context Learning in Shallow Transformers with Unstructured Data
topic Machine Learning
Computation and Language
url https://arxiv.org/abs/2402.00743