In-Context Learning of a Linear Transformer Block: Benefits of the MLP Component and One-Step GD Initialization

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zhang, Ruiqi, Wu, Jingfeng, Bartlett, Peter L.
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916135453065216
author Zhang, Ruiqi
Wu, Jingfeng
Bartlett, Peter L.
author_facet Zhang, Ruiqi
Wu, Jingfeng
Bartlett, Peter L.
contents We study the \emph{in-context learning} (ICL) ability of a \emph{Linear Transformer Block} (LTB) that combines a linear attention component and a linear multi-layer perceptron (MLP) component. For ICL of linear regression with a Gaussian prior and a \emph{non-zero mean}, we show that LTB can achieve nearly Bayes optimal ICL risk. In contrast, using only linear attention must incur an irreducible additive approximation error. Furthermore, we establish a correspondence between LTB and one-step gradient descent estimators with learnable initialization ($\mathsf{GD}\text{-}\mathbfβ$), in the sense that every $\mathsf{GD}\text{-}\mathbfβ$ estimator can be implemented by an LTB estimator and every optimal LTB estimator that minimizes the in-class ICL risk is effectively a $\mathsf{GD}\text{-}\mathbfβ$ estimator. Finally, we show that $\mathsf{GD}\text{-}\mathbfβ$ estimators can be efficiently optimized with gradient flow, despite a non-convex training objective. Our results reveal that LTB achieves ICL by implementing $\mathsf{GD}\text{-}\mathbfβ$, and they highlight the role of MLP layers in reducing approximation error.
format Preprint
id arxiv_https___arxiv_org_abs_2402_14951
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle In-Context Learning of a Linear Transformer Block: Benefits of the MLP Component and One-Step GD Initialization
Zhang, Ruiqi
Wu, Jingfeng
Bartlett, Peter L.
Machine Learning
Computation and Language
We study the \emph{in-context learning} (ICL) ability of a \emph{Linear Transformer Block} (LTB) that combines a linear attention component and a linear multi-layer perceptron (MLP) component. For ICL of linear regression with a Gaussian prior and a \emph{non-zero mean}, we show that LTB can achieve nearly Bayes optimal ICL risk. In contrast, using only linear attention must incur an irreducible additive approximation error. Furthermore, we establish a correspondence between LTB and one-step gradient descent estimators with learnable initialization ($\mathsf{GD}\text{-}\mathbfβ$), in the sense that every $\mathsf{GD}\text{-}\mathbfβ$ estimator can be implemented by an LTB estimator and every optimal LTB estimator that minimizes the in-class ICL risk is effectively a $\mathsf{GD}\text{-}\mathbfβ$ estimator. Finally, we show that $\mathsf{GD}\text{-}\mathbfβ$ estimators can be efficiently optimized with gradient flow, despite a non-convex training objective. Our results reveal that LTB achieves ICL by implementing $\mathsf{GD}\text{-}\mathbfβ$, and they highlight the role of MLP layers in reducing approximation error.
title In-Context Learning of a Linear Transformer Block: Benefits of the MLP Component and One-Step GD Initialization
topic Machine Learning
Computation and Language
url https://arxiv.org/abs/2402.14951