Skip to main content
QUICK REVIEW

[論文レビュー] Prompting Is Programming: A Query Language for Large Language Models

Luca Beurer-Kellner, M. L. Fischer|arXiv (Cornell University)|Dec 12, 2022
Semantic Web and Ontologies被引用数 8
ひとこと要約

この論文では、スクリプト、制約、制御構文を自然言語プロンプトに拡張した高水準なクエリ言語であるLMQLを導入し、効率的で正確かつコスト効率の良い言語モデル推論を可能にする言語モデルプログラミング(LMP)を提案する。LMQLは、実行時におけるトークンレベルの検証と最適化されたデコードを活用することで、モデル呼び出し回数と計算量を最大85%まで削減し、下流タスクにおける正確性を維持または向上させる。

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

研究の動機と目的

  • 手動でモデル固有の実装を必要とし、高い計算コストを要する従来のプロンプティング手法の非効率性と複雑さに対処すること。
  • トークン化、デコード、モデル内部構造の詳細な知識を必要とせずに、直感的で高水準な言語モデルのプログラミングを可能にすること。
  • インタラクティブで制約付きのプロンプティングワークフローにおいて、高価な言語モデル呼び出し回数を削減すること。
  • 異なるモデルやAPI間でポータブルで制約に配慮した効率的なインターフェースを提供すること。
  • 制約付きでスクリプト駆動のプロンプティングが、著しく低い計算コストと金銭的コストで最先端のパフォーマンスを達成できることを示すこと。

提案手法

  • 自然言語プロンプティングと軽量スクリプト、出力制約を統合するパラダイムとして、言語モデルプログラミング(LMP)を提唱する。
  • Pythonに似た制御構文、変数代入、リスト内因数表記を可能にするドメイン特化言語であるLMQLを導入する。
  • デコード中にトークンレベルの検証と制約チェックを実施することで、バックトラッキングを回避し、モデル呼び出し回数を削減する。
  • LMQLプログラム内の制約と制御構文を分析して、効率的な推論手順を生成するクエリ最適化エンジンを用いる。
  • 拡張可能な演算子を介して外部のバリデータ(例:文法チェッカー、コード実行エンジン)を統合可能にし、意味的・文法的検証を可能にする。
  • LMQLプログラムを最適化された推論パイプラインに変換することで実行し、高価なモデル呼び出しを最小限に抑える。

実験結果

リサーチクエスチョン

  • RQ1大規模言語モデルに対して、自然言語プロンプティングとスクリプト、制約を統合した高水準なクエリ言語を設計できるか?
  • RQ2このような言語が、モデル呼び出し回数と計算コストを削減しながら正確性を維持または向上できるか?
  • RQ3プロンプティングに制御構文と制約を統合することで、従来のAPIと比較して効率性と使いやすさがどのように向上するか?
  • RQ4LMQLは、チェーン・オブ・トークンやセルフコンシステンシーといった複雑な最先端のプロンプティング技術を、簡潔かつ効率的に表現できるか?
  • RQ5使用料課金制のAPI環境において、LMQLがモデルパフォーマンスを損なうことなく、顕著なコスト削減を達成できるか?

主な発見

  • LMQLは、ベースラインのプロンプティング手法と比較して、モデル呼び出し回数を最大85%まで削減し、推論コストを顕著に低減した。
  • 複数の下流タスクにおいて、正確性が維持または向上し、制約が一部のケースで出力品質を向上させた。
  • LMQLプログラムは、同等のPythonベースの実装と比較して最大10倍短く、開発生産性が向上した。
  • 実行時におけるトークンレベルの検証を活用することで、チャンク単位のデコードやバックトラッキングの必要がなくなり、効率性が向上した。
  • 使用料課金制のAPI環境では、請求対象トークン数を最大80%まで削減し、顕著なコスト削減が達成された。
  • LMQLは、反復的推論や制約付き生成といった複雑なインタラクティブなプロンプティングフローを実現でき、従来の高水準APIでは実装が難しい。

より良い研究を、今すぐ始めましょう

論文の読解から最終レビューまで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。