Pascal Bergsträßer, Chris Köcher, Anthony Widjaja Lin, Georg Zetzsche
{"title":"The Power of Hard Attention Transformers on Data Sequences: A Formal Language Theoretic Perspective","authors":"Pascal Bergsträßer, Chris Köcher, Anthony Widjaja Lin, Georg Zetzsche","doi":"arxiv-2405.16166","DOIUrl":null,"url":null,"abstract":"Formal language theory has recently been successfully employed to unravel the\npower of transformer encoders. This setting is primarily applicable in Natural\nLanguange Processing (NLP), as a token embedding function (where a bounded\nnumber of tokens is admitted) is first applied before feeding the input to the\ntransformer. On certain kinds of data (e.g. time series), we want our\ntransformers to be able to handle \\emph{arbitrary} input sequences of numbers\n(or tuples thereof) without \\emph{a priori} limiting the values of these\nnumbers. In this paper, we initiate the study of the expressive power of\ntransformer encoders on sequences of data (i.e. tuples of numbers). Our results\nindicate an increase in expressive power of hard attention transformers over\ndata sequences, in stark contrast to the case of strings. In particular, we\nprove that Unique Hard Attention Transformers (UHAT) over inputs as data\nsequences no longer lie within the circuit complexity class $AC^0$ (even\nwithout positional encodings), unlike the case of string inputs, but are still\nwithin the complexity class $TC^0$ (even with positional encodings). Over\nstrings, UHAT without positional encodings capture only regular languages. In\ncontrast, we show that over data sequences UHAT can capture non-regular\nproperties. Finally, we show that UHAT capture languages definable in an\nextension of linear temporal logic with unary numeric predicates and\narithmetics.","PeriodicalId":501124,"journal":{"name":"arXiv - CS - Formal Languages and Automata Theory","volume":"46 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-05-25","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Formal Languages and Automata Theory","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2405.16166","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
Formal language theory has recently been successfully employed to unravel the
power of transformer encoders. This setting is primarily applicable in Natural
Languange Processing (NLP), as a token embedding function (where a bounded
number of tokens is admitted) is first applied before feeding the input to the
transformer. On certain kinds of data (e.g. time series), we want our
transformers to be able to handle \emph{arbitrary} input sequences of numbers
(or tuples thereof) without \emph{a priori} limiting the values of these
numbers. In this paper, we initiate the study of the expressive power of
transformer encoders on sequences of data (i.e. tuples of numbers). Our results
indicate an increase in expressive power of hard attention transformers over
data sequences, in stark contrast to the case of strings. In particular, we
prove that Unique Hard Attention Transformers (UHAT) over inputs as data
sequences no longer lie within the circuit complexity class $AC^0$ (even
without positional encodings), unlike the case of string inputs, but are still
within the complexity class $TC^0$ (even with positional encodings). Over
strings, UHAT without positional encodings capture only regular languages. In
contrast, we show that over data sequences UHAT can capture non-regular
properties. Finally, we show that UHAT capture languages definable in an
extension of linear temporal logic with unary numeric predicates and
arithmetics.