The rise of large language models (LLMs) has introduced a new type of programming: natural language programming. Users write prompts, which are instructions in natural language, to direct LLMs to perform tasks such as natural language processing, code generation, reasoning, etc. An emerging area of research enables interoperability between prompts and programs. We present a novel programming abstraction, shared program state, that removes the manual work required to enable interoperability between prompts and program states. With shared program state, programmers can write prompts that directly access program variables, compute with program objects, and implement control flow in the program. We present a schema for specifying natural function interfaces that extend programming systems to support programs with prompts and leverage this schema to specify shared program state as a natural function interface. We implement shared program state in the Nightjar programming system. Nightjar enables programmers to write Python programs containing prompts that share the Python program state. We show that Nightjar programs achieve comparable or higher task accuracy than manually written implementations (+4-19%), while decreasing the lines of code by 39.6% on average. The tradeoff is that Nightjar may incur runtime overhead (0.4-4.3x manual implementations).


翻译:大型语言模型(LLM)的兴起催生了一种新型编程范式:自然语言编程。用户通过编写自然语言指令形式的提示(prompts)来引导LLM执行自然语言处理、代码生成、推理等任务。一个新兴的研究领域致力于实现提示与程序之间的互操作性。本文提出一种新颖的编程抽象——共享程序状态,该抽象消除了实现提示与程序状态互操作性所需的手动工作。借助共享程序状态,程序员能够编写直接访问程序变量、使用程序对象进行计算并在程序中实现控制流的提示。我们提出一种用于规范自然函数接口的框架,该框架可扩展编程系统以支持包含提示的程序,并利用此框架将共享程序状态定义为一种自然函数接口。我们在Nightjar编程系统中实现了共享程序状态。Nightjar使程序员能够编写包含提示的Python程序,这些提示可共享Python程序状态。实验表明,Nightjar程序在任务准确率上达到甚至超过手动编写的实现(提升4-19%),同时平均减少39.6%的代码行数。其代价是Nightjar可能产生运行时开销(达到手动实现的0.4-4.3倍)。

0
下载
关闭预览

相关内容

人们为了让计算机解决各种棘手的问题,使用编程语言 编写程序代码并通过计算机运算得到最终结果的过程。
《多模态大语言模型视觉提示》综述
专知会员服务
36+阅读 · 2024年9月25日
大语言模型中的提示隐私保护
专知会员服务
24+阅读 · 2024年7月24日
大型语言模型的高效提示方法综述
专知会员服务
75+阅读 · 2024年4月2日
大型语言模型中提示工程的系统综述:技术与应用
专知会员服务
81+阅读 · 2024年2月15日
如何提示?浙大最新《大型语言模型提示框架》综述
专知会员服务
83+阅读 · 2023年11月23日
自然语言生成资源列表
专知
17+阅读 · 2020年1月4日
一文带你读懂自然语言处理 - 事件提取
AI研习社
10+阅读 · 2019年5月10日
强化学习与文本生成
微信AI
41+阅读 · 2019年4月4日
NLP-Progress记录NLP最新数据集、论文和代码: 助你紧跟NLP前沿
中国人工智能学会
12+阅读 · 2018年11月15日
自然语言处理中的语言模型预训练方法
PaperWeekly
14+阅读 · 2018年10月21日
自然语言处理顶会EMNLP2018接受论文列表!
专知
87+阅读 · 2018年8月26日
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
9+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
36+阅读 · 2013年12月31日
VIP会员
最新内容
《人工智能时代的国防工业政策》
专知会员服务
3+阅读 · 今天2:39
《2026年美国/以色列-伊朗冲突》
专知会员服务
5+阅读 · 今天1:30
《美国与伊朗的冲突》美国会服务处报告
专知会员服务
5+阅读 · 今天1:27
美国对伊朗军事行动:弹药与反导
专知会员服务
5+阅读 · 今天1:25
超越技术:伊朗冲突中的“战争方式”
专知会员服务
12+阅读 · 4月1日
军事决策大语言模型综合评价基准
专知会员服务
10+阅读 · 4月1日
《美军混合航空器军用适航认证路线图》84页
专知会员服务
7+阅读 · 4月1日
相关VIP内容
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
9+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
36+阅读 · 2013年12月31日
Top
微信扫码咨询专知VIP会员