计算机科学 > 形式语言与自动机理论
[提交于 2024年11月7日]
标题:Transformers as Transducers
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要: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.
提交历史
来自:David Chiang[v1] 2024年11月7日 星期四 00:00:00 UTC