Transformers as Support Vector Machines. Tarzanagh, D. A., Li, Y., Thrampoulidis, C., & Oymak, S. September, 2023. arXiv:2308.16898 [cs, math]
Paper abstract bibtex Since its inception in “Attention Is All You Need”, the transformer architecture has led to revolutionary advancements in natural language processing. The attention layer within the transformer admits a sequence of input tokens X and makes them interact through pairwise similarities computed as softmax(XQK⊤ X⊤), where (K, Q) are the trainable key-query parameters. In this work, we establish a formal equivalence between the optimization geometry of self-attention and a hard-margin SVM problem that separates optimal input tokens from non-optimal tokens using linear constraints on the outer-products of token pairs. This formalism builds on [TLZO23] and allows us to characterize the implicit bias of 1-layer transformers optimized with gradient descent, as follows. (1) Optimizing the attention layer, parameterized by (K, Q), with vanishing regularization, converges in direction to an SVM solution minimizing the nuclear norm of the combined parameter W := KQ⊤. Instead, directly parameterizing by W minimizes a Frobenius norm SVM objective. We characterize this convergence, highlighting that it can occur in locally-optimal directions rather than global ones. (2) Complementing this, for W-parameterization, we prove the local/global directional convergence of gradient descent under suitable geometric conditions. Importantly, we show that over-parameterization catalyzes global convergence by ensuring the feasibility of the SVM problem and by guaranteeing a benign optimization landscape devoid of stationary points. (3) While our theory applies primarily to linear prediction heads, we propose a more general SVM equivalence that predicts the implicit bias of 1-layer transformers with nonlinear heads/MLPs. Our findings apply to general datasets, trivially extend to cross-attention layer, and their practical validity is verified via thorough numerical experiments. We also introduce open problems and future research directions. We believe these findings inspire a new perspective, interpreting multilayer transformers as a hierarchy of SVMs that separates and selects optimal tokens.
@misc{tarzanagh_transformers_2023,
title = {Transformers as {Support} {Vector} {Machines}},
url = {http://arxiv.org/abs/2308.16898},
abstract = {Since its inception in “Attention Is All You Need”, the transformer architecture has led to revolutionary advancements in natural language processing. The attention layer within the transformer admits a sequence of input tokens X and makes them interact through pairwise similarities computed as softmax(XQK⊤ X⊤), where (K, Q) are the trainable key-query parameters. In this work, we establish a formal equivalence between the optimization geometry of self-attention and a hard-margin SVM problem that separates optimal input tokens from non-optimal tokens using linear constraints on the outer-products of token pairs. This formalism builds on [TLZO23] and allows us to characterize the implicit bias of 1-layer transformers optimized with gradient descent, as follows. (1) Optimizing the attention layer, parameterized by (K, Q), with vanishing regularization, converges in direction to an SVM solution minimizing the nuclear norm of the combined parameter W := KQ⊤. Instead, directly parameterizing by W minimizes a Frobenius norm SVM objective. We characterize this convergence, highlighting that it can occur in locally-optimal directions rather than global ones. (2) Complementing this, for W-parameterization, we prove the local/global directional convergence of gradient descent under suitable geometric conditions. Importantly, we show that over-parameterization catalyzes global convergence by ensuring the feasibility of the SVM problem and by guaranteeing a benign optimization landscape devoid of stationary points. (3) While our theory applies primarily to linear prediction heads, we propose a more general SVM equivalence that predicts the implicit bias of 1-layer transformers with nonlinear heads/MLPs. Our findings apply to general datasets, trivially extend to cross-attention layer, and their practical validity is verified via thorough numerical experiments. We also introduce open problems and future research directions. We believe these findings inspire a new perspective, interpreting multilayer transformers as a hierarchy of SVMs that separates and selects optimal tokens.},
language = {en},
urldate = {2023-11-10},
publisher = {arXiv},
author = {Tarzanagh, Davoud Ataee and Li, Yingcong and Thrampoulidis, Christos and Oymak, Samet},
month = sep,
year = {2023},
note = {arXiv:2308.16898 [cs, math]},
keywords = {/unread, Computer Science - Artificial Intelligence, Computer Science - Computation and Language, Computer Science - Machine Learning, Mathematics - Optimization and Control},
}
Downloads: 0
{"_id":"pRsjt99QHxmb5rYeT","bibbaseid":"tarzanagh-li-thrampoulidis-oymak-transformersassupportvectormachines-2023","author_short":["Tarzanagh, D. A.","Li, Y.","Thrampoulidis, C.","Oymak, S."],"bibdata":{"bibtype":"misc","type":"misc","title":"Transformers as Support Vector Machines","url":"http://arxiv.org/abs/2308.16898","abstract":"Since its inception in “Attention Is All You Need”, the transformer architecture has led to revolutionary advancements in natural language processing. The attention layer within the transformer admits a sequence of input tokens X and makes them interact through pairwise similarities computed as softmax(XQK⊤ X⊤), where (K, Q) are the trainable key-query parameters. In this work, we establish a formal equivalence between the optimization geometry of self-attention and a hard-margin SVM problem that separates optimal input tokens from non-optimal tokens using linear constraints on the outer-products of token pairs. This formalism builds on [TLZO23] and allows us to characterize the implicit bias of 1-layer transformers optimized with gradient descent, as follows. (1) Optimizing the attention layer, parameterized by (K, Q), with vanishing regularization, converges in direction to an SVM solution minimizing the nuclear norm of the combined parameter W := KQ⊤. Instead, directly parameterizing by W minimizes a Frobenius norm SVM objective. We characterize this convergence, highlighting that it can occur in locally-optimal directions rather than global ones. (2) Complementing this, for W-parameterization, we prove the local/global directional convergence of gradient descent under suitable geometric conditions. Importantly, we show that over-parameterization catalyzes global convergence by ensuring the feasibility of the SVM problem and by guaranteeing a benign optimization landscape devoid of stationary points. (3) While our theory applies primarily to linear prediction heads, we propose a more general SVM equivalence that predicts the implicit bias of 1-layer transformers with nonlinear heads/MLPs. Our findings apply to general datasets, trivially extend to cross-attention layer, and their practical validity is verified via thorough numerical experiments. We also introduce open problems and future research directions. We believe these findings inspire a new perspective, interpreting multilayer transformers as a hierarchy of SVMs that separates and selects optimal tokens.","language":"en","urldate":"2023-11-10","publisher":"arXiv","author":[{"propositions":[],"lastnames":["Tarzanagh"],"firstnames":["Davoud","Ataee"],"suffixes":[]},{"propositions":[],"lastnames":["Li"],"firstnames":["Yingcong"],"suffixes":[]},{"propositions":[],"lastnames":["Thrampoulidis"],"firstnames":["Christos"],"suffixes":[]},{"propositions":[],"lastnames":["Oymak"],"firstnames":["Samet"],"suffixes":[]}],"month":"September","year":"2023","note":"arXiv:2308.16898 [cs, math]","keywords":"/unread, Computer Science - Artificial Intelligence, Computer Science - Computation and Language, Computer Science - Machine Learning, Mathematics - Optimization and Control","bibtex":"@misc{tarzanagh_transformers_2023,\n\ttitle = {Transformers as {Support} {Vector} {Machines}},\n\turl = {http://arxiv.org/abs/2308.16898},\n\tabstract = {Since its inception in “Attention Is All You Need”, the transformer architecture has led to revolutionary advancements in natural language processing. The attention layer within the transformer admits a sequence of input tokens X and makes them interact through pairwise similarities computed as softmax(XQK⊤ X⊤), where (K, Q) are the trainable key-query parameters. In this work, we establish a formal equivalence between the optimization geometry of self-attention and a hard-margin SVM problem that separates optimal input tokens from non-optimal tokens using linear constraints on the outer-products of token pairs. This formalism builds on [TLZO23] and allows us to characterize the implicit bias of 1-layer transformers optimized with gradient descent, as follows. (1) Optimizing the attention layer, parameterized by (K, Q), with vanishing regularization, converges in direction to an SVM solution minimizing the nuclear norm of the combined parameter W := KQ⊤. Instead, directly parameterizing by W minimizes a Frobenius norm SVM objective. We characterize this convergence, highlighting that it can occur in locally-optimal directions rather than global ones. (2) Complementing this, for W-parameterization, we prove the local/global directional convergence of gradient descent under suitable geometric conditions. Importantly, we show that over-parameterization catalyzes global convergence by ensuring the feasibility of the SVM problem and by guaranteeing a benign optimization landscape devoid of stationary points. (3) While our theory applies primarily to linear prediction heads, we propose a more general SVM equivalence that predicts the implicit bias of 1-layer transformers with nonlinear heads/MLPs. Our findings apply to general datasets, trivially extend to cross-attention layer, and their practical validity is verified via thorough numerical experiments. We also introduce open problems and future research directions. We believe these findings inspire a new perspective, interpreting multilayer transformers as a hierarchy of SVMs that separates and selects optimal tokens.},\n\tlanguage = {en},\n\turldate = {2023-11-10},\n\tpublisher = {arXiv},\n\tauthor = {Tarzanagh, Davoud Ataee and Li, Yingcong and Thrampoulidis, Christos and Oymak, Samet},\n\tmonth = sep,\n\tyear = {2023},\n\tnote = {arXiv:2308.16898 [cs, math]},\n\tkeywords = {/unread, Computer Science - Artificial Intelligence, Computer Science - Computation and Language, Computer Science - Machine Learning, Mathematics - Optimization and Control},\n}\n\n","author_short":["Tarzanagh, D. A.","Li, Y.","Thrampoulidis, C.","Oymak, S."],"key":"tarzanagh_transformers_2023","id":"tarzanagh_transformers_2023","bibbaseid":"tarzanagh-li-thrampoulidis-oymak-transformersassupportvectormachines-2023","role":"author","urls":{"Paper":"http://arxiv.org/abs/2308.16898"},"keyword":["/unread","Computer Science - Artificial Intelligence","Computer Science - Computation and Language","Computer Science - Machine Learning","Mathematics - Optimization and Control"],"metadata":{"authorlinks":{}},"html":""},"bibtype":"misc","biburl":"https://bibbase.org/zotero/victorjhu","dataSources":["CmHEoydhafhbkXXt5"],"keywords":["/unread","computer science - artificial intelligence","computer science - computation and language","computer science - machine learning","mathematics - optimization and control"],"search_terms":["transformers","support","vector","machines","tarzanagh","li","thrampoulidis","oymak"],"title":"Transformers as Support Vector Machines","year":2023}