Saved in:
Bibliographic Details
Main Authors: Zhang, Yufeng, Liu, Boyi, Cai, Qi, Wang, Lingxiao, Wang, Zhaoran
Format: Preprint
Published: 2022
Subjects:
Online Access:https://arxiv.org/abs/2212.14852
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916184528519168
author Zhang, Yufeng
Liu, Boyi
Cai, Qi
Wang, Lingxiao
Wang, Zhaoran
author_facet Zhang, Yufeng
Liu, Boyi
Cai, Qi
Wang, Lingxiao
Wang, Zhaoran
contents With the attention mechanism, transformers achieve significant empirical successes. Despite the intuitive understanding that transformers perform relational inference over long sequences to produce desirable representations, we lack a rigorous theory on how the attention mechanism achieves it. In particular, several intriguing questions remain open: (a) What makes a desirable representation? (b) How does the attention mechanism infer the desirable representation within the forward pass? (c) How does a pretraining procedure learn to infer the desirable representation through the backward pass? We observe that, as is the case in BERT and ViT, input tokens are often exchangeable since they already include positional encodings. The notion of exchangeability induces a latent variable model that is invariant to input sizes, which enables our theoretical analysis. - To answer (a) on representation, we establish the existence of a sufficient and minimal representation of input tokens. In particular, such a representation instantiates the posterior distribution of the latent variable given input tokens, which plays a central role in predicting output labels and solving downstream tasks. - To answer (b) on inference, we prove that attention with the desired parameter infers the latent posterior up to an approximation error, which is decreasing in input sizes. In detail, we quantify how attention approximates the conditional mean of the value given the key, which characterizes how it performs relational inference over long sequences. - To answer (c) on learning, we prove that both supervised and self-supervised objectives allow empirical risk minimization to learn the desired parameter up to a generalization error, which is independent of input sizes. Particularly, in the self-supervised setting, we identify a condition number that is pivotal to solving downstream tasks.
format Preprint
id arxiv_https___arxiv_org_abs_2212_14852
institution arXiv
publishDate 2022
record_format arxiv
spellingShingle An Analysis of Attention via the Lens of Exchangeability and Latent Variable Models
Zhang, Yufeng
Liu, Boyi
Cai, Qi
Wang, Lingxiao
Wang, Zhaoran
Machine Learning
With the attention mechanism, transformers achieve significant empirical successes. Despite the intuitive understanding that transformers perform relational inference over long sequences to produce desirable representations, we lack a rigorous theory on how the attention mechanism achieves it. In particular, several intriguing questions remain open: (a) What makes a desirable representation? (b) How does the attention mechanism infer the desirable representation within the forward pass? (c) How does a pretraining procedure learn to infer the desirable representation through the backward pass? We observe that, as is the case in BERT and ViT, input tokens are often exchangeable since they already include positional encodings. The notion of exchangeability induces a latent variable model that is invariant to input sizes, which enables our theoretical analysis. - To answer (a) on representation, we establish the existence of a sufficient and minimal representation of input tokens. In particular, such a representation instantiates the posterior distribution of the latent variable given input tokens, which plays a central role in predicting output labels and solving downstream tasks. - To answer (b) on inference, we prove that attention with the desired parameter infers the latent posterior up to an approximation error, which is decreasing in input sizes. In detail, we quantify how attention approximates the conditional mean of the value given the key, which characterizes how it performs relational inference over long sequences. - To answer (c) on learning, we prove that both supervised and self-supervised objectives allow empirical risk minimization to learn the desired parameter up to a generalization error, which is independent of input sizes. Particularly, in the self-supervised setting, we identify a condition number that is pivotal to solving downstream tasks.
title An Analysis of Attention via the Lens of Exchangeability and Latent Variable Models
topic Machine Learning
url https://arxiv.org/abs/2212.14852