Prompting Is Programming: A Query Language for Large Language Models

RDF查询语言 计算机科学 数据控制语言 查询语言 程序设计语言 第一代程序设计语言 查询优化 程序设计语言规范 对象查询语言 自然语言处理 人工智能 Web搜索查询 程序设计范式 按示例查询 情报检索 Web查询分类 程序设计域 归纳程序设计 搜索引擎
作者
Luca Beurer-Kellner,M. Fischer,Martin Vechev
出处
期刊:Proceedings of the ACM on programming languages [Association for Computing Machinery]
卷期号:7 (PLDI): 1946-1969 被引量:53
标识
DOI:10.1145/3591300
摘要

Large language models have demonstrated outstanding performance on a wide range of tasks such as question answering and code generation. On a high level, given an input, a language model can be used to automatically complete the sequence in a statistically-likely way. Based on this, users prompt these models with language instructions or examples, to implement a variety of downstream tasks. Advanced prompting methods can even imply interaction between the language model, a user, and external tools such as calculators. However, to obtain state-of-the-art performance or adapt language models for specific tasks, complex task- and model-specific programs have to be implemented, which may still require ad-hoc interaction. Based on this, we present the novel idea of Language Model Programming (LMP). LMP generalizes language model prompting from pure text prompts to an intuitive combination of text prompting and scripting. Additionally, LMP allows constraints to be specified over the language model output. This enables easy adaption to many tasks while abstracting language model internals and providing high-level semantics. To enable LMP, we implement LMQL(short for Language Model Query Language), which leverages the constraints and control flow from an LMP prompt to generate an efficient inference procedure that minimizes the number of expensive calls to the underlying language model. We show that LMQL can capture a wide range of state-of-the-art prompting methods in an intuitive way, especially facilitating interactive flows that are challenging to implement with existing high-level APIs. Our evaluation shows that we retain or increase the accuracy on several downstream tasks, while also significantly reducing the required amount of computation or cost in the case of pay-to-use APIs (26-85% cost savings).
最长约 10秒,即可获得该文献文件

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
高挑的小蕊完成签到,获得积分10
1秒前
脑洞疼应助任慧娟采纳,获得10
1秒前
1秒前
王道远发布了新的文献求助10
1秒前
BuSihan完成签到 ,获得积分10
2秒前
守护完成签到,获得积分10
2秒前
王乐安完成签到,获得积分10
2秒前
拼搏向上发布了新的文献求助10
2秒前
2秒前
星星发布了新的文献求助10
2秒前
无花果应助zj1900采纳,获得10
2秒前
能干雁凡发布了新的文献求助10
3秒前
IMF完成签到,获得积分10
3秒前
3秒前
3秒前
3秒前
大个应助程程采纳,获得10
3秒前
苏沐秋秋完成签到,获得积分10
3秒前
李兴雅完成签到,获得积分10
3秒前
万能图书馆应助nini采纳,获得10
4秒前
Takagi发布了新的文献求助20
4秒前
ii发布了新的文献求助10
4秒前
4秒前
小崽总完成签到,获得积分10
4秒前
5秒前
丘比特应助aaron采纳,获得10
5秒前
Jerry完成签到,获得积分10
5秒前
丑鸭发布了新的文献求助10
5秒前
功不唐捐发布了新的文献求助10
5秒前
整齐醉冬完成签到,获得积分10
5秒前
茶壶喝茶发布了新的文献求助10
6秒前
xiaohu发布了新的文献求助10
7秒前
LDG完成签到,获得积分10
7秒前
Balance Man完成签到 ,获得积分10
7秒前
ZQZ完成签到,获得积分10
8秒前
8秒前
8秒前
9秒前
DD发布了新的文献求助10
9秒前
阿司匹林发布了新的文献求助10
9秒前
高分求助中
(应助此贴封号)【重要!!请各用户(尤其是新用户)详细阅读】【科研通的精品贴汇总】 10000
晶种分解过程与铝酸钠溶液混合强度关系的探讨 8888
Les Mantodea de Guyane Insecta, Polyneoptera 2000
The Organometallic Chemistry of the Transition Metals 800
Leading Academic-Practice Partnerships in Nursing and Healthcare: A Paradigm for Change 800
Signals, Systems, and Signal Processing 610
The formation of Australian attitudes towards China, 1918-1941 600
热门求助领域 (近24小时)
化学 材料科学 医学 生物 纳米技术 工程类 有机化学 化学工程 生物化学 计算机科学 物理 内科学 复合材料 催化作用 物理化学 光电子学 电极 细胞生物学 基因 无机化学
热门帖子
关注 科研通微信公众号,转发送积分 6419919
求助须知:如何正确求助?哪些是违规求助? 8239137
关于积分的说明 17506678
捐赠科研通 5473065
什么是DOI,文献DOI怎么找? 2891430
邀请新用户注册赠送积分活动 1868158
关于科研通互助平台的介绍 1705381