arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.20561cs.LGstat.ML
收藏

提示工程的理论框架:用Transformer提示逼近光滑函数

A Theoretical Framework for Prompt Engineering: Approximating Smooth Functions with Transformer Prompts

Rutgers University(罗格斯大学);Stanford University(斯坦福大学);Harvard University(哈佛大学)

Ryumei Nakada, Wenlong Ji, Tianxi Cai, James Zou, Linjun Zhang

AI总结:

本文提出一个理论框架,证明Transformer在精心设计的提示下可模拟虚拟神经网络,从而以任意精度逼近光滑函数,并为多种提示工程技术提供理论依据,凸显LLMs作为智能体的潜力。

摘要:

提示工程已成为引导大型语言模型(LLMs)产生期望响应的强大技术,显著提升了它们在多种任务上的性能。除了作为静态预测器,LLMs越来越多地充当智能体,具备推理、决策和动态适应复杂环境的能力。然而,提示工程的理论基础在很大程度上仍未得到探索。在本文中,我们引入了一个形式化框架,证明当提供精心设计的提示时,Transformer模型可以在推理过程中通过模拟一个“虚拟”神经网络来充当可配置的计算系统。具体而言,输入提示有效地转化为相应的网络配置,使LLMs能够动态调整其内部计算。基于这一构造,我们建立了关于β次可微函数的逼近理论,证明在适当结构的提示引导下,Transformer可以以任意精度逼近此类函数。此外,我们的框架为若干经验上成功的提示工程技术提供了理论依据,包括使用更长、结构化的提示,过滤无关信息,增强提示令牌多样性,以及利用多智能体交互。通过将LLMs视为适应性智能体而非静态模型,我们的发现强调了它们在自主推理和问题解决方面的潜力,为提示工程和AI智能体设计中更稳健且具有理论基础的进展铺平了道路。

英文摘要:

Prompt engineering has emerged as a powerful technique for guiding large language models (LLMs) toward desired responses, significantly enhancing their performance across diverse tasks. Beyond their role as static predictors, LLMs increasingly function as intelligent agents, capable of reasoning, decision-making, and adapting dynamically to complex environments. However, the theoretical underpinnings of prompt engineering remain largely unexplored. In this paper, we introduce a formal framework demonstrating that transformer models, when provided with carefully designed prompts, can act as a configurable computational system by emulating a ``virtual'' neural network during inference. Specifically, input prompts effectively translate into the corresponding network configuration, enabling LLMs to adjust their internal computations dynamically. Building on this construction, we establish an approximation theory for $β$-times differentiable functions, proving that transformers can approximate such functions with arbitrary precision when guided by appropriately structured prompts. Moreover, our framework provides theoretical justification for several empirically successful prompt engineering techniques, including the use of longer, structured prompts, filtering irrelevant information, enhancing prompt token diversity, and leveraging multi-agent interactions. By framing LLMs as adaptable agents rather than static models, our findings underscore their potential for autonomous reasoning and problem-solving, paving the way for more robust and theoretically grounded advancements in prompt engineering and AI agent design.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑