Cited by 130Topic ModelingNatural Language Processing TechniquesSoftware Engineering Research

Prompting Is Programming: A Query Language for Large Language Models

Open access
Beurer-Kellner, Luca, Fischer, Marc, Vechev, Martin·2023·Proceedings of the ACM on Programming Languages

Abstract

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).

Integrity signals

Registry

Crossref · 10.1145/3591300

Cites

13 of 13 references verified0 citation errors · 0 not checkable

Statistics

Recomputing p-values needs the paper’s full text.

Claims the paper makes

We couldn’t retrieve this paper’s full text, so its claims and self-check weren’t run. The registry and citation checks still apply.

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

  • Prompt Cache can automatically convert prompt programs into PML, eliminating the need for manual schema writing.

    “To simplify PML writing, Prompt Cache can automatically convert prompt programs (Beurer-Kellner et al., 2023; Guidence, 2023) from languages like Python into PML, eliminating the need for manual schema writing.”

    From Prompt Cache: Modular Attention Reuse for Low-Latency Inference (2023) · cites this paper as Beurer-Kellner et al., 2023

Cites

Flagged first, then by citations

Cited by

Sorted by citations

Authors
Beurer-Kellner, L., Fischer, M., & Vechev, M.
Affiliations
ETH Zurich (CH)
Venue
Proceedings of the ACM on Programming Languages
Published
2023-06-06
Volume
7
Issue
PLDI
Pages
1946-1969
ISSN
2475-1421 (ISSN-L)
OpenAlex
W4367185264
Cited by
117
References
13
Citations by year
2026: 36 · 2025: 45 · 2024: 29 · 2023: 7
FWCI
11.03
Type
journal article
Language
en
Open access
Locations
  • Proceedings of the ACM on Programming Languages (publishedVersion, cc-by)
  • arXiv (Cornell University) (submittedVersion)
  • Repository for Publications and Research Data (ETH Zurich) (submittedVersion, cc-by)
  • arXiv (Cornell University) (cc-by)
  • ETH Zürich Research Collection
Funders
Swiss State Secretariat for Education, Research and Innovation (101045816)
Topics
  • Physical Sciences › Computer Science › Artificial Intelligence › Topic Modeling
  • Physical Sciences › Computer Science › Artificial Intelligence › Natural Language Processing Techniques
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
Keywords
prompting, large language models, output constraints, inference efficiency, cost reduction

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review