大语言模型在问答和代码生成等广泛任务上表现出了卓越的性能。从高层来看,给定一个输入,语言模型可以被用来以统计上可能的方式自动补全序列。基于此,用户通过语言指令或示例来提示这些模型,以实现各种下游任务。先进的提示方法甚至可以隐含语言模型、用户和计算器等外部工具之间的交互。然而,为了获得最先进的性能或使语言模型适应特定任务,必须实现复杂的、任务和模型特定的程序,这可能仍然需要临时的交互。基于此,我们提出了语言模型编程(LMP)这一新颖思想。LMP 将语言模型提示从纯文本提示推广为文本提示与脚本编写的直观组合。此外,LMP 允许对语言模型输出指定约束。这使得能够轻松适应许多任务,同时抽象掉语言模型内部细节并提供高层语义。为了实现 LMP,我们实现了 LMQL(Language Model Query Language 的缩写),它利用 LMP 提示中的约束和控制流来生成高效的推理过程,从而最大限度地减少对底层语言模型的昂贵调用次数。我们表明,LMQL 能够以直观的方式涵盖广泛的最先进提示方法,尤其有助于实现用现有高级 API 难以实现的交互式流程。我们的评估表明,在若干下游任务上我们保持或提高了准确率,同时在按使用付费的 API 场景中显著减少了所需的计算量或成本(节省 26-85% 的成本)。
英文摘要:
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).
AdaRewriter: Unleashing the Power of Prompting-based Conversational Query Reformulation via Test-Time Adaptation
School of Computer Science and Engineering, Key Laboratory of Computer Network and Information Integration, Ministry of Education, Southeast University(计算机科学与工程学院、计算机网络与信息集成重点实验室、教育部、东南大学)
From Prediction to Application: Language Model-based Code Knowledge Tracing with Domain Adaptive Pre-Training and Automatic Feedback System with Pedagogical Prompting for Comprehensive Programming Education
Enuma Inc(Enuma公司);University of Memphis(孟菲斯大学);Daegu National University of Education(大邱教育大学);Seoul National University(首尔大学);Seoul Metropolitan Office of Education(首尔市教育厅);Korea University(高丽大学)
Compiler-Guided Inference-Time Adaptation: Improving GPT-5 Programming Performance in Idris
Ming Hsieh Department of Electrical and Computer Engineering(明希斯部门电子与计算机工程系);Viterbi School of Engineering, University of Southern California(维特比工程学院,南加州大学)
Chain of Grounded Objectives: Bridging Process and Goal-oriented Prompting for Code Generation
Electronics and Telecommunications Research Institute(电子电信研究院);Department of Computer Science and Engineering, Seoul National University(计算机科学与工程系,首尔国立大学)
Rethinking On-policy Optimization for Query Augmentation
University of Utah(犹他大学);The University of Queensland(昆士兰大学);University of Waterloo(滑铁卢大学);New York University(纽约大学);University of Notre Dame(圣母大学);Université de Montréal(蒙特利尔大学);Google DeepMind(谷歌DeepMind);University of Oklahoma(俄克拉荷马大学)
Prompting Large Language Models to Tackle the Full Software Development Lifecycle: A Case Study
Shanghai AI Laboratory(上海人工智能实验室);Nanjing University(南京大学);BUPT(北京邮电大学);Dartmouth College(达特茅斯学院);Princeton University(普林斯顿大学);The University of Hong Kong(香港大学);Tsinghua University(清华大学);Alibaba Group(阿里巴巴集团);ByteDance(字节跳动)
An Empirical Evaluation of LLM-Generated Code Security Across Prompting Methods
Department of Computer Science, Birzeit University(计算机科学系,巴勒斯坦比泽大学);King Fahd University of Petroleum and Minerals(国王法赫德石油和矿物大学);University of Central Florida(中央佛罗里达大学)
Beyond Templates: Revisiting Zero-Shot Remote Sensing through Meta-Prompting
Remote Sensing Lab, National Technical University of Athens(遥感实验室,国家技术大学雅典分校);Remote Sensing Lab, Department of Engineering and Sciences, National Technical University of Athens(遥感实验室,工程与科学系,国家技术大学雅典分校);Universitas Mercatorum(默卡托大学)
Query Carefully: Detecting the Unanswerables in Text-to-SQL Tasks
Institute of Computer Science, Zurich University of Applied Sciences(计算机科学研究所,应用科学大学苏黎世);Institute of Medical Virology, University of Zurich(医学病毒学研究所,苏黎世大学);Department of Gastroenterology and Hepatology, University Hospital Zurich, University of Zurich(消化内科与肝病科,苏黎世大学医院,苏黎世大学)
Grounding Large Language Models in Reaction Knowledge Graphs for Synthesis Retrieval
Department of Intelligent Systems, Delft University of Technology(智能系统系,代尔夫特理工大学);Department of Chemical Engineering, Delft University of Technology(化学工程系,代尔夫特理工大学)
A Pair Programming Framework for Code Generation via Multi-Plan Exploration and Feedback-Driven Refinement
State Key Laboratory for Novel Software Technology(计算机软件新技术国家重点实验室);Nanjing University(南京大学);National Institute of Healthcare Data Science(国家卫生健康数据科学研究院)
Hint of Pseudo Code (HoPC): Zero-Shot Step by Step Pseudo Code Reasoning Prompting
Department of Computer Science and Technology(计算机科学与技术系);Institute for Artificial Intelligence at Tsinghua University(清华大学人工智能研究院);Beijing National Research Center for Information Science and Technology(北京信息科学国家研究中心);Tsinghua University(清华大学)