Prompting Is Programming: A Query Language for Large Language Models

被引:23
|
作者
Beurer-Kellner, Luca [1 ]
Fischer, Marc [1 ]
Vechev, Martin [1 ]
机构
[1] Swiss Fed Inst Technol, Zurich, Switzerland
关键词
language model programming; prompt programming;
D O I
10.1145/3591300
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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).
引用
收藏
页数:24
相关论文
共 50 条
  • [41] INTERVENOR: Prompting the Coding Ability of Large Language Models with the Interactive Chain of Repair
    Wang, Hanbin
    Liu, Zhenghao
    Wang, Shuo
    Cui, Ganqu
    Ding, Ning
    Liu, Zhiyuan
    Yu, Ge
    FINDINGS OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS: ACL 2024, 2024, : 2081 - 2107
  • [42] Dehallucinating Large Language Models Using Formal Methods Guided Iterative Prompting
    Jha, Susmit
    Jha, Sumit Kumar
    Lincoln, Patrick
    Bastian, Nathaniel D.
    Velasquez, Alvaro
    Neema, Sandeep
    2023 IEEE INTERNATIONAL CONFERENCE ON ASSURED AUTONOMY, ICAA, 2023, : 149 - 152
  • [43] MindMap: Knowledge Graph Prompting Sparks Graph of Thoughts in Large Language Models
    Wen, Yilin
    Wang, Zifeng
    Sun, Jimeng
    PROCEEDINGS OF THE 62ND ANNUAL MEETING OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS, VOL 1: LONG PAPERS, 2024, : 10370 - 10388
  • [44] Large Language Models in Robot Programming Potential in the programming of industrial robots
    Syniawa, Daniel
    Ates, Baris
    Boshoff, Marius
    Kuhlenkoetter, Bernd
    ATP MAGAZINE, 2024, (6-7):
  • [45] MEMOPASCAL - EMBEDDING A QUERY LANGUAGE INTO A HIGH-LEVEL PROGRAMMING LANGUAGE
    NOACK, J
    KUCHEN, H
    ANGEWANDTE INFORMATIK, 1987, (04): : 149 - 156
  • [46] Advancing Robotics Education: Integrating Large Language Models for Natural Language Programming in VET
    Prieto, Abraham
    Romero, Alejandro
    Bellas, Francisco
    INTELLIGENT DATA ENGINEERING AND AUTOMATED LEARNING - IDEAL 2024, PT II, 2025, 15347 : 517 - 528
  • [47] An RDF Query Language based on Logic Programming
    Almendros-Jimenez, Jesus M.
    ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2008, 200 (03) : 67 - 85
  • [48] Synthetic Query Generation using Large Language Models for Virtual Assistants
    Sannigrahi, Sonal
    Fraga-Silva, Thiago
    Oualil, Youssef
    Van Gysel, Christophe
    PROCEEDINGS OF THE 47TH INTERNATIONAL ACM SIGIR CONFERENCE ON RESEARCH AND DEVELOPMENT IN INFORMATION RETRIEVAL, SIGIR 2024, 2024, : 2837 - 2841
  • [49] A Universal Prompting Strategy for Extracting Process Model Information from Natural Language Text Using Large Language Models
    Neuberger, Julian
    Ackermann, Lars
    van der Aa, Han
    Jablonski, Stefan
    CONCEPTUAL MODELING, ER 2024, 2025, 15238 : 38 - 55
  • [50] LLMR: Real-time Prompting of Interactive Worlds using Large Language Models
    De la Torre, Fernanda
    Fang, Cathy Mengying
    Huang, Han
    Banburski-Fahey, Andrzej
    Fernandez, Judith Amores
    Lanier, Jaron
    PROCEEDINGS OF THE 2024 CHI CONFERENCE ON HUMAN FACTORS IN COMPUTING SYTEMS (CHI 2024), 2024,