Looped Transformers as Programmable Computers. Giannou, A., Rajput, S., Sohn, J., Lee, K., Lee, J. D., & Papailiopoulos, D. January, 2023. arXiv:2301.13196 [cs]
Paper doi abstract bibtex We present a framework for using transformer networks as universal computers by programming them with specific weights and placing them in a loop. Our input sequence acts as a punchcard, consisting of instructions and memory for data read/writes. We demonstrate that a constant number of encoder layers can emulate basic computing blocks, including embedding edit operations, non-linear functions, function calls, program counters, and conditional branches. Using these building blocks, we emulate a small instruction-set computer. This allows us to map iterative algorithms to programs that can be executed by a looped, 13-layer transformer. We show how this transformer, instructed by its input, can emulate a basic calculator, a basic linear algebra library, and in-context learning algorithms that employ backpropagation. Our work highlights the versatility of the attention mechanism, and demonstrates that even shallow transformers can execute full-fledged, general-purpose programs.
@misc{giannou_looped_2023,
title = {Looped {Transformers} as {Programmable} {Computers}},
url = {http://arxiv.org/abs/2301.13196},
doi = {10.48550/arXiv.2301.13196},
abstract = {We present a framework for using transformer networks as universal computers by programming them with specific weights and placing them in a loop. Our input sequence acts as a punchcard, consisting of instructions and memory for data read/writes. We demonstrate that a constant number of encoder layers can emulate basic computing blocks, including embedding edit operations, non-linear functions, function calls, program counters, and conditional branches. Using these building blocks, we emulate a small instruction-set computer. This allows us to map iterative algorithms to programs that can be executed by a looped, 13-layer transformer. We show how this transformer, instructed by its input, can emulate a basic calculator, a basic linear algebra library, and in-context learning algorithms that employ backpropagation. Our work highlights the versatility of the attention mechanism, and demonstrates that even shallow transformers can execute full-fledged, general-purpose programs.},
urldate = {2025-04-16},
publisher = {arXiv},
author = {Giannou, Angeliki and Rajput, Shashank and Sohn, Jy-yong and Lee, Kangwook and Lee, Jason D. and Papailiopoulos, Dimitris},
month = jan,
year = {2023},
note = {arXiv:2301.13196 [cs]},
keywords = {Computer Science - Artificial Intelligence, Computer Science - Machine Learning},
}
Downloads: 0
{"_id":"rscrEbApkrb4o2Qb2","bibbaseid":"giannou-rajput-sohn-lee-lee-papailiopoulos-loopedtransformersasprogrammablecomputers-2023","author_short":["Giannou, A.","Rajput, S.","Sohn, J.","Lee, K.","Lee, J. D.","Papailiopoulos, D."],"bibdata":{"bibtype":"misc","type":"misc","title":"Looped Transformers as Programmable Computers","url":"http://arxiv.org/abs/2301.13196","doi":"10.48550/arXiv.2301.13196","abstract":"We present a framework for using transformer networks as universal computers by programming them with specific weights and placing them in a loop. Our input sequence acts as a punchcard, consisting of instructions and memory for data read/writes. We demonstrate that a constant number of encoder layers can emulate basic computing blocks, including embedding edit operations, non-linear functions, function calls, program counters, and conditional branches. Using these building blocks, we emulate a small instruction-set computer. This allows us to map iterative algorithms to programs that can be executed by a looped, 13-layer transformer. We show how this transformer, instructed by its input, can emulate a basic calculator, a basic linear algebra library, and in-context learning algorithms that employ backpropagation. Our work highlights the versatility of the attention mechanism, and demonstrates that even shallow transformers can execute full-fledged, general-purpose programs.","urldate":"2025-04-16","publisher":"arXiv","author":[{"propositions":[],"lastnames":["Giannou"],"firstnames":["Angeliki"],"suffixes":[]},{"propositions":[],"lastnames":["Rajput"],"firstnames":["Shashank"],"suffixes":[]},{"propositions":[],"lastnames":["Sohn"],"firstnames":["Jy-yong"],"suffixes":[]},{"propositions":[],"lastnames":["Lee"],"firstnames":["Kangwook"],"suffixes":[]},{"propositions":[],"lastnames":["Lee"],"firstnames":["Jason","D."],"suffixes":[]},{"propositions":[],"lastnames":["Papailiopoulos"],"firstnames":["Dimitris"],"suffixes":[]}],"month":"January","year":"2023","note":"arXiv:2301.13196 [cs]","keywords":"Computer Science - Artificial Intelligence, Computer Science - Machine Learning","bibtex":"@misc{giannou_looped_2023,\n\ttitle = {Looped {Transformers} as {Programmable} {Computers}},\n\turl = {http://arxiv.org/abs/2301.13196},\n\tdoi = {10.48550/arXiv.2301.13196},\n\tabstract = {We present a framework for using transformer networks as universal computers by programming them with specific weights and placing them in a loop. Our input sequence acts as a punchcard, consisting of instructions and memory for data read/writes. We demonstrate that a constant number of encoder layers can emulate basic computing blocks, including embedding edit operations, non-linear functions, function calls, program counters, and conditional branches. Using these building blocks, we emulate a small instruction-set computer. This allows us to map iterative algorithms to programs that can be executed by a looped, 13-layer transformer. We show how this transformer, instructed by its input, can emulate a basic calculator, a basic linear algebra library, and in-context learning algorithms that employ backpropagation. Our work highlights the versatility of the attention mechanism, and demonstrates that even shallow transformers can execute full-fledged, general-purpose programs.},\n\turldate = {2025-04-16},\n\tpublisher = {arXiv},\n\tauthor = {Giannou, Angeliki and Rajput, Shashank and Sohn, Jy-yong and Lee, Kangwook and Lee, Jason D. and Papailiopoulos, Dimitris},\n\tmonth = jan,\n\tyear = {2023},\n\tnote = {arXiv:2301.13196 [cs]},\n\tkeywords = {Computer Science - Artificial Intelligence, Computer Science - Machine Learning},\n}\n\n","author_short":["Giannou, A.","Rajput, S.","Sohn, J.","Lee, K.","Lee, J. D.","Papailiopoulos, D."],"key":"giannou_looped_2023","id":"giannou_looped_2023","bibbaseid":"giannou-rajput-sohn-lee-lee-papailiopoulos-loopedtransformersasprogrammablecomputers-2023","role":"author","urls":{"Paper":"http://arxiv.org/abs/2301.13196"},"keyword":["Computer Science - Artificial Intelligence","Computer Science - Machine Learning"],"metadata":{"authorlinks":{}}},"bibtype":"misc","biburl":"https://api.zotero.org/users/15655889/collections/UX4VWFWZ/items?key=MzHVK1tHvHTcC946y3GIaoco&format=bibtex&limit=100","dataSources":["3gTBYW5YxtNcnhN2g","AX3fiSG9gtBuegYX9","MpmemwLeQzDcKDq6x"],"keywords":["computer science - artificial intelligence","computer science - machine learning"],"search_terms":["looped","transformers","programmable","computers","giannou","rajput","sohn","lee","lee","papailiopoulos"],"title":"Looped Transformers as Programmable Computers","year":2023}