On the Optimization and Generalization of Two-layer Transformers with Sign Gradient Descent

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Li, Bingrui, Huang, Wei, Han, Andi, Zhou, Zhanpeng, Suzuki, Taiji, Zhu, Jun, Chen, Jianfei
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866917941760491520
author Li, Bingrui
Huang, Wei
Han, Andi
Zhou, Zhanpeng
Suzuki, Taiji
Zhu, Jun
Chen, Jianfei
author_facet Li, Bingrui
Huang, Wei
Han, Andi
Zhou, Zhanpeng
Suzuki, Taiji
Zhu, Jun
Chen, Jianfei
contents The Adam optimizer is widely used for transformer optimization in practice, which makes understanding the underlying optimization mechanisms an important problem. However, due to the Adam's complexity, theoretical analysis of how it optimizes transformers remains a challenging task. Fortunately, Sign Gradient Descent (SignGD) serves as an effective surrogate for Adam. Despite its simplicity, theoretical understanding of how SignGD optimizes transformers still lags behind. In this work, we study how SignGD optimizes a two-layer transformer -- consisting of a softmax attention layer with trainable query-key parameterization followed by a linear layer -- on a linearly separable noisy dataset. We identify four stages in the training dynamics, each exhibiting intriguing behaviors. Based on the training dynamics, we prove the fast convergence but poor generalization of the learned transformer on the noisy dataset. We also show that Adam behaves similarly to SignGD in terms of both optimization and generalization in this setting. Additionally, we find that the poor generalization of SignGD is not solely due to data noise, suggesting that both SignGD and Adam requires high-quality data for real-world tasks. Finally, experiments on synthetic and real-world datasets empirically support our theoretical results.
format Preprint
id arxiv_https___arxiv_org_abs_2410_04870
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle On the Optimization and Generalization of Two-layer Transformers with Sign Gradient Descent
Li, Bingrui
Huang, Wei
Han, Andi
Zhou, Zhanpeng
Suzuki, Taiji
Zhu, Jun
Chen, Jianfei
Machine Learning
The Adam optimizer is widely used for transformer optimization in practice, which makes understanding the underlying optimization mechanisms an important problem. However, due to the Adam's complexity, theoretical analysis of how it optimizes transformers remains a challenging task. Fortunately, Sign Gradient Descent (SignGD) serves as an effective surrogate for Adam. Despite its simplicity, theoretical understanding of how SignGD optimizes transformers still lags behind. In this work, we study how SignGD optimizes a two-layer transformer -- consisting of a softmax attention layer with trainable query-key parameterization followed by a linear layer -- on a linearly separable noisy dataset. We identify four stages in the training dynamics, each exhibiting intriguing behaviors. Based on the training dynamics, we prove the fast convergence but poor generalization of the learned transformer on the noisy dataset. We also show that Adam behaves similarly to SignGD in terms of both optimization and generalization in this setting. Additionally, we find that the poor generalization of SignGD is not solely due to data noise, suggesting that both SignGD and Adam requires high-quality data for real-world tasks. Finally, experiments on synthetic and real-world datasets empirically support our theoretical results.
title On the Optimization and Generalization of Two-layer Transformers with Sign Gradient Descent
topic Machine Learning
url https://arxiv.org/abs/2410.04870