Optimizing Instructions and Demonstrations for Multi-Stage Language Model Programs

要約

言語モデル プログラム、つまりモジュール言語モデル (LM) 呼び出しの洗練されたパイプラインは、NLP タスクをますます進歩させていますが、すべてのモジュールに対して共同して有効なプロンプトを作成する必要があります。
私たちは、LM プログラムのプロンプトの最適化、つまり、モジュールレベルのラベルや勾配にアクセスせずに、下流のメトリックを最大化するためにこれらのプロンプトを更新する方法を研究します。
これを扱いやすくするために、すべてのモジュールの自由形式の命令と数ショットのデモンストレーションを最適化するために問題を因数分解し、タスクに基づいた命令を作成し、モジュール間でクレジットの割り当てをナビゲートするためのいくつかの戦略を導入します。
私たちの戦略には、(i) 効果的な命令を提案するためのプログラムおよびデータを意識した手法、(ii) 目的の代理モデルを学習するための確率的ミニバッチ評価関数、および (iii) 洗練されたメタ最適化手順が含まれます。
LM が時間の経過とともにどのように提案を構築するか。
これらの洞察を使用して、クラス最高のオープンソース モデル (Llama-3-8B) を使用する 6 つの多様な LM プログラムのうち 5 つでベースラインを 12.9% もの精度で上回る新しいオプティマイザーである MIPRO を開発しました。
DSPy の新しいオプティマイザーとベンチマークを https://github.com/stanfordnlp/dspy でリリースする予定です。

要約(オリジナル)

Language Model Programs, i.e. sophisticated pipelines of modular language model (LM) calls, are increasingly advancing NLP tasks, but they require crafting prompts that are jointly effective for all modules. We study prompt optimization for LM programs, i.e. how to update these prompts to maximize a downstream metric without access to module-level labels or gradients. To make this tractable, we factorize our problem into optimizing the free-form instructions and few-shot demonstrations of every module and introduce several strategies to craft task-grounded instructions and navigate credit assignment across modules. Our strategies include (i) program- and data-aware techniques for proposing effective instructions, (ii) a stochastic mini-batch evaluation function for learning a surrogate model of our objective, and (iii) a meta-optimization procedure in which we refine how LMs construct proposals over time. Using these insights we develop MIPRO, a novel optimizer that outperforms baselines on five of six diverse LM programs using a best-in-class open-source model (Llama-3-8B), by as high as 12.9% accuracy. We will release our new optimizers and benchmark in DSPy at https://github.com/stanfordnlp/dspy

arxiv情報

著者 Krista Opsahl-Ong,Michael J Ryan,Josh Purtell,David Broman,Christopher Potts,Matei Zaharia,Omar Khattab
発行日 2024-06-17 16:12:03+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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