Prompting Is Programming: A Query Language for Large Language Models

要約

大規模な言語モデルは、質問応答やコード生成などの幅広いタスクで優れたパフォーマンスを実証しています。
高いレベルでは、入力が与えられると、言語モデルを使用して、統計的に最も可能性の高い方法でシーケンスを自動的に完了できます。
これに基づいて、ユーザーは言語の指示や例を使用してこれらのモデルにプロンプ​​トを表示し、さまざまな下流タスクを実装します。
高度なプロンプト方法では、言語モデル、ユーザー、および計算機などの外部ツールの間の対話を暗黙的に示すこともできます。
ただし、最先端のパフォーマンスを取得したり、特定のタスクに言語モデルを適応させたりするには、複雑なタスク固有およびモデル固有のプログラムを実装する必要があり、それでもアドホックな対話が必要になる場合があります。
これに基づいて、言語モデル プログラミング (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).

arxiv情報

著者 Luca Beurer-Kellner,Marc Fischer,Martin Vechev
発行日 2023-05-30 12:56:41+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.CL パーマリンク