Saved in:
Bibliographic Details
Main Authors: Strobl, Lena, Angluin, Dana, Chiang, David, Rawski, Jonathan, Sabharwal, Ashish
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2404.02040
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912106554589184
author Strobl, Lena
Angluin, Dana
Chiang, David
Rawski, Jonathan
Sabharwal, Ashish
author_facet Strobl, Lena
Angluin, Dana
Chiang, David
Rawski, Jonathan
Sabharwal, Ashish
contents We study the sequence-to-sequence mapping capacity of transformers by relating them to finite transducers, and find that they can express surprisingly large classes of transductions. We do so using variants of RASP, a programming language designed to help people "think like transformers," as an intermediate representation. We extend the existing Boolean variant B-RASP to sequence-to-sequence functions and show that it computes exactly the first-order rational functions (such as string rotation). Then, we introduce two new extensions. B-RASP[pos] enables calculations on positions (such as copying the first half of a string) and contains all first-order regular functions. S-RASP adds prefix sum, which enables additional arithmetic operations (such as squaring a string) and contains all first-order polyregular functions. Finally, we show that masked average-hard attention transformers can simulate S-RASP.
format Preprint
id arxiv_https___arxiv_org_abs_2404_02040
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Transformers as Transducers
Strobl, Lena
Angluin, Dana
Chiang, David
Rawski, Jonathan
Sabharwal, Ashish
Formal Languages and Automata Theory
Machine Learning
We study the sequence-to-sequence mapping capacity of transformers by relating them to finite transducers, and find that they can express surprisingly large classes of transductions. We do so using variants of RASP, a programming language designed to help people "think like transformers," as an intermediate representation. We extend the existing Boolean variant B-RASP to sequence-to-sequence functions and show that it computes exactly the first-order rational functions (such as string rotation). Then, we introduce two new extensions. B-RASP[pos] enables calculations on positions (such as copying the first half of a string) and contains all first-order regular functions. S-RASP adds prefix sum, which enables additional arithmetic operations (such as squaring a string) and contains all first-order polyregular functions. Finally, we show that masked average-hard attention transformers can simulate S-RASP.
title Transformers as Transducers
topic Formal Languages and Automata Theory
Machine Learning
url https://arxiv.org/abs/2404.02040