Ask, and it shall be given: On the Turing completeness of prompting

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Qiu, Ruizhong, Xu, Zhe, Bao, Wenxuan, Tong, Hanghang
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916623679488000
author Qiu, Ruizhong
Xu, Zhe
Bao, Wenxuan
Tong, Hanghang
author_facet Qiu, Ruizhong
Xu, Zhe
Bao, Wenxuan
Tong, Hanghang
contents Since the success of GPT, large language models (LLMs) have been revolutionizing machine learning and have initiated the so-called LLM prompting paradigm. In the era of LLMs, people train a single general-purpose LLM and provide the LLM with different prompts to perform different tasks. However, such empirical success largely lacks theoretical understanding. Here, we present the first theoretical study on the LLM prompting paradigm to the best of our knowledge. In this work, we show that prompting is in fact Turing-complete: there exists a finite-size Transformer such that for any computable function, there exists a corresponding prompt following which the Transformer computes the function. Furthermore, we show that even though we use only a single finite-size Transformer, it can still achieve nearly the same complexity bounds as that of the class of all unbounded-size Transformers. Overall, our result reveals that prompting can enable a single finite-size Transformer to be efficiently universal, which establishes a theoretical underpinning for prompt engineering in practice.
format Preprint
id arxiv_https___arxiv_org_abs_2411_01992
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Ask, and it shall be given: On the Turing completeness of prompting
Qiu, Ruizhong
Xu, Zhe
Bao, Wenxuan
Tong, Hanghang
Machine Learning
Computational Complexity
Since the success of GPT, large language models (LLMs) have been revolutionizing machine learning and have initiated the so-called LLM prompting paradigm. In the era of LLMs, people train a single general-purpose LLM and provide the LLM with different prompts to perform different tasks. However, such empirical success largely lacks theoretical understanding. Here, we present the first theoretical study on the LLM prompting paradigm to the best of our knowledge. In this work, we show that prompting is in fact Turing-complete: there exists a finite-size Transformer such that for any computable function, there exists a corresponding prompt following which the Transformer computes the function. Furthermore, we show that even though we use only a single finite-size Transformer, it can still achieve nearly the same complexity bounds as that of the class of all unbounded-size Transformers. Overall, our result reveals that prompting can enable a single finite-size Transformer to be efficiently universal, which establishes a theoretical underpinning for prompt engineering in practice.
title Ask, and it shall be given: On the Turing completeness of prompting
topic Machine Learning
Computational Complexity
url https://arxiv.org/abs/2411.01992