Superiority of Multi-Head Attention in In-Context Linear Regression

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Cui, Yingqian, Ren, Jie, He, Pengfei, Tang, Jiliang, Xing, Yue
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866917579097899008
author Cui, Yingqian
Ren, Jie
He, Pengfei
Tang, Jiliang
Xing, Yue
author_facet Cui, Yingqian
Ren, Jie
He, Pengfei
Tang, Jiliang
Xing, Yue
contents We present a theoretical analysis of the performance of transformer with softmax attention in in-context learning with linear regression tasks. While the existing literature predominantly focuses on the convergence of transformers with single-/multi-head attention, our research centers on comparing their performance. We conduct an exact theoretical analysis to demonstrate that multi-head attention with a substantial embedding dimension performs better than single-head attention. When the number of in-context examples D increases, the prediction loss using single-/multi-head attention is in O(1/D), and the one for multi-head attention has a smaller multiplicative constant. In addition to the simplest data distribution setting, we consider more scenarios, e.g., noisy labels, local examples, correlated features, and prior knowledge. We observe that, in general, multi-head attention is preferred over single-head attention. Our results verify the effectiveness of the design of multi-head attention in the transformer architecture.
format Preprint
id arxiv_https___arxiv_org_abs_2401_17426
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Superiority of Multi-Head Attention in In-Context Linear Regression
Cui, Yingqian
Ren, Jie
He, Pengfei
Tang, Jiliang
Xing, Yue
Machine Learning
Artificial Intelligence
We present a theoretical analysis of the performance of transformer with softmax attention in in-context learning with linear regression tasks. While the existing literature predominantly focuses on the convergence of transformers with single-/multi-head attention, our research centers on comparing their performance. We conduct an exact theoretical analysis to demonstrate that multi-head attention with a substantial embedding dimension performs better than single-head attention. When the number of in-context examples D increases, the prediction loss using single-/multi-head attention is in O(1/D), and the one for multi-head attention has a smaller multiplicative constant. In addition to the simplest data distribution setting, we consider more scenarios, e.g., noisy labels, local examples, correlated features, and prior knowledge. We observe that, in general, multi-head attention is preferred over single-head attention. Our results verify the effectiveness of the design of multi-head attention in the transformer architecture.
title Superiority of Multi-Head Attention in In-Context Linear Regression
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2401.17426