Imprompt:一种用于提示编程的语言框架
Imprompt: A Language Framework for Prompt Programming
中文总结 AI 辅助
该研究针对现有提示编程框架的问题,提出Imprompt语言框架。通过基础研究、结构化提示阐释、定义编译器、探索类型化概念等方法,实现编译器和类型检查器并评估,为提示编程领域贡献编程语言基础。
中文摘要 AI 辅助
随着语言模型取得前所未有的成功,提示工程学发展出了强大的提示编程理念,即将提示视为用于描述复杂任务和利用语言模型能力的可编程控制面。然而,现有的提示编程框架存在各种复杂性和不优雅之处,难以在实践中有效描述任务。我们提出了Imprompt,一种用于提示编程研究和实践的新语言框架。我们对提示编程进行了基础研究,认为提示程序必须只包含任务描述,且与低级“执行”细节解耦。我们通过将结构化提示阐释为提示编程与提示程序“编译”的结合来进一步阐述这一观点,并通过为Imprompt程序正式定义两个编译器来举例说明。然后我们探索提示程序的类型化概念,并建立类型检查与受限解码之间的对应关系。最后,我们实现了编译器和类型检查器,并在各种案例研究中对它们进行评估。我们相信我们的工作为新兴的提示编程领域贡献了编程语言基础。
英文摘要
With the unprecedented success of Language Models (LMs), the science of Prompt Engineering has evolved the powerful idea of Prompt Programming, where prompts are treated as a programmable control surface for describing complex tasks and leveraging LM capabilities. However, existing prompt programming frameworks suffer from various complexities and inelegances, which make them hard to utilize in practice for effectively describing tasks. We propose Imprompt, a new language framework for the study and practice of prompt programming. We undertake a foundational investigation of prompt programming, and contend that prompt programs must contain only the task descriptions and must be decoupled from lower-level 'execution' details. We further develop this position by illustrating structured prompting as a combination of prompt programming and prompt program 'compilation'. We exemplify this view by formally defining two compilers for Imprompt programs. We then explore the idea of typing for prompt programs and draw a correspondence between type checking and constrained decoding. Finally, we implement our compilers and type checkers and evaluate them on a variety of case studies. We believe our work contributes programming-language foundations toward the emerging area of prompt programming.