The Power of Hard Attention Transformers on Data Sequences: A Formal Language Theoretic Perspective

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Bergsträßer, Pascal, Köcher, Chris, Lin, Anthony Widjaja, Zetzsche, Georg
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866915014741327872
author Bergsträßer, Pascal
Köcher, Chris
Lin, Anthony Widjaja
Zetzsche, Georg
author_facet Bergsträßer, Pascal
Köcher, Chris
Lin, Anthony Widjaja
Zetzsche, Georg
contents Formal language theory has recently been successfully employed to unravel the power of transformer encoders. This setting is primarily applicable in Natural Language 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 arbitrary input sequences of numbers (or tuples thereof) without 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.
format Preprint
id arxiv_https___arxiv_org_abs_2405_16166
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle The Power of Hard Attention Transformers on Data Sequences: A Formal Language Theoretic Perspective
Bergsträßer, Pascal
Köcher, Chris
Lin, Anthony Widjaja
Zetzsche, Georg
Formal Languages and Automata Theory
Formal language theory has recently been successfully employed to unravel the power of transformer encoders. This setting is primarily applicable in Natural Language 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 arbitrary input sequences of numbers (or tuples thereof) without 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.
title The Power of Hard Attention Transformers on Data Sequences: A Formal Language Theoretic Perspective
topic Formal Languages and Automata Theory
url https://arxiv.org/abs/2405.16166