Skip to content

アプリケーション内で をクリックすると、お使いのDataRobotバージョンに関する全プラットフォームドキュメントにアクセスできます。

Prompting reference

The following sections provide basic and more advanced few shot prompting guidance.

Effective prompting strategies

This section uses the following example to identify elements of prompt engineering:

You are a world-renowned poet in the early 1800s. Write a poem in the style of Edgar Allan Poe. It must be 10 sentences long and use “set up, rhyme” format.

Consider the elements through the following images.

Persona

Persona provides a role or voice to ensure that answers resemble a specific counterpart throughout (e.g., profession, known person).

Context and sensitivity

Context is information or nuance that can steer the model toward a given setting (e.g., temporal, subject matter). Specificity provides additional details as part of the context that can lead to better results (e.g., tone and style).

Instruction

Instruction is a specific task you want the model to perform (e.g., write, translate, summarize).

ルール

Rules provide specifications to limit or otherwise restrain the response (e.g., word limit, topics to avoid).

出力形式

The output format is the type and/or format of the output. Optionally, you can provide examples (e.g., question/answer, headline) to further refine the desired response.

Example response

Few-shot prompting

Few-shotプロンプティングは、「コンテキスト内学習」で限られた数の例またはプロンプトに基づいてテキストを生成または分類する手法です。実例、すなわち「ショット」は、与えられたコンテキストのパターンにモデルが従うように条件を設定します。トレーニング中に同様の実例を見たことがなくても、コンテキストに関連する一貫したテキストを生成できます。 これは、モデルにラベル付けされた大量のトレーニングデータが通常必要となる従来の機械学習とは異なります。 Few-shotプロンプティングでは、特定のデータセットでファインチューニングを行う必要なく、モデルをテキスト生成、テキストサマリー、変換、質問への回答、センチメント分析などのタスクに適した候補にすることができます。

Few-shotプロンプティングの簡単な例は、顧客のフィードバックを肯定的または否定的に分類する際に使用します。 モデルに肯定的と否定的のフィードバックの例を3つ表示することによって、分類されていないフィードバックを表示したときに、最初の3つの例に基づいてモデルが評価を割り当てることができます。 Few-shotプロンプティングは、モデルに2つ以上の例を表示するときに使用します。Zero-shotとOne-shotのプロンプティングは、同様の手法です。

以下は、DataRobotでのFew-shotプロンプティングの使用を示しています。 システムプロンプトフィールドで、プロンプトと学習例が表示されます。

カスタマーサポートチケットのテキストから、参照する製品の名前と問題のタイプを特定します。 問題のタイプは"hardware"または"software"です。 "product"と"issue type"の2つのキーを持つJSONとしてレスポンスをフォーマットします。

---------------
例:

入力:TPS Report Generator Enterprise Editionでバグに遭遇しました。 「生成」をクリックするたびにアプリケーションがクラッシュします。 利用可能な更新または修正はありますか?
出力:{"product": "TPS Report Generator Enterprise Edition", "issue_type": "software"}

入力:Acme Phone 5+で画面がちらつき、使用できません。 どうすればよいでしょうか? いくつかのゲームをいくつかインストールしたいと思い、問題が解決することを期待して工場出荷時設定へのリセットを行いましたが、解決しませんでした。

出力:{"product": "Acme Phone 5+", "issue_type": "hardware"}

LLMにそのコンテキストを入力した後、いくつかのプロンプトの例を試してください。

プロンプト:PrintPro 9000の画面に異様なエラーメッセージが表示されています。 "PC LOAD LETTER"と書かれてあります。 これは何を意味しますか?

プロンプト:Print Pro 9002にファームウェアv12.1をインストールできません。"Incompatible product version"と書かれています。

詳細については、 MIT Prompt Engineering Guideを参照してください。


更新しました June 7, 2024