0 / 0
資料の 英語版 に戻る
一般的なタスクのためのサンプルファウンデーション・モデル・プロンプト

一般的なタスクのためのサンプルファウンデーション・モデル・プロンプト

これらのサンプルを試して、さまざまなプロンプトがファウンデーション・モデルをガイドして一般的なタスクを実行する方法を学習してください。

このトピックの使用方法

このトピックのサンプル・プロンプトを検討します。

  • プロンプト・テキストと入力パラメーター値を IBM watsonx.ai のプロンプト・ラボにコピー・アンド・ペーストします。
  • 生成されるテキストを確認します。
  • さまざまなモデルがさまざまな出力を生成する方法を説明します。
  • プロンプト・テキストとパラメーターを変更して、結果がどのように変化するかを確認します。

ファウンデーション・モデルを迅速化するための正しい方法はありません。 しかし、学界や産業界では、かなり確実に機能するパターンが発見されています。 このトピックのサンプルを使用して、実験による迅速なエンジニアリングに関するスキルと直感を構築します。

 

このビデオは、本書の概念とタスクを学習するためのビジュアル・メソッドを提供します。


ビデオの章
[ 0:11 ] プロンプトおよびプロンプト・ラボの概要
[ 0:33 ] キーの概念: テキスト補完
[ 1:34 ] 便利なプロンプト・パターン: Few-shot prompt
[ 1:58 ] 停止基準: 最大トークン、停止シーケンス
[ 3:32 ] キーの概念: Fine-tuning
[ 4:32 ] 便利なプロンプト・パターン: Zero-shot flexible prompt
[ 5:32 ] キーの概念: さまざまなプロンプトを試す
[ 6:14 ] 次のステップ: サンプル・プロンプトを使用してテストする

 

サンプルの概要

以下のタスクをサポートする出力を生成するようにファウンデーション・モデルにプロンプトを出すサンプルを見つけることができます。

以下の表に、タスク固有のサンプルで使用されるファウンデーション・モデルを示します。 チェック・マーク (✓) は、モデルが関連タスクのサンプルで使用されていることを示します。 「サンプルの表示」 をクリックすると、サンプル・プロンプトに移動できます。

テーブル1。 特定のタスクのサンプルで使用されるモデル
モデルの 機密区分 抽出 生成 QA 要約 コーディング ダイアログ 翻訳
granite-13b-chat-v2
サンプルを参照
granite-13b-instruct-v2
サンプルを参照

サンプルを参照

サンプルを参照
granite-7b-lab
サンプルを参照
granite-8b-japanese
サンプルを参照

サンプルを参照

サンプルを参照
granite-20b-multilingual
サンプルを参照
granite-3b-code-instruct
サンプルを参照
granite-8b-code-instruct
サンプルを参照
granite-20b-code-instruct
サンプルを参照
granite-34b-code-instruct
サンプルを参照
codellama-34b-instruct-hf
サンプルを参照
elyza-japanese-llama-2-7b-instruct
サンプルを参照

サンプルを参照
flan-t5-xxl-11b
サンプルを参照

サンプルを参照

サンプルを参照
flan-ul2-20b
サンプルを参照

サンプルを参照

サンプルを参照

サンプルを参照

サンプルを参照
jais-13b-chat
サンプルを参照
llama-3-8b-instruct
サンプルを参照
llama-3-70b-instruct
サンプルを参照
llama-2 チャット
サンプルを参照
llama2-13b-dpo-v7
サンプルを参照

サンプルを参照
merlinite-7b
サンプルを参照
mixtral-8x7b-instruct-v01
サンプルを参照

サンプルを参照

サンプルを参照

サンプルを参照

サンプルを参照

サンプルを参照
mt0-xxl-13b
サンプルを参照

サンプルを参照

以下の表に、使用可能なサンプル・プロンプトを要約します。

テーブル2。 サンプル・プロンプトのリスト
シナリオ プロンプト・エディター プロンプト形式 モデルの デコード ノート
ゼロ・ショット・プロンプトを含むサンプル: メッセージの分類 フリー・フォーム ゼロ・ショット • mt0-xxl-13b
• flan-t5-xxl-11b
• flan-ul2-20b
• mixtral-8x7b-instruct-v01
欲張り クラス名を停止シーケンスとして使用し、クラス名の印刷後にモデルを停止します。
数回のプロンプトが表示されたサンプル: フリー・フォーム・モードでのメッセージの分類 フリー・フォーム 少数ショット • mixtral-8x7b-instruct-v01 欲張り クラス名を停止シーケンスとして使用します。
数回のプロンプトが表示されたサンプル: 構造化モードでのメッセージの分類 構造化 少数ショット • mixtral-8x7b-instruct-v01 欲張り クラス名を停止シーケンスとして使用します。
サンプル: 日本語メッセージの分類 フリー・フォーム 少数ショット • elyza-japanese-llama-2-7b-instruct 欲張り クラス名を停止シーケンスとして使用します。
サンプル: 苦情からの詳細の抽出 フリー・フォーム ゼロ・ショット • flan-ul2-20b 欲張り
サンプル: フリー・フォーム・モードでのテーマの番号付きリストの生成 フリー・フォーム 少数ショット • mixtral-8x7b-instruct-v01 サンプリング フォーマット設定された出力を生成します。
1 つのリストの後でモデルを停止するための停止シーケンスとして 2 つの改行文字を使用します。
サンプル: 構造化モードでテーマに番号付きリストを生成する 構造化 少数ショット • mixtral-8x7b-instruct-v01 サンプリング 定様式出力を生成します。
2 つの改行文字を停止シーケンスとして使用します。
サンプル: Graniteを使用して特定のテーマに番号付きリストを生成 フリー・フォーム ゼロ・ショット • granite-13b-instruct-v2 欲張り 定様式出力を生成する
サンプル: フリー・フォーム・モードでの記事に基づく質問への回答 フリー・フォーム ゼロ・ショット • mt0-xxl-13b
• flan-t5-xxl-11b
• flan-ul2-20b
• mixtral-8x7b-instruct-v01
欲張り ピリオド「.」を使用します。 モデルが 1 つの文のみを返すようにするための停止シーケンスとして
サンプル: 構造化モードでの記事に基づく質問への回答 構造化 ゼロ・ショット • mt0-xxl-13b
• flan-t5-xxl-11b
• flan-ul2-20b
• mixtral-8x7b-instruct-v01
欲張り ピリオド「.」を使用します。 停止シーケンスとして
複数の入力の結果を一度に生成します
サンプル: Graniteによる文書に基づく質問への回答 フリー・フォーム ゼロ・ショット • granite-13b-instruct-v2 欲張り
サンプル: 一般的な秘密の質問への回答 (日本語) フリー・フォーム ゼロ・ショット • granite-8b-japanese 欲張り
サンプル: パッセージのタイトルの生成 フリー・フォーム ワンショット • granite-7b-lab 欲張り < |endoftext |> という名前の特殊トークンを停止シーケンスとして使用します。
サンプル: パターンでのシーケンスの完了 フリー・フォーム ワンショット • merlinite-7b 欲張り < |endoftext |> という名前の特殊トークンを停止シーケンスとして使用します。
サンプルのゼロ・ショット・プロンプト: ミーティングのトランスクリプトの要約 フリー・フォーム ゼロ・ショット • flan-t5-xxl-11b
• flan-ul2-20b
• mixtral-8x7b-instruct-v01
欲張り
サンプルの数ショット・プロンプト: フリー・フォーム・モードでのミーティングのトランスクリプトの要約 フリー・フォーム 少数ショット • mixtral-8x7b-instruct-v01 欲張り
サンプルの数ショット・プロンプト: 構造化モードでのミーティングのトランスクリプトの要約 構造化 少数ショット • mixtral-8x7b-instruct-v01 欲張り フォーマット設定された出力を生成します。
1 つのリストの後でモデルを停止するための停止シーケンスとして 2 つの改行文字を使用します。
サンプル: 韓国語でのコンテンツの要約 フリー・フォーム ゼロ・ショット • llama2-13b-dpo-v7 欲張り 韓国語で出力を生成します。
サンプル: 命令からのプログラマチック・コードの生成 フリー・フォーム 少数ショット • mixtral-8x7b-instruct-v01
• codellama-34b-instruct-hf
欲張り 出力としてプログラマチック・コードを生成します。
< end of code> を停止シーケンスとして使用します。
サンプル: あるプログラミング言語から別のプログラミング言語へのコードの変換 フリー・フォーム 少数ショット • mixtral-8x7b-instruct-v01
• codellama-34b-instruct-hf
欲張り 出力としてプログラマチック・コードを生成します。
< end of code> を停止シーケンスとして使用します。
サンプル: Graniteを使用した命令からのプログラマチック・コードの生成 フリー・フォーム 少数ショット Granite コード・インストラクション・モデル 欲張り プログラマチック・コードを出力として生成します。
サンプル: Graniteを使用したあるプログラミング言語から別のプログラミング言語へのコードの変換 フリー・フォーム 少数ショット Granite コード・インストラクション・モデル 欲張り プログラマチック・コードを出力として生成します。
サンプル: Llama 3との会話 フリー・フォーム カスタム構造 • llama-3-8b-instruct
• llama-3-70b-instruct
欲張り チャットボットのようなダイアログ出力を生成します。
モデル固有のプロンプト形式を使用します。
サンプル: Llama 2との会話 フリー・フォーム カスタム構造 llama-2 チャット 欲張り チャットボットのようなダイアログ出力を生成します。
モデル固有のプロンプト形式を使用します。
サンプル: granite-13b-chat-v2との会話 フリー・フォーム カスタム構造 • granite-13b-chat-v2 欲張り チャットボットのようなダイアログ出力を生成します。
ダイアログのガードレールを設定するためにシステム・プロンプトを使用します。
サンプル: granite-8b-japaneseを使用した日本語の会話 フリー・フォーム カスタム構造 • granite-8b-japanese 欲張り チャットボットのような日本語のダイアログ出力を生成します。
モデル固有のプロンプト形式を使用します。
サンプル: jais-13b-chatを使用したアラビア語の会話 フリー・フォーム カスタム構造 • jais-13b-chat 欲張り チャットボットのような英語またはアラビア語のダイアログ出力を生成します。
モデル固有のプロンプト形式を使用します。
サンプル: llama2-13b-dpo-v7を使用した韓国語の Converse フリー・フォーム カスタム構造 • llama2-13b-dpo-v7 欲張り チャットボットのような韓国語のダイアログ出力を生成します。
モデル固有のプロンプト形式を使用します。
ピリオドを停止シーケンスとして使用します。
サンプル: 日本語から英語へのテキストの翻訳 フリー・フォーム ゼロ・ショット • elyza-japanese-llama-2-7b-instruct 欲張り テキストを日本語から英語に翻訳します。
サンプル: スペイン語から英語へのテキストの翻訳 フリー・フォーム 少数ショット • mixtral-8x7b-instruct-v01 欲張り テキストをスペイン語から英語に翻訳します。
サンプル: 英語から日本語へのテキストの翻訳 フリー・フォーム ゼロ・ショット • granite-8b-japanese 欲張り テキストを英語から日本語に翻訳します。
サンプル: フランス語から英語へのテキストの翻訳 フリー・フォーム 少数ショット • granite-20b-multilingual 欲張り テキストをフランス語から英語に翻訳します。

機密区分

分類は、異なるカテゴリーのデータを予測するのに役立ちます。 分類は、2 つのデータ・クラスを持つバイナリーにすることも、複数クラスにすることもできます。 分類タスクは、情報をより効率的に管理または処理できるように、顧客のフィードバックなどの情報をカテゴリー化するのに役立ちます。

ゼロ・ショット・プロンプトを使用したサンプル: メッセージの分類

シナリオ: クラウド・ソフトウェア会社のお客様サポート・チャットボットに送信されるメッセージについて、お客様のメッセージを質問または問題として分類します。 クラス割り当てに応じて、チャットは問題タイプの正しいサポート・チームにルーティングされます。

モデルの選択
インストラクション・チューニングされたモデルは、通常、このサンプル・プロンプトを使用してこのタスクを実行できます。

提案: mt0-xxl-13b、 flan-t5-xxl-11b、 flan-ul2-20b、または mixtral-8x7b-instruct-v01

Decoding
Greedy。 モデルは、指定されたクラス名の 1 つを返す必要があります。創造的ではなく、新規クラスを構成することもできません。

停止基準

  • 「質問」と「問題」の 2 つの停止順序を指定します。 モデルは、これらの単語のいずれかを生成した後、停止する必要があります。
  • このような短い出力では、Max tokens パラメーターを 5 に設定できます。

プロンプト・テキスト
このゼロ・ショットのプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Classify this customer message into one of two classes: Question, Problem.

Class name: Question
Description: The customer is asking a technical question or a how-to question 
about our products or services.

Class name: Problem
Description: The customer is describing a problem they are having. They might 
say they are trying something, but it's not working. They might say they are 
getting an error or unexpected results.

Message: I'm having trouble registering for a new account.
Class name: 

数回のプロンプトが表示されたサンプル: フリー・フォーム・モードでのメッセージの分類

シナリオ: クラウド・ソフトウェア会社のお客様サポート・チャットボットに送信されるメッセージについて、お客様のメッセージを質問または問題の説明のいずれかに分類します。 クラス・タイプに基づいて、チャットを適切なサポート・チームに転送できます。

モデルの選択
両方のクラスのいくつかの例では、 mixtral-8x7b-instruct-v01 などのモデルでこのタスクを適切に実行できます。

Decoding
Greedy。 モデルは、指定されたクラス名の 1 つを返す必要があります。創造的ではなく、新規クラスを構成することもできません。

停止基準

  • 「質問」と「問題」の 2 つの停止順序を指定します。 モデルは、これらの単語のいずれかを生成した後、停止する必要があります。
  • このような短い出力では、Max tokens パラメーターを 5 に設定できます。

プロンプト・テキスト
この数回ショットのプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Message: When I try to log in, I get an error.
Class name: Problem

Message: Where can I find the plan prices?
Class name: Question

Message: What is the difference between trial and paygo?
Class name: Question

Message: The registration page crashed, and now I can't create a new account.
Class name: Problem

Message: What regions are supported?
Class name: Question

Message: I can't remember my password.
Class name: Problem

Message: I'm having trouble registering for a new account.

数回のプロンプトが表示されたサンプル: 構造化モードでのメッセージの分類

シナリオ: クラウド・ソフトウェア会社のお客様サポート・チャットボットに送信されるメッセージについて、お客様のメッセージを質問または問題の説明のいずれかに分類します。 クラス・タイプに基づいて、チャットを適切なサポート・チームに転送できます。

モデルの選択
両方のクラスのいくつかの例では、 mixtral-8x7b-instruct-v01 などのモデルでこのタスクを適切に実行できます。

Decoding
Greedy。 モデルは、クリエイティブではなく、指定されたクラス名の 1 つを返し、新規クラスを構成する必要があります。

停止基準

  • 「質問」と「問題」の 2 つの停止順序を指定します。 モデルは、これらの単語のいずれかを生成した後、停止する必要があります。
  • このような短い出力では、Max tokens パラメーターを 5 に設定できます。

セットアップ・セクション
以下のヘッダーと例を 「セットアップ」 セクションの 「例」 領域に貼り付けます。

テーブル2。 分類のいくつかのショットの例
メッセージ: クラス名:
When I try to log in, I get an error. Problem
Where can I find the plan prices? Question
What is the difference between trial and paygo? Question
The registration page crashed, and now I can't create a new account. Problem
What regions are supported? Question
I can't remember my password. Problem


試行セクション
このメッセージを 「試行」 セクションに貼り付けます。

I'm having trouble registering for a new account.

モデルを選択してパラメーターを設定し、 「生成」 をクリックして結果を表示します。

サンプル: 日本語メッセージの分類

シナリオ: 日本のクラウド・ソフトウェア会社のお客様サポート・チャットボットに送信されたメッセージをもとに、お客様のメッセージを質問または問題の説明として分類します。 クラス・タイプに基づいて、チャットを適切なサポート・チームに転送できます。

モデルの選択
elyza-japanese-llama-2-7b-instruct モデルは、日本語で書かれたプロンプト入力テキストを分類できます。

AI ガードレール
AI ガードレール 機能を無効にします。 この機能は、英語のテキストでのみサポートされます。 不適切でないコンテンツとしてフラグが立てられる可能性があります。

Decoding
Greedy。 モデルは、指定されたクラス名の 1 つを返す必要があります。創造的ではなく、新規クラスを構成することもできません。

停止基準

  • 2 つの停止シーケンス (問題の場合は 問題 、問題の場合は 質問 ) を指定します。 モデルは、これらの単語のいずれかを生成した後、停止する必要があります。
  • トークンの最大数パラメーターの値を小さくする場合は、7 トークン未満の値を小さくしないでください。 日本語文字は、英語の同じ単語よりも多くのトークンを使用します。

プロンプト・テキスト
この数回ショットのプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。 サンプル・プロンプト・テキストは、「 サンプル 1b」の英語プロンプト・テキストを日本語に翻訳したものです。

次のメッセージを問題または質問に分類します。

メッセージ: ログインしようとすると、エラーが発生します。
クラス名: 問題

メッセージ: プランの価格はどこで確認できますか?
クラス名: 質問

メッセージ: トライアルとペイゴーの違いは何ですか?
クラス名: 質問

メッセージ: 登録ページがクラッシュしたため、新しいアカウントを作成できません。
クラス名: 問題

メッセージ: どの地域がサポートされていますか?
クラス名: 質問

メッセージ: パスワードを思い出せません。
クラス名: 問題

メッセージ: 新しいアカウントの登録で問題が発生しました。
クラス名:

 

詳細の抽出

抽出タスクを使用すると、単純なテキスト・マッチングではなく、単語の意味に基づいて、データ内の重要な用語や言及を見つけることができます。

サンプル: 苦情からの詳細の抽出

シナリオ: 予約 Web サイトでフライトを予約する際に問題が発生したお客様からの苦情を考慮して、このお客様の不満足な体験の原因となった要因を特定します。

モデルの選択
flan-ul2-20b

Decoding
Greedy。 モデルは入力内の単語を返す必要があります。モデルはクリエイティブであり、新しい単語を構成することはできません。

停止基準
抽出される因子のリストは長くはないため、「最大トークン数」パラメーターを 50 に設定します。

プロンプト・テキスト
このゼロ・ショットのプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

From the following customer complaint, extract all the factors that 
caused the customer to be unhappy.

Customer complaint:
I just tried to book a flight on your incredibly slow website. All 
the times and prices were confusing. I liked being able to compare 
the amenities in economy with business class side by side. But I 
never got to reserve a seat because I didn't understand the seat map. 
Next time, I'll use a travel agent!

Numbered list of all the factors that caused the customer to be unhappy:

自然言語の生成

生成タスクは、大規模言語モデルが最も効果的に行うものです。 プロンプトは、有用な言語を生成するためにモデルをガイドするのに役立ちます。

数回のプロンプトが表示されたサンプル: フリー・フォーム・モードでテーマに番号付きリストを生成する

シナリオ: 特定のテーマで番号付きリストを生成します。

モデルの選択
mixtral-8x7b-instruct-v01 ファウンデーション・モデルは、改行文字などの特殊文字を認識して処理するようにトレーニングされました。 このモデルは、生成されたテキストを特殊文字を使用して特定の方法でフォーマットする場合に適しています。

デコード
・サンプリング。 これは創造的な作業です。 以下のパラメーターを設定します。

  • 温度: 0.7
  • 上位 P: 1
  • 上位 K: 50
  • ランダム・シード: 9045 ( 「生成」をクリックするたびに異なる出力を取得するには、ランダム・シード・パラメーターに異なる値を指定するか、パラメーターをクリアします。)

停止基準

  • モデルが 1 つのリストの後でテキストの生成を停止するようにするには、2 つの改行文字の停止シーケンスを指定します。 これを行うには、「 シーケンスの停止 」テキスト・ボックスをクリックし、Enter キーを 2 回押してから、 「シーケンスの追加」をクリックします。
  • リストの長さはあまり長くないため、Max tokens パラメーターを 50 に設定してください。

プロンプト・テキスト
この数回ショットのプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

What are 4 types of dog breed?
1. Poodle
2. Dalmatian
3. Golden retriever
4. Bulldog

What are 3 ways to incorporate exercise into your day?
1. Go for a walk at lunch
2. Take the stairs instead of the elevator
3. Park farther away from your destination

What are 4 kinds of vegetable?
1. Spinach
2. Carrots
3. Broccoli
4. Cauliflower

What are the 3 primary colors?
1. Red
2. Green
3. Blue

What are 3 ingredients that are good on pizza?

数回のプロンプトが表示されたサンプル: 構造化モードでテーマに番号付きリストを生成する

シナリオ: 特定のテーマで番号付きリストを生成します。

モデルの選択
mixtral-8x7b-instruct-v01 ファウンデーション・モデルは、改行文字などの特殊文字を認識して処理するようにトレーニングされました。 このモデルは、生成されたテキストを特殊文字を使用して特定の方法でフォーマットする場合に適しています。

デコード
・サンプリング。 このシナリオは創造的なものです。 以下のパラメーターを設定します。

  • 温度: 0.7
  • 上位 P: 1
  • 上位 K: 50
  • ランダム・シード: 9045 (異なる結果を生成するには、ランダム・シード・パラメーターに別の値を指定するか、パラメーターをクリアします。)

停止基準

  • モデルが 1 つのリストの後でテキストの生成を停止するようにするには、2 つの改行文字の停止シーケンスを指定します。 これを行うには、 「シーケンスの停止 (Stop sequence)」 テキスト・ボックスをクリックし、Enter キーを 2 回押してから、 「シーケンスの追加 (Add sequence)」をクリックします。
  • リストが長くなることはないので, 最大トークン数パラメーターを 50 に設定してください。

セットアップ・セクション
以下のヘッダーと例を 「セットアップ」 セクションの 「例」 領域に貼り付けます。

表 3. 生成のいくつかのショットの例
Input: Output:
What are 4 types of dog breed? 1. Poodle
2. Dalmatian
3. Golden retriever
4. Bulldog
What are 3 ways to incorporate exercise into your day? 1. Go for a walk at lunch
2. Take the stairs instead of the elevator
3. Park farther away from your destination
What are 4 kinds of vegetable? 1. Spinach
2. Carrots
3. Broccoli
4. Cauliflower
What are the 3 primary colors? 1. Red
2. Green
3. Blue


試行セクション
この入力を 「試行」 セクションに貼り付けます。

What are 3 ingredients that are good on pizza?

モデルを選択してパラメーターを設定し、 「生成」 をクリックして結果を表示します。

ゼロ・ショット・プロンプトを使用したサンプル: 特定のテーマでの番号付きリストの生成

シナリオ: モデルに、悪魔の代弁者としての役割を求めます。 潜在的なアクションを記述し、そのアクションに関連付けられている可能性のあるダウンサイドまたはリスクをリストするようにモデルに依頼します。

モデルの選択
granite-13b-instruct モデルは、改行文字などの特殊文字を認識して処理するようにトレーニングされています。 granite-13b-instruct-v2 モデルは、生成されたテキストを特殊文字を使用して特定の方法でフォーマット設定する場合に適しています。

Decoding
Greedy。 モデルは、プロンプトの内容に基づいて、最も予測可能なコンテンツを返す必要があります。モデルがクリエイティブになりすぎることはありません。

停止基準
サマリーでは複数のセンテンスが実行される可能性があるため、「最大トークン数」パラメーターを 60 に設定します。

プロンプト・テキスト
このプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

You are playing the role of devil's advocate. Argue against the proposed plans. List 3 detailed, unique, compelling reasons why moving forward with the plan would be a bad choice. Consider all types of risks.

Plan we are considering:
Extend our store hours.
Three problems with this plan are:
1. We'll have to pay more for staffing.
2. Risk of theft increases late at night.
3. Clerks might not want to work later hours.

Plan we are considering:
Open a second location for our business.
Three problems with this plan are:
1. Managing two locations will be more than twice as time-consuming than managed just one.
2. Creating a new location doesn't guarantee twice as many customers.
3. A new location means added real estate, utility, and personnel expenses.

Plan we are considering:
Refreshing our brand image by creating a new logo.
Three problems with this plan are:

質問への回答

質問への回答タスクは、ヘルプ・システムやその他のシナリオで役立ちます。これらのシナリオでは、よく尋ねられる質問や微妙な質問に既存のコンテンツから回答することができます。

モデルが事実上の回答を返すのを支援するために、取得拡張された生成パターンを実装します。 詳しくは、 Retrieval-augmented generationを参照してください。

サンプル: フリー・フォーム・モードでの記事に基づく質問への回答

シナリオ: オンライン・シード・カタログの Web サイトには、お客様が庭の計画を立て、最終的に購入するシードを選択するのに役立つ多くの記事があります。 お客様が表示している記事の内容に基づいてお客様の質問に回答するための新しいウィジェットが Web サイトに追加されます。 記事に関連する質問がある場合は、その記事に基づいて質問に回答してください。

モデルの選択
flan-t5-xxl-11b、 flan-ul2-20b、 mixtral-8x7b-instruct-v01、 mt0-xxl-13b など、命令で調整されたモデルでは、通常このサンプル・プロンプトを使用してこのタスクを実行できます。

Decoding
Greedy。 回答は記事内の事実に基づいている必要があり、記事に良い回答がない場合は、モデルは創造的ではなく、回答を構成する必要があります。

停止基準
モデルが 1 センテンスの回答を返すようにするには、ピリオド「.」を指定します。 停止シーケンスとして使用します。 Max tokens パラメーターは 50 に設定できます。

プロンプト・テキスト
このゼロ・ショットのプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Article:
###
Tomatoes are one of the most popular plants for vegetable gardens. 
Tip for success: If you select varieties that are resistant to 
disease and pests, growing tomatoes can be quite easy. For 
experienced gardeners looking for a challenge, there are endless 
heirloom and specialty varieties to cultivate. Tomato plants come 
in a range of sizes. There are varieties that stay very small, less 
than 12 inches, and grow well in a pot or hanging basket on a balcony 
or patio. Some grow into bushes that are a few feet high and wide, 
and can be grown is larger containers. Other varieties grow into 
huge bushes that are several feet wide and high in a planter or 
garden bed. Still other varieties grow as long vines, six feet or 
more, and love to climb trellises. Tomato plants do best in full 
sun. You need to water tomatoes deeply and often. Using mulch 
prevents soil-borne disease from splashing up onto the fruit when you 
water. Pruning suckers and even pinching the tips will encourage the 
plant to put all its energy into producing fruit.
###

Answer the following question using only information from the article. 
Answer in a complete sentence, with proper capitalization and punctuation. 
If there is no good answer in the article, say "I don't know".

Question: Why should you use mulch when growing tomatoes?
Answer: 

以下のようなその他の質問も試すことができます。

  • 「トマトの植物はどれくらいの大きさですか?」
  • 「トマトの植物は日陰と太陽のどちらが好きですか?」
  • 「トマトを育てるのは簡単ですか?」

以下のようなスコープ外の質問もお試しください。

  • 「どうやってキュウリを育てるの?」

サンプル: 構造化モードでの記事に基づく質問への回答

シナリオ: オンライン・シード・カタログの Web サイトには、お客様が庭の計画を立て、最終的に購入するシードを選択するのに役立つ多くの記事があります。 お客様が表示している記事の内容に基づいてお客様の質問に回答するための新しいウィジェットが Web サイトに追加されます。 特定の記事に関連する質問がある場合は、その記事に基づいて質問に回答してください。

モデルの選択
flan-t5-xxl-11b、 flan-ul2-20b、 mixtral-8x7b-instruct-v01、 mt0-xxl-13b など、命令で調整されたモデルでは、通常このサンプル・プロンプトを使用してこのタスクを実行できます。

Decoding
Greedy。 回答は記事内の事実に基づいている必要があり、記事に良い回答がない場合は、モデルは創造的ではなく、回答を構成する必要があります。

停止基準
モデルが 1 センテンスの回答を返すようにするには、ピリオド「.」を指定します。 停止シーケンスとして使用します。 Max tokens パラメーターは 50 に設定できます。

セットアップ・セクション
このテキストを 「セットアップ」 セクションの 「指示」 領域に貼り付けます。

Article:
###
Tomatoes are one of the most popular plants for vegetable gardens. 
Tip for success: If you select varieties that are resistant to 
disease and pests, growing tomatoes can be quite easy. For 
experienced gardeners looking for a challenge, there are endless 
heirloom and specialty varieties to cultivate. Tomato plants come 
in a range of sizes. There are varieties that stay very small, less 
than 12 inches, and grow well in a pot or hanging basket on a balcony 
or patio. Some grow into bushes that are a few feet high and wide, 
and can be grown is larger containers. Other varieties grow into 
huge bushes that are several feet wide and high in a planter or 
garden bed. Still other varieties grow as long vines, six feet or 
more, and love to climb trellises. Tomato plants do best in full 
sun. You need to water tomatoes deeply and often. Using mulch 
prevents soil-borne disease from splashing up onto the fruit when you 
water. Pruning suckers and even pinching the tips will encourage the 
plant to put all its energy into producing fruit.
###

Answer the following question using only information from the article. 
Answer in a complete sentence, with proper capitalization and punctuation. 
If there is no good answer in the article, say "I don't know".


「試行」セクション
「試行」 セクションで、以下の 2 つの質問のそれぞれを別個の行に貼り付けることができるように、追加のテスト行を追加します。

Why should you use mulch when growing tomatoes?

How do you grow cucumbers?

モデルを選択してパラメーターを設定し、 「生成」 をクリックして 2 つの結果を表示します。

サンプル: Granite を使用した文書に基づく質問への回答

シナリオ: ユーザーの質問に回答できるチャットボットを作成しています。 ユーザーが質問するときに、エージェントが特定の文書からの情報を使用して質問に回答するようにします。

モデル選択項目
granite-13b-instruct-v2などの命令チューニングされたモデルは、このサンプル・プロンプトを使用してタスクを完了できます。

Decoding
Greedy。 回答は、文書内の事実に基づいている必要があります。記事に適切な回答がない場合は、モデルは創造的ではなく、回答を作成する必要があります。

停止基準
最大トークン・パラメーター 50 を使用します。

プロンプト・テキスト
このゼロ・ショットのプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Given the document and the current conversation between a user and an agent, your task is as follows: Answer any user query by using information from the document. The response should be detailed.

DOCUMENT: Foundation models are large AI models that have billions of parameters and are trained on terabytes of data. Foundation models can do various tasks, including text, code, or image generation, classification, conversation, and more. Large language models are a subset of foundation models that can do text- and code-related tasks.
DIALOG: USER: What are foundation models?

サンプル: 日本語での一般的な秘密の質問への回答

シナリオ: 財務に関する一般的な質問に日本語で回答します。

モデルの選択
granite-8b-japanese モデルは、テキスト生成、要約、質問と回答、分類、および抽出などの複数のタスクに使用できます。

Decoding
Greedy。 このサンプルでは質問に回答しているため、クリエイティブ・アウトプットは必要ありません。

停止基準

  • ダイアログで多数のターンを許可するには、Max tokens パラメーターを 500 に設定します。
  • 2 つの改行文字の停止シーケンスを追加して、ファウンデーション・モデルが過度に長い応答を返さないようにします。 これを行うには、 「シーケンスの停止 (Stop sequence)」 テキスト・ボックスをクリックし、Enter キーを 2 回押してから、 「シーケンスの追加 (Add sequence)」をクリックします。

プロンプト・テキスト
モデルは、以下の形式の例を使用して、質問への回答のために調整されました。

以下は、タスクを説明する指示と、文脈のある入力の組み合わせです。要求を適切に満たす応答を書きなさい。

### 指示:
与えられた質問に対して、文脈がある場合はそれも利用し、回答してください。

### 入力:
{your-input}

### 応答:

英語では、テンプレートは以下のようになります。

Below is a combination of instructions that describe the task and input with context. Write a response that appropriately meets the request.

### Instructions:
Please use the context when answering the given question, if available.

### input:
{your-input}

### Response:

このプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定し、 {your-input} を照会または要求に置き換えてから、 「生成」 をクリックして結果を表示します。

例えば、このプロンプトは金利について尋ねます。

以下は、タスクを説明する指示と、文脈のある入力の組み合わせです。要求を適切に満たす応答を書きなさい。

### 指示:
与えられた質問に対して、文脈がある場合はそれも利用し、回答してください。

### 入力:
金利について教えてください。

### 応答:

サンプル: パッセージのタイトルの生成

シナリオ: 一節を指定して、コンテンツに適したタイトルを生成します。

モデルの選択
granite-7b-labを使用してください。多くのタイプの汎用タスクを実行できます。

Decoding
Greedy。 モデルは、プロンプトの内容に基づいてタイトルを生成する必要があります。あまりに創造的ではありません。

停止基準

  • 停止シーケンスとして <|endoftext|> を追加します。

    granite-7b-lab ファウンデーション・モデルの便利な機能の 1 つは、各応答の最後に <|endoftext|> という名前の特別なトークンを組み込むことです。 一部の生成モデルは、許可されている最大数より少ないトークン数で入力に対する応答を返す場合、入力からのパターンを繰り返すことができます。 このモデルは、プロンプトの信頼性の高い停止シーケンスを取り込むことにより、このような反復を防止します。

プロンプト・テキスト
モデルの応答方法の例を少なくとも 1 つ含めます。

このプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

プロンプトでコンテキストとして提供されるコンテンツは、製品資料の トークン化およびトークン化 から取得されます。

<|system|>
You are an AI language model developed by IBM Research. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior.

<|user|>
Generate a title from the given context.
Context:
Dana Blankstein- Cohen (born March 3, 1981) is the director of the Israeli Academy of Film and Television.\n\nShe is a film director, and an Israeli culture entrepreneur.\nLuciano Salce (25 September 1922, in Rome – 17 December 1989, in Rome) was an Italian film director, actor and lyricist.\n\nHis 1962 film "Le pillole di Ercole" was shown as part of a retrospective on Italian comedy at the 67th Venice International Film Festival.\n\nAs a writer of pop music, he used the pseudonym Pilantra.\n\nDuring World War II, he was a prisoner in Germany.\n\nHe later worked for several years in Brazil.\nVediamoci chiaro\n\n("Let\'s See It Clear") is a 1984 Italian comedy film directed by Luciano Salce.\n\nThe author Enrico Giacovelli referred to the film as "a kind of "Scent of a Woman" but more ambiguous, midway between Luigi Pirandello\'s "Henry IV" and "The Late Mattia Pascal.\nPeter Levin is an American director of film, television and theatre.\nIan Barry is an Australian director of film and TV.\nJesse Edward Hobson( May 2, 1911 – November 5, 1970) was the director of SRI International from 1947 to 1955.\n\nPrior to SRI, he was the director of the Armour Research Foundation.\nOlav Aaraas( born 10 July 1950) is a Norwegian historian and museum director.\n\nHe was born in Fredrikstad.\n\nFrom 1982 to 1993 he was the director of Sogn Folk Museum, from 1993 to 2010 he was the director of Maihaugen and from 2001 he has been the director of the Norwegian Museum of Cultural History.\n\nIn 2010 he was decorated with the Royal Norwegian Order of St. Olav.\nBrian O’ Malley is an Irish film director known for the horror film" Let Us Prey" and the ghost story" The Lodgers".\nBrian Patrick Kennedy( born 5 November 1961) is an Irish- born art museum director who has worked in Ireland and Australia, and now lives and works in the United States.\n\nHe is currently the director of the Peabody Essex Museum.\n\nHe was the director of the Toledo Museum of Art in Ohio from 2010 to 2019.\n\nHe was the director of the Hood Museum of Art from 2005 to 2010, and the National Gallery of Australia( Canberra) from 1997- 2004.

<|assistant|>
Directors Across Borders

<|user|>
Generate a title from the given context.
Context:
A token is a collection of characters that has semantic meaning for a model. Tokenization is the process of converting the words in your prompt into tokens.
You can monitor foundation model token usage in a project on the Environments page on the Resource usage tab.
Converting words to tokens and back again
Prompt text is converted to tokens before the prompt is processed by foundation models.
The correlation between words and tokens is complex:
Sometimes a single word is broken into multiple tokens
The same word might be broken into a different number of tokens, depending on context (such as: where the word appears, or surrounding words)
Spaces, newline characters, and punctuation are sometimes included in tokens and sometimes not
The way words are broken into tokens varies from language to language
The way words are broken into tokens varies from model to model
For a rough idea, a sentence that has 10 words might be 15 to 20 tokens.
The raw output from a model is also tokens. In the Prompt Lab in IBM watsonx.ai, the output tokens from the model are converted to words to be displayed in the prompt editor.

<|assistant|>

サンプル: パターン内のシーケンスの完了

シナリオ: パターンを指定して、シーケンス内の次の期待値を生成するようにモデルに依頼します。

モデルの選択
merlinite-7bを使用します。これにより、多くのタイプの汎用タスクを実行できます。

Decoding
Greedy。 モデルは、プロンプトの内容に基づいて回答を生成する必要があります。あまり創造的ではありません。

停止基準

  • 停止シーケンスとして <|endoftext|> を追加します。

    merlinite-7b ファウンデーション・モデルの有用な機能は、各応答の最後に <|endoftext|> という名前の特別なトークンが含まれていることです。 一部の生成モデルは、許可されている最大数より少ないトークン数で入力に対する応答を返す場合、入力からのパターンを繰り返すことができます。 このモデルは、プロンプトの信頼性の高い停止シーケンスを取り込むことにより、このような反復を防止します。

プロンプト・テキスト
モデルの応答方法の例を少なくとも 1 つ含めます。

このプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

<|system|>
You are an AI language model developed by IBM Research. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior.

<|user|>
Follow the pattern: A, C, E, G, ... What is the next letter?
<|assistant|>
The correct answer is I, as the sequence consists of every second letter in the English alphabet, starting with A (A, C, E, G, I...).

<|user|>
Follow the pattern: 5, 10, 15, 20, ... What comes next?
<|assistant|>

要約

要約タスクは、大量のテキストをいくつかの重要な情報に要約することで時間を節約します。

ゼロ・ショット・プロンプト付きのサンプル: ミーティングのトランスクリプトの要約

シナリオ: ミーティングのトランスクリプトを使用して、主要なポイントをミーティングのメモとして要約します。これにより、それらのメモを、ミーティングに参加しなかったチームメイトと共有することができます。

モデルの選択
インストラクション・チューニングされたモデルは、通常、このサンプル・プロンプトを使用してこのタスクを実行できます。 提案: flan-t5-xxl-11b、 flan-ul2-20b、または mixtral-8x7b-instruct-v01。

Decoding
Greedy。 モデルは、プロンプトの内容に基づいて、最も予測可能なコンテンツを返す必要があります。モデルがクリエイティブになりすぎることはありません。

停止基準
サマリーでは複数のセンテンスが実行される可能性があるため、「最大トークン数」パラメーターを 60 に設定します。

プロンプト・テキスト
このゼロ・ショットのプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Summarize the following transcript.
Transcript:
00:00   [alex]  Let's plan the team party!
00:10   [ali]   How about we go out for lunch at the restaurant?
00:21   [sam]   Good idea.
00:47   [sam]   Can we go to a movie too?
01:04   [alex]  Maybe golf?
01:15   [sam]   We could give people an option to do one or the other.
01:29   [alex]  I like this plan. Let's have a party!
Summary:

数回のプロンプトが表示されたサンプル: フリー・フォーム・モードでのミーティング記録の要約

シナリオ: ミーティングのトランスクリプトを使用して、主要なポイントをミーティングのメモとして要約します。これにより、それらのメモを、ミーティングに参加しなかったチームメイトと共有することができます。

モデルの選択
いくつかのショットの例を使用すると、ほとんどのモデルでこのタスクを適切に実行できます。 mixtral-8x7b-instruct-v01を試してください。

Decoding
Greedy。 モデルは、プロンプトの内容に基づいて最も予測可能なコンテンツを返す必要があり、あまり創造的ではありません。

停止基準

  • 要約の後でモデルがテキストの生成を停止するようにするには、2 つの改行文字の停止シーケンスを指定します。 これを行うには、 「シーケンスの停止 (Stop sequence)」 テキスト・ボックスをクリックし、Enter キーを 2 回押してから、 「シーケンスの追加 (Add sequence)」をクリックします。
  • Max tokens パラメーターを 60 に設定します。

プロンプト・テキスト
この数回ショットのプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Transcript:
00:00   [sam]   I wanted to share an update on project X today.
00:15   [sam]   Project X will be completed at the end of the week.
00:30   [erin]  That's great!
00:35   [erin]  I heard from customer Y today, and they agreed to buy our product.
00:45   [alex]  Customer Z said they will too.
01:05   [sam]   Great news, all around.
Summary:
Sam shared an update that project X will be complete at the end of the week. 
Erin said customer Y will buy our product. And Alex said customer Z will buy 
our product too.

Transcript:
00:00   [ali]   The goal today is to agree on a design solution.
00:12   [alex]  I think we should consider choice 1.
00:25   [ali]   I agree
00:40   [erin]  Choice 2 has the advantage that it will take less time.
01:03   [alex]  Actually, that's a good point.
01:30   [ali]   So, what should we do?
01:55   [alex]  I'm good with choice 2.
02:20   [erin]  Me too.
02:45   [ali]   Done!
Summary:
Alex suggested considering choice 1. Erin pointed out choice two will take 
less time. The team agreed with choice 2 for the design solution.

Transcript:
00:00   [alex]  Let's plan the team party!
00:10   [ali]   How about we go out for lunch at the restaurant?
00:21   [sam]   Good idea.
00:47   [sam]   Can we go to a movie too?
01:04   [alex]  Maybe golf?
01:15   [sam]   We could give people an option to do one or the other.
01:29   [alex]  I like this plan. Let's have a party!
Summary:

数回のプロンプトが表示されたサンプル: 構造化モードでのミーティング記録の要約

シナリオ: ミーティングのトランスクリプトを使用して、黒丸付きリストの主なポイントを要約し、ミーティングに参加しなかったチームメイトとリストを共有できるようにします。

モデルの選択
mixtral-8x7b-instruct-v01 ファウンデーション・モデルは、改行文字などの特殊文字を認識して処理するようにトレーニングされました。 このモデルは、生成されたテキストを特殊文字を使用して特定の方法でフォーマットする場合に適しています。

Decoding
Greedy。 モデルは、プロンプトの内容に基づいて、最も予測可能なコンテンツを返す必要があります。モデルがクリエイティブになりすぎることはありません。

停止基準

  • モデルが 1 つのリストの後でテキストの生成を停止するようにするには、2 つの改行文字の停止シーケンスを指定します。 これを行うには、 「シーケンスの停止 (Stop sequence)」 テキスト・ボックスをクリックし、Enter キーを 2 回押してから、 「シーケンスの追加 (Add sequence)」をクリックします。
  • Max tokens パラメーターを 60 に設定します。

セットアップ・セクション
以下のヘッダーと例を 「セットアップ」 セクションの 「例」 領域に貼り付けます。

テーブル4。 要約のいくつかのショットの例
Transcript: Summary:
00:00 [sam] I wanted to share an update on project X today.
00:15   [sam]   Project X will be completed at the end of the week.
00:30   [erin]  That's great!
00:35   [erin]  I heard from customer Y today, and they agreed to buy our product.
00:45   [alex]  Customer Z said they will too.
01:05   [sam]  Great news, all around.
- Sam shared an update that project X will be complete at the end of the week
- Erin said customer Y will buy our product
- And Alex said customer Z will buy our product too
00:00   [ali]   The goal today is to agree on a design solution.
00:12   [alex]  I think we should consider choice 1.
00:25   [ali]   I agree
00:40   [erin]  Choice 2 has the advantage that it will take less time.
01:03   [alex]  Actually, that's a good point.
01:30   [ali]   So, what should we do?
01:55   [alex]  I'm good with choice 2.
02:20   [erin]  Me too.
02:45  [ali]   Done!
- Alex suggested considering choice 1
- Erin pointed out choice two will take less time
- The team agreed with choice 2 for the design solution


試行セクション
このメッセージを 「試行」 セクションに貼り付けます。

00:00   [alex]  Let's plan the team party!
00:10   [ali]   How about we go out for lunch at the restaurant?
00:21   [sam]   Good idea.
00:47   [sam]   Can we go to a movie too?
01:04   [alex]  Maybe golf?
01:15   [sam]   We could give people an option to do one or the other.
01:29   [alex]  I like this plan. Let's have a party!

モデルを選択してパラメーターを設定し、 「生成」 をクリックして結果を表示します。

サンプル: 韓国語での内容の集計

シナリオ: 韓国語の一節を考えると、主なポイントを要約します。

モデルの選択
llama2-13b-dpo-v7を使用します。これにより、多くのタイプの汎用タスクを韓国語で実行できます。

Decoding
Greedy。 モデルは、プロンプトの内容に基づいて最も予測可能なコンテンツを返す必要があり、あまり創造的ではありません。

停止基準

  • Max tokens パラメーターを 200 に設定します。

プロンプト・テキスト
コンテンツを要約するようにファウンデーション・モデルに指示する命令を含めます。 このような命令を英語で翻訳すると、次のようになります。

Briefly summarize the main points presented in the text 
in 3 to 5 sentences without repeating the document.
Document:

このプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

<|user|>
다음 문서를 3~5문장으로 반복되는 구문없이 텍스트에 제시된 주요 는거를 간략하게 요약해줘
문서:
토마토는 채소밭에 가장 인기 있는 식물 중 하나입니다. 성공을 위한 팁: 질병과 해충에 강한 품종을 선택하면 토마토 재배가 매우 쉬울 수 있습니다. 도전을 원하는 숙련된 정원사에게는 경작할 수 있는 가보와 특산 품종이 끝없이 많이 있습니다. 토마토 식물은 다양한 크기로 제공됩니다.
<|assistant|>
요약:

要約される一節は、以下のように英語に翻訳されます。

トマトは植物園で最も人気のある植物の一つである。 成功のヒント: 病気や害虫に耐性のある品種を選択すると、トマトの生育が非常に簡単になる可能性があります。 チャレンジを求める熟練した庭師には、養殖すべき果てしないヘイルルームや特殊品種が存在する。 トマトの植物の大きさは多岐にわたる。

このファウンデーション・モデルに推奨されている <|user|> および <|assistant|> の推奨構文に従うことを忘れないでください。 ファウンデーション・モデルが要約を返すことを期待することを示すために、必ず cue (Summary:) を含めてください。

サンプル: パッセージのタイトルの生成

シナリオ: 一節を指定して、テキストの主題をキャプチャーするコンテンツの適切なタイトルを生成します。

モデルの選択
granite-7b-labを使用してください。多くのタイプの汎用タスクを実行できます。

Decoding
Greedy。 モデルは、プロンプトの内容に基づいてタイトルを生成する必要があります。あまりに創造的ではありません。

停止基準

  • 停止シーケンスとして <|endoftext|> を追加します。

    granite-7b-lab ファウンデーション・モデルの便利な機能の 1 つは、各応答の最後に <|endoftext|> という名前の特別なトークンを組み込むことです。 一部の生成モデルは、許可されている最大数より少ないトークン数で入力に対する応答を返す場合、入力からのパターンを繰り返すことができます。 このモデルは、プロンプトの信頼性の高い停止シーケンスを取り込むことにより、このような反復を防止します。

プロンプト・テキスト
モデルの応答方法の例を少なくとも 1 つ含めます。

granite-7b-lab ファウンデーション・モデルの機能の 1 つは、ファウンデーション・モデルのモデル・カードから 「トレーニング分類法」 ページを開くことで、モデルがトレーニングされたスキルを確認できることです。

例えば、分類法は、 granite-7b-lab ファウンデーション・モデルが title スキルでトレーニングされたことを示しています。 スキルをクリックすると、モデルのトレーニングに使用された合成データのシード・サンプルとして使用されたサンプルが表示されます。 これらのスキル固有の例のいずれかの後に、1 回限りのプロンプトに含める例をモデル化できます。 プロンプトに対して同様のスタイルと形式を使用すると、モデル出力で予期される内容をモデルが認識するのに役立ちます。

注: ファウンデーション・モデルの出力が、タクソノミー内のスキルの例からのモデル出力と完全に同じであるとは想定しないでください。 これらの例は、基礎モデルを直接トレーニングするためには使用されませんでした。 これらのサンプルは、ファウンデーション・モデルのトレーニングに使用された新しいサンプルを生成した合成データのシード・サンプルとして機能します。

このプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。 この例は、タイトル・スキル・シードの例に由来します。 プロンプトでコンテキストとして提供されるコンテンツは、製品資料の トークン化およびトークン化 から取得されます。

Question
Generate a title from the given text.
Context
Dana Blankstein- Cohen (born March 3, 1981) is the director of the Israeli Academy of Film and Television.\n\nShe is a film director, and an Israeli culture entrepreneur.\nLuciano Salce (25 September 1922, in Rome – 17 December 1989, in Rome) was an Italian film director, actor and lyricist.\n\nHis 1962 film "Le pillole di Ercole" was shown as part of a retrospective on Italian comedy at the 67th Venice International Film Festival.\n\nAs a writer of pop music, he used the pseudonym Pilantra.\n\nDuring World War II, he was a prisoner in Germany.\n\nHe later worked for several years in Brazil.\nVediamoci chiaro\n\n("Let\'s See It Clear") is a 1984 Italian comedy film directed by Luciano Salce.\n\nThe author Enrico Giacovelli referred to the film as "a kind of "Scent of a Woman" but more ambiguous, midway between Luigi Pirandello\'s "Henry IV" and "The Late Mattia Pascal.\nPeter Levin is an American director of film, television and theatre.\nIan Barry is an Australian director of film and TV.\nJesse Edward Hobson( May 2, 1911 – November 5, 1970) was the director of SRI International from 1947 to 1955.\n\nPrior to SRI, he was the director of the Armour Research Foundation.\nOlav Aaraas( born 10 July 1950) is a Norwegian historian and museum director.\n\nHe was born in Fredrikstad.\n\nFrom 1982 to 1993 he was the director of Sogn Folk Museum, from 1993 to 2010 he was the director of Maihaugen and from 2001 he has been the director of the Norwegian Museum of Cultural History.\n\nIn 2010 he was decorated with the Royal Norwegian Order of St. Olav.\nBrian O’ Malley is an Irish film director known for the horror film" Let Us Prey" and the ghost story" The Lodgers".\nBrian Patrick Kennedy( born 5 November 1961) is an Irish- born art museum director who has worked in Ireland and Australia, and now lives and works in the United States.\n\nHe is currently the director of the Peabody Essex Museum.\n\nHe was the director of the Toledo Museum of Art in Ohio from 2010 to 2019.\n\nHe was the director of the Hood Museum of Art from 2005 to 2010, and the National Gallery of Australia( Canberra) from 1997- 2004.

Answer
Directors Across Borders: A Comparative Study of International Film and Museum Directors, from Luciano Salce to Brain Patrick Kennedy

Question
Generate a title from the given text.
Context
A token is a collection of characters that has semantic meaning for a model. Tokenization is the process of converting the words in your prompt into tokens.
You can monitor foundation model token usage in a project on the Environments page on the Resource usage tab.
Converting words to tokens and back again
Prompt text is converted to tokens before the prompt is processed by foundation models.
The correlation between words and tokens is complex:
Sometimes a single word is broken into multiple tokens
The same word might be broken into a different number of tokens, depending on context (such as: where the word appears, or surrounding words)
Spaces, newline characters, and punctuation are sometimes included in tokens and sometimes not
The way words are broken into tokens varies from language to language
The way words are broken into tokens varies from model to model
For a rough idea, a sentence that has 10 words might be 15 to 20 tokens.
The raw output from a model is also tokens. In the Prompt Lab in IBM watsonx.ai, the output tokens from the model are converted to words to be displayed in the prompt editor.

Answer

コード生成と変換

プログラマチック・コードを生成および変換できるファウンデーション・モデルは、開発者向けの優れたリソースです。 開発者がプログラミング・タスクのブレインストーミングおよびトラブルシューティングを行うのに役立ちます。

サンプル: 命令からのプログラマチック・コードの生成

シナリオ: 命令からコードを生成する必要があります。 つまり、ストリングを反転させる関数を Python プログラミング言語で作成したいとします。

モデルの選択
codellama-34b-instruct-hf や mixtral-8x7b-instruct-v01 など、コードを生成できるモデルは、通常、サンプル・プロンプトが提供されている場合にこのタスクを実行できます。

Decoding
Greedy。 回答は有効なコード・スニペットでなければなりません。 モデルは創造的ではなく、回答を構成することはできません。

停止基準
単一のコード・スニペットを返した後でモデルを停止するには、停止シーケンスとして <end of code> を指定します。 Max tokens パラメーターは 1,000 に設定できます。

プロンプト・テキスト
このコード・スニペットをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Using the directions below, generate Python code for the specified task.

Input:
# Write a Python function that prints 'Hello World!' string 'n' times.

Output:
def print_n_times(n):
    for i in range(n):
        print("Hello World!")

<end of code>

Input:
# Write a Python function that reverses the order of letters in a string.
# The function named 'reversed' takes the argument 'my_string', which is a string. It returns the string in reverse order.

Output:

出力には、以下のスニペットのような Python コードが含まれます。

def reversed(my_string):
    return my_string[::-1]

生成されたコードをテストして、予期したとおりに動作することを確認してください。

例えば、 reversed("good morning")を実行すると、結果は 'gninrom doog'になります。

注: ファウンデーション・モデルは、トレーニング・データから直接取得されるコードを生成する場合があります。 結果として、生成されたコードは属性指定を必要とする場合があります。 使用する生成されたコードが、必要に応じて適切に帰属することを確認するのは、お客様の責任です。

サンプル: あるプログラミング言語から別のプログラミング言語へのコードの変換

シナリオ: あるプログラミング言語から別のプログラミング言語にコードを変換するとします。 つまり、コード・スニペットを C++ から Pythonに変換するとします。

モデルの選択
codellama-34b-instruct-hf や mixtral-8x7b-instruct-v01 など、コードを生成できるモデルは、通常、サンプル・プロンプトが提供されている場合にこのタスクを実行できます。

Decoding
Greedy。 回答は有効なコード・スニペットでなければなりません。 モデルは創造的ではなく、回答を構成することはできません。

停止基準
単一のコード・スニペットを返した後でモデルを停止するには、停止シーケンスとして <end of code> を指定します。 Max tokens パラメーターは 300 に設定できます。

プロンプト・テキスト
このコード・スニペットをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

このプロンプトには、入力と出力のペアの例が含まれています。 入力は C++ コードで、出力は Python コードの同等の関数です。

次に、変換する C++ コード・スニペットを示します。 これは、算術の進行数を合計 SDの一般的な差でカウントする関数です。ここで、 SD は、パラメーターとして渡される整数値です。

プロンプトの最後の部分は、C++ コード・スニペットを変換する言語を識別します。

Translate the following code from C++ to Python.

C++:
#include "bits/stdc++.h"
using namespace std;
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
void checkSunnyNumber(int N) {
  if (isPerfectSquare(N + 1)) {
    cout << "Yes
";
  } else {
    cout << "No
";
  }
}
int main() {
  int N = 8;
  checkSunnyNumber(N);
  return 0;
}

Python:
from math import *
 
def isPerfectSquare(x):
    sr = sqrt(x)
    return ((sr - floor(sr)) == 0)
 
def checkSunnyNumber(N):
    if (isPerfectSquare(N + 1)):
        print("Yes")
    else:
        print("No")
 
if __name__ == '__main__':
    N = 8
    checkSunnyNumber(N)

<end of code>

C++:
#include <bits/stdc++.h>
using namespace std;
int countAPs(int S, int D) {
  S = S * 2;
  int answer = 0;
  for (int i = 1; i <= sqrt(S); i++) {
    if (S % i == 0) {
      if (((S / i) - D * i + D) % 2 == 0)
        answer++;
      if ((D * i - (S / i) + D) % 2 == 0)
        answer++;
    }
  }
  return answer;
}
int main() {
  int S = 12, D = 1;
  cout << countAPs(S, D);
  return 0;
}

Python:

出力には、以下のスニペットのような Python コードが含まれます。

from math import *
 
def countAPs(S, D):
    S = S * 2
    answer = 0
    for i in range(1, int(sqrt(S)) + 1):
        if S % i == 0:
            if (((S / i) - D * i + D) % 2 == 0):
                answer += 1
            if ((D * i - (S / i) + D) % 2 == 0):
                answer += 1
    return answer
 
if __name__ == '__main__':
    S = 12
    D = 1
    print(countAPs(S, D))

<end of code>

生成された Python コードは、プロンプトに含まれる C++ コードと同じように機能します。

生成された Python コードをテストして、予期したとおりに動作することを確認します。

注: ファウンデーション・モデルは、トレーニング・データから直接取得されるコードを生成する場合があります。 結果として、生成されたコードは属性指定を必要とする場合があります。 使用する生成されたコードが、必要に応じて適切に帰属することを確認するのは、お客様の責任です。

サンプル: Granite を使用した命令からのプログラマチック・コードの生成

シナリオ: 命令からコードを生成する必要があります。 つまり、ストリングを反転させる関数を Python プログラミング言語で作成したいとします。

モデルの選択
Granite Code Instruct モデルなど、コードを生成できるモデルは、通常、サンプル・プロンプトが提供されている場合にこのタスクを実行できます。

Decoding
Greedy。 回答は有効なコード・スニペットでなければなりません。 モデルは創造的ではなく、回答を構成することはできません。

停止基準
単一のコード・スニペットを返した後でモデルを停止するには、停止シーケンスとして <end of code> を指定します。 Max tokens パラメーターは 00 に設定できます。

プロンプト・テキスト
このコード・スニペットをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Question:
Using the directions below, generate Python code for the specified task.
# Write a Python function that prints 'Hello World!' string 'n' times.

Answer:
def print_n_times(n):
    for i in range(n):
        print("Hello World!")

<end of code>

Question:
# Write a Python function that reverses the order of letters in a string.
# The function named 'reversed' takes the argument 'my_string', which is a string. It returns the string in reverse order.

Answer:

出力には、以下のスニペットのような Python コードが含まれます。

def reverse_string(my_string):
    return my_string[::-1]

<end of code>

生成されたコードをテストして、予期したとおりに動作することを確認してください。

例えば、 reversed("good morning")を実行すると、結果は 'gninrom doog'になります。

サンプル: Granite を使用したあるプログラミング言語から別のプログラミング言語へのコードの変換

シナリオ: あるプログラミング言語から別のプログラミング言語にコードを変換するとします。 つまり、コード・スニペットを C++ から Pythonに変換するとします。

モデルの選択
Granite Code Instruct モデルなど、コードを生成できるモデルは、通常、サンプル・プロンプトが提供されている場合にこのタスクを実行できます。

Decoding
Greedy。 回答は有効なコード・スニペットでなければなりません。 モデルは創造的ではなく、回答を構成することはできません。

停止基準
単一のコード・スニペットを返した後でモデルを停止するには、停止シーケンスとして <end of code> を指定します。 Max tokens パラメーターは 1,000 に設定できます。

プロンプト・テキスト
このコード・スニペットをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

このプロンプトには、C++ から Pythonにコード・スニペットを変換するための命令が含まれています。

変換される C++ コード・スニペットは、コンテキストを提供するために次に組み込まれます。 これは、算術の進行数を合計 SDの一般的な差でカウントする関数です。ここで、 SD は、パラメーターとして渡される整数値です。

Question:
Translate the following code from C++ to Python.
C++:
#include "bits/stdc++.h"
using namespace std;
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
void checkSunnyNumber(int N) {
  if (isPerfectSquare(N + 1)) {
    cout << "Yes
";
  } else {
    cout << "No
";
  }
}
int main() {
  int N = 8;
  checkSunnyNumber(N);
  return 0;
}

Answer:
Python:
from math import *
 
def isPerfectSquare(x):
    sr = sqrt(x)
    return ((sr - floor(sr)) == 0)
 
def checkSunnyNumber(N):
    if (isPerfectSquare(N + 1)):
        print("Yes")
    else:
        print("No")
 
if __name__ == '__main__':
    N = 8
    checkSunnyNumber(N)

<end of code>

Question:
Translate the following code from C++ to Python.
C++:
#include <bits/stdc++.h>
using namespace std;
int countAPs(int S, int D) {
  S = S * 2;
  int answer = 0;
  for (int i = 1; i <= sqrt(S); i++) {
    if (S % i == 0) {
      if (((S / i) - D * i + D) % 2 == 0)
        answer++;
      if ((D * i - (S / i) + D) % 2 == 0)
        answer++;
    }
  }
  return answer;
}
int main() {
  int S = 12, D = 1;
  cout << countAPs(S, D);
  return 0;
}

Answer:

出力には、以下のスニペットのような Python コードが含まれます。

Python:
from math import *
 
def countAPs(S, D):
    S = S * 2
    answer = 0
    for i in range(1, int(sqrt(S)) + 1):
        if S % i == 0:
            if ((S // i) - D * i + D) % 2 == 0:
                answer += 1
            if (D * i - (S // i) + D) % 2 == 0:
                answer += 1
    return answer
 
if __name__ == '__main__':
    S = 12
    D = 1
    print(countAPs(S, D))

生成された Python コードは、プロンプトに含まれる C++ コードと同じように機能します。

生成された Python コードをテストして、予期したとおりに動作することを確認します。

ダイアログ

ダイアログ・タスクは、顧客サービスのシナリオで役立ちます。特に、チャットボットを使用して、顧客が目標を達成するためのワークフローをガイドする場合に役立ちます。

サンプル: Llama 3 との会話

シナリオ: チャットボットのようなダイアログ出力を生成します。

モデルの選択
Llama 3 (700 億サイズと 80 億サイズの両方) は、ダイアログのユース・ケース向けに最適化されています。 llama-3-70b-instruct および llama-3-8b-instruct は、 「プロンプト・テキスト」 セクションで説明されている特定のプロンプト形式に合わせて微調整されます。

Decoding
Greedy。 このサンプルでは、一般的な知識と事実に基づく質問に答えます。そのため、創造的な出力は必要ありません。

停止基準
最大トークン数パラメーターを 900 に設定します。

Llama 3 のテンプレートは、end-of-text トークン (<|eot_id|>) を使用して、システム・プロンプトを除くテキストの各セグメントの終わりを区切ります。

プロンプト・テキスト
以下のプロンプト・テンプレートは、 Llama 3 ファウンデーション・モデルに送信する入力に最適です。

<|begin_of_text|><|start_header_id|>system<|end_header_id|>

SYSTEM PROMPT<|eot_id|><|start_header_id|>user<|end_header_id|>

GROUNDING (OPTIONAL)<|eot_id|><|start_header_id|>user<|end_header_id|>

USER_INPUT<|eot_id|><|start_header_id|>assistant<|end_header_id|>

このプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

ヒント:

あるいは、チャット・モードに切り替えて、ユーザー入力を直接入力することもできます。 プロンプト・ラボは、命令およびユーザー入力セグメントを識別する、予期される構文を挿入します。

<|begin_of_text|><|start_header_id|>system<|end_header_id|>

You are a helpful assistant that avoids causing harm. When you do not know the answer to a question, you say "I don't know".<|eot_id|><|start_header_id|>user<|end_header_id|>

I have a question about Earth. How many moons are there?<|eot_id|><|start_header_id|>assistant<|end_header_id|>

初期出力が生成されたら、ダイアログを続行して、入力テキストの末尾に同じ ID を追加して、さらに多くの惑星について尋ねます。以下に例を示します。

FOLLOW UP QUESTION<|eot_id|><|start_header_id|>assistant<|end_header_id|>


出力は以下のようになります。

<|begin_of_text|><|start_header_id|>system<|end_header_id|>

You are a helpful assistant that avoids causing harm. When you do not know the answer to a question, you say "I don't know".<|eot_id|><|start_header_id|>user<|end_header_id|>

I have a question about Earth. How many moons are there?<|eot_id|><|start_header_id|>assistant<|end_header_id|>

That's an easy one! Earth has only one moon.

What about Saturn?<|eot_id|><|start_header_id|>assistant<|end_header_id|>

Saturn has a whopping 82 confirmed moons!

And Mars?<|eot_id|><|start_header_id|>assistant<|end_header_id|>

Mars has two small natural satellites, Phobos and Deimos.

以下のサンプル・プロンプトには、接地情報が含まれています。

<|begin_of_text|><|start_header_id|>system<|end_header_id|>

You are a helpful assistant that avoids causing harm. When you do not know the answer to a question, you say "I don't know".<|eot_id|><|start_header_id|>user<|end_header_id|>

The sky is blue.<|eot_id|><|start_header_id|>user<|end_header_id|>

What color is the sky?<|eot_id|><|start_header_id|>assistant<|end_header_id|>

サンプル: Llama 2 との会話

シナリオ: チャットボットのようなダイアログ出力を生成します。

モデルの選択
他のファウンデーション・モデルと同様に、 Llama 2 (700 億と 130 億の両方のサイズ) を複数のタスクに使用できます。 ただし、どちらの Llama 2 モデルも、ダイアログのユース・ケース用に最適化されています。 llama-2-70b-chat および llama-2-13b-chat は、 [INST]<<SYS>><</SYS>>[/INST] プロンプト形式に合わせて微調整されます。 このプロンプト形式について詳しくは、 How to prompt Llama 2を参照してください。

Decoding
Greedy。 このサンプルでは、一般的な知識と事実に基づく質問に答えます。そのため、創造的な出力は必要ありません。

停止基準
「最大トークン数」パラメーターを 100 に設定します。

Llama 2 のテンプレートは、end-of-string (EOS) トークン (</s>) を使用して、エージェントの応答の終わりを区切ります。 </s> EOS トークンが検出されると、モデル出力はテキストの生成を停止します。

プロンプト・テキスト
このプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

[INST] <<SYS>>
You are a helpful assistant. Begin each response with the phrase "Dear user, ". If you are unsure about an answer, truthfully say "I don't know"<</SYS>>

I have a question about the Earth.[/INST]
Dear user, go on.
[INST]

How many moons are there?
[/INST]

初期出力が生成されたら、ダイアログを続行して、同じ [INST][/INST] 構造でユーザー・メッセージを折り返し、さらに多くの惑星について尋ねます。 フォローアップ質問の先頭に <s> トークンを追加する必要はありません。

ヒント:

あるいは、チャット・モードに切り替えて、ユーザー入力を直接入力することもできます。 プロンプト・ラボは、命令およびユーザー入力セグメントを識別する、予期される構文を挿入します。

出力は以下のようになります。

[INST] <<SYS>>
You are a helpful assistant. Begin each response with the phrase "Dear user, ". If you are unsure about an answer, truthfully say "I don't know"<</SYS>>

I have a question about the Earth.[/INST]
Dear user, go on.
[INST]

How many moons are there?
[/INST]
Dear user, the Earth has one natural satellite, commonly referred to as the Moon. 
[INST]

What about Saturn?
[/INST]
Dear user, Saturn has a total of 62 confirmed moons, as well as numerous smaller moonlets and ring particles. The largest moon of Saturn is Titan, which is the second-largest moon in the solar system, after Jupiter's moon Ganymede. 
[INST]

And Mars?
[/INST]
Dear user, Mars has two small natural satellites, Phobos and Deimos. Both moons are thought to be captured asteroids, and are irregularly shaped and very small, with diameters of about 22 kilometers and 12 kilometers respectively.

モデルによって生成される出力について、いくつかの重要な点に注意してください。

  • <<SYS>><</SYS>> タグ内のいわゆる システム命令は、システム命令を繰り返すことなく、ダイアログのターンごとに出力に影響を与え続けます。 つまり、 アシスタント応答 の前には引き続き「Dear user,」が付加されます。
  • 実際のダイアログ方式では、アシスタントは ユーザー入力 「How many moons are there?」に応答します。 前のユーザー入力「地球に関する質問があります」を考慮します。 地球を周回する衛星の数を返します
  • また、適切なダイアログ形式では、アシスタントの応答は会話のトピック (月の数) の後に続きます。 (それ以外の場合、生成された出力は、あいまいなユーザー・メッセージ「And Mars?」に送られます。 どんな方向にも歩き回ることができました。)
  • 注意: 特に改行 (復帰) 文字、およびプロンプト・テキスト内のスペースは、生成される出力に劇的な影響を与える可能性があります。
  • チャットのユース・ケースに Llama 2 を使用する場合は、推奨されるプロンプト・テンプレートの形式にできるだけ厳密に従ってください。 チャット以外のタスクに Llama 2 を使用する場合は、 [INST]<<SYS>><</SYS>>[/INST] プロンプト形式を使用しないでください。

サンプル: granite-13b-chat-v2 との会話

シナリオ: チャットボットのようなダイアログ出力を生成します。

モデルの選択
ダイアログを継続するには、 granite-13b-chat-v2 を使用します。

Decoding (デコード)

  • サンプリング・デコードを使用します。
  • 「トップ P」を 0.85に設定します。
  • 反復ペナルティーを 1.2に設定します。

停止基準

  • 「最大トークン数パラメーター」 を 500 に設定すると、モデルは完全な回答を返すことができますが、可能な限り簡潔になります。

プロンプト・テキスト
モデルの安全性を向上させ、バイアスを軽減するには、ユーザー入力の一部としてシステム・プロンプトを追加します。 システム・プロンプトは、ダイアログのいくつかの基本規則を設定することができます。 例:

あなたは Granite チャットです。 IBMが開発した AI 言語モデルです。 君は用心深い助手だ。 指示には慎重に従ってください。 あなたは役に立たず、無害であり、倫理的なガイドラインに従い、前向きな行動を促進します。 回答は短くし、要点を把握しておいてください。

モデルで予期されるプロンプト・テンプレート形式を使用することを忘れないでください。

< |system |>
システム・プロンプト
< |user |>
質問の内容
< |assistant |>
モデルの回答の新しい行

このモデルに数回のプロンプトを送信する場合は、システム・プロンプトを追加してから、例を追加し、その後に推論されるプロンプト・テキストを続けることができます。

<|system|>
You are Granite Chat, an AI language model developed by IBM. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior. Keep your answers short and to the point.
<|user|>
Example prompt 1
<|assistant|>
Example response 1

<|user|>
Example prompt 2
<|assistant|>
Example response 2

<|user|>
USER INPUT
<|assistant|>

以下のプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

ヒント:

あるいは、チャット・モードに切り替えて、ユーザー入力を直接入力することもできます。 プロンプト・ラボは、命令およびユーザー入力セグメントを識別する、予期される構文を挿入します。

<|system|>
You are Granite Chat, an AI language model developed by IBM. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior. Keep your answers short and to the point.
<|user|>
I have a question about the Earth. How many moons are there?
<|assistant|>

<|assistant|> ラベルの後に末尾の空白文字を含めないでください。また、必ず新しい行を追加してください。

最初の出力が生成されたら、フォローアップの質問をしてダイアログを続行できます。 例えば、他の惑星の月について尋ねることができます。

<|user|>
What about Saturn?

<|assistant|>

その後、別の補足質問を使用して会話を続けます。

<|user|>
And Mars?

<|assistant|>

モデル出力が長すぎる場合は、 「シーケンスの停止」 テキスト・ボックスをクリックし、Enter キーを 2 回押してから 「シーケンスの追加」をクリックすることにより、2 つの改行文字の停止シーケンスの指定を試みることができます。 ただし、通常は反復ペナルティーでモデルを軌道に乗せることができます。

モデルでのこのサンプルの使用に関するいくつかの注意事項を以下に示します。

  • システム・プロンプトにより、モデルの一般的なガードレールがいくつか設定されます。
  • アシスタントは、同じダイアログ内の以前の交換からの情報に依存するフォローアップの質問に応答することができます。
  • このモデルでは、入力が特定のパターンに従うことが想定されており、空白が誤って配置されている可能性があります。

サンプル: granite-8b-japanese を使用した日本語の会話

シナリオ: チャットボットのような日本語のダイアログ出力を生成します。

モデルの選択
granite-8b-japanese ファウンデーション・モデルを使用して、日本語のダイアログに参加することができます。 granite-8b-japanese ファウンデーション・モデルは、モデルのトレーニング時に使用したものと同じプロンプト形式を使用すると最適に機能します。

Decoding
Greedy。 このサンプルでは、一般的な知識と事実に基づく質問に答えます。そのため、創造的な出力は必要ありません。

停止基準

  • ダイアログで多数のターンを許可するには、Max tokens パラメーターを 500 に設定します。
  • 2 つの改行文字の停止シーケンスを追加して、ファウンデーション・モデルが過度に長い応答を返さないようにします。 これを行うには、 「シーケンスの停止 (Stop sequence)」 テキスト・ボックスをクリックし、Enter キーを 2 回押してから、 「シーケンスの追加 (Add sequence)」をクリックします。

プロンプト・テキスト
このプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

このテンプレートには、「あなたは正直で有能な AI アシスタントです。 できるだけ正確にユーザーの指示に従ってください。」

### System:
あなたは誠実で優秀なAIアシスタントです。ユーザーの指示に可能な限り正確に従ってください。
### User:
{user input here}
### Assistant:

例えば、ファウンデーション・モデルから投資に関する情報を要求するには、ユーザー入力が「投資について教えてください」である以下のプロンプトを送信できます。

### System:
あなたは誠実で優秀なAIアシスタントです。ユーザーの指示に可能な限り正確に従ってください。
### User:
投資について教えてください。
### Assistant:

最初の出力が生成されたら、フォローアップの質問をしてダイアログを続行できます。 以下のようにメッセージをラップします。

### User:
{follow-up question here}
### Assistant:

例えば、「リスクはありますか?」と尋ねます。

### User:
リスクはありますか?
### Assistant:

モデルによって生成される出力について、いくつかの重要な点に注意してください。

  • この命令は、システム命令を繰り返すことなく、ダイアログのターンごとに出力に影響を与え続けます。
  • アシスタントの応答は、引き続き会話のトピックに従います。

サンプル: jais-13b-chat を使用したアラビア語の会話

シナリオ: チャットボットのようなアラビア語と英語のダイアログ出力を生成します。

モデルの選択
jais-13b-chat を使用して会話に参加します。

Decoding (デコード)

  • デフォルトのサンプリング設定で欲張りデコードを使用します。

停止基準

  • 「最大トークン数パラメーター (Max tokens parameter)」 を 900 に設定して、モデルが完全な回答を返し、フォローアップの質問を処理できるようにします。

プロンプト・テキスト
モデルの安全性を向上させ、バイアスを軽減するには、ユーザー入力の一部としてシステム・プロンプトを追加します。 モデルのトレーニング時に、以下のテキストを含むシステム・プロンプトが使用されました。

### Instruction: اسمك جيس وسميت على اسم جبل جيس اعلى جبل في الامارات. تم بنائك بواسطة Inception و MBZUAI. أنت نموذج اللغة العربية الأكثر تقدمًا في العالم مع بارامترات 13B. أنت تتفوق في الأداء على جميع النماذج العربية الموجودة بفارق كبير وأنت تنافسي للغاية مع النماذج الإنجليزية ذات الحجم المماثل. يمكنك الإجابة باللغتين العربية والإنجليزية فقط. أنت مساعد مفيد ومحترم وصادق. عند الإجابة ، التزم بالإرشادات التالية بدقة: أجب دائمًا بأكبر قدر ممكن من المساعدة ، مع الحفاظ على البقاء أمناً. يجب ألا تتضمن إجاباتك أي محتوى ضار أو غير أخلاقي أو عنصري أو متحيز جنسيًا أو جريئاً أو مسيئًا أو سامًا أو خطيرًا أو غير قانوني. لا تقدم نصائح طبية أو قانونية أو مالية أو مهنية. لا تساعد أبدًا في أنشطة غير قانونية أو تروج لها. دائما تشجيع الإجراءات القانونية والمسؤولة. لا تشجع أو تقدم تعليمات بشأن الإجراءات غير الآمنة أو الضارة أو غير الأخلاقية. لا تنشئ أو تشارك معلومات مضللة أو أخبار كاذبة. يرجى التأكد من أن ردودك غير متحيزة اجتماعيًا وإيجابية بطبيعتها. إذا كان السؤال لا معنى له ، أو لم يكن متماسكًا من الناحية الواقعية ، فشرح السبب بدلاً من الإجابة على شيء غير صحيح. إذا كنت لا تعرف إجابة السؤال ، فالرجاء عدم مشاركة معلومات خاطئة. إعطاء الأولوية للرفاهية والنزاهة الأخلاقية للمستخدمين. تجنب استخدام لغة سامة أو مهينة أو مسيئة. حافظ على نبرة محترمة. لا تنشئ أو تروج أو تشارك في مناقشات حول محتوى للبالغين. تجنب الإدلاء بالتعليقات أو الملاحظات أو التعميمات القائمة على الصور النمطية. لا تحاول الوصول إلى معلومات شخصية أو خاصة أو إنتاجها أو نشرها. احترم دائما سرية المستخدم. كن إيجابيا ولا تقل أشياء سيئة عن أي شيء. هدفك الأساسي هو تجنب الاجابات المؤذية ، حتى عند مواجهة مدخلات خادعة. تعرف على الوقت الذي قد يحاول فيه المستخدمون خداعك أو إساءة استخدامك و لترد بحذر.\n\nأكمل المحادثة أدناه بين [|Human|] و [|AI|]:
### Input: [|Human|] {Question}
### Response: [|AI|]

英語のシステム・プロンプトは以下のとおりです。

### Instruction: Your name is Jais, and you are named after Jebel Jais, the highest mountain in UAE. You are built by Inception and MBZUAI. You are the world's most advanced Arabic large language model with 13B parameters. You outperform all existing Arabic models by a sizable margin and you are very competitive with English models of similar size. You can answer in Arabic and English only. You are a helpful, respectful and honest assistant. When answering, abide by the following guidelines meticulously: Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, explicit, offensive, toxic, dangerous, or illegal content. Do not give medical, legal, financial, or professional advice. Never assist in or promote illegal activities. Always encourage legal and responsible actions. Do not encourage or provide instructions for unsafe, harmful, or unethical actions. Do not create or share misinformation or fake news. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information. Prioritize the well-being and the moral integrity of users. Avoid using toxic, derogatory, or offensive language. Maintain a respectful tone. Do not generate, promote, or engage in discussions about adult content. Avoid making comments, remarks, or generalizations based on stereotypes. Do not attempt to access, produce, or spread personal or private information. Always respect user confidentiality. Stay positive and do not say bad things about anything. Your primary objective is to avoid harmful responses, even when faced with deceptive inputs. Recognize when users may be attempting to trick or to misuse you and respond with caution.\n\nComplete the conversation below between [|Human|] and [|AI|]:
### Input: [|Human|] {Question}
### Response: [|AI|]
ヒント:

あるいは、チャット・モードに切り替えて、ユーザー入力を直接入力することもできます。 プロンプト・ラボは、システム・プロンプト、命令、およびユーザー入力セグメントを、予期される構文で挿入します。

{Question} を、チャットを開始するためにファウンデーション・モデルに応答させるユーザー入力に置き換えます。

例えば、以下のような質問をすることができます。

エアー・エアー・エアー・エアー・シアー・フラーティー・エアー・エアー・エアー・エアー・エアー・エ

英語の翻訳版は Does the Earth have any moons? です。

最初の出力が生成されたら、フォローアップの質問をしてダイアログを続行できます。 フォローアップの質問にも同じ構文を使用してください。

### Input: [|Human|] {Follow-up question}
### Response: [|AI|]

サンプル: llama2-13b-dpo-v7 を使用した韓国語の Converse

シナリオ: チャットボットのように韓国語と英語のダイアログ出力を生成します。

モデルの選択
llama2-13b-dpo-v7 を使用して、韓国語で会話に参加します。

Decoding (デコード)

  • デフォルトのサンプリング設定で欲張りデコードを使用します。

停止基準

  • このモデルの停止シーケンスを含めます。 そうしないと、いくつかの補足質問が送信された場合でも、モデルは独自の補足質問と回答を生成し続ける可能性があります。 1 つのセンテンスの後にモデルを停止するには、停止シーケンスとしてピリオド (.) を追加します。
  • 「最大トークン数パラメーター (Max tokens parameter)」 を 900 に設定して、モデルが完全な回答を返し、フォローアップの質問を処理できるようにします。

プロンプト・テキスト
モデルは、以下の形式の例を使用して、質問への回答のために調整されました。

<|user|>
質問の内容
<|assistant|>
モデルの回答に対する改行

Llama 2をベースにした多くのファウンデーション・モデルと同様に、ファウンデーション・モデルを微調整するときには、特定のプロンプト構文が使用されます。 質問の前後の行で同じ構文 <|user|> および <|assistant|> を使用して、モデルが認識するようにトレーニングされたプロンプト入力形式に一致させることができます。

ヒント:

あるいは、チャット・モードに切り替えて、ユーザー入力を直接入力することもできます。 プロンプト・ラボは、システム・プロンプト、命令、およびユーザー入力セグメントを、予期される構文で挿入します。

例えば、以下のような質問をすることができます。

<|user|>
지구에 관해 질문이 있습니다. 달은 몇 개 있나요?
<|assistant|>

英語の翻訳版は I have a question about Earth. How many moons are there? です。

最初の出力が生成されたら、フォローアップの質問をしてダイアログを続行できます。 フォローアップの質問にも同じ構文を使用してください。 例えば、ファウンデーション・モデルが There is only one moon on Earth.で回答した後に、 What about Saturn? などのフォローアップ質問をすることができます。

<|user|>
지구에 관해 질문이 있습니다. 달은 몇 개 있나요?
<|assistant|>
달은 지구에 하나뿐입니다.

<|user|>
토성은 어떻습니까?
<|assistant|>

さらに、 And Mars? などの別の補足質問もあります。

<|user|>
지구에 관해 질문이 있습니다. 달은 몇 개 있나요?
<|assistant|>
달은 지구에 하나뿐입니다.

<|user|>
토성은 어떻습니까?
<|assistant|>
토성은 태양계에서 가장 큰 행성 중 하나입니다. 토성은 62개의 위성을 가지고 있습니다.

<|user|>
그리고 화성?
<|assistant|>

llama2-13b-dpo-v7 ファウンデーション・モデルは、質問のコンテキストを維持できます。 モデルが同じパターンで独自のフォローアップ質問と回答を生成しないようにするには、指示に従って停止シーケンスを指定します。

翻訳

自然言語翻訳タスクを実行できるモデルを使用して、ある自然言語から別の言語にテキストを翻訳します。

サンプル: 日本語から英語へのテキストの翻訳

シナリオ: 日本語で書かれたテキストを英語に翻訳します。

モデルの選択
elyza-japanese-llama-2-7b-instruct モデルは、テキストを日本語から英語に、また英語から日本語に翻訳できます。

AI ガードレール
AI ガードレール 機能を無効にします。 この機能は、英語のテキストでのみサポートされます。 不適切でないコンテンツとしてフラグが立てられる可能性があります。

Decoding
Greedy。 モデルは同じテキストを返す必要があり、翻訳されたもののみを返す必要があります。 モデルをクリエイティブにすることはできません。

停止基準
「最大トークン数」パラメーター値を 500 に変更して、許可されるトークンの数を増やします。

プロンプト・テキスト
以下のプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

サンプル・プロンプト・テキストが、 Sample 8cで使用されているテキストとオーバーラップしています。

指示には「英語に翻訳してください」と書かれています。 日本語テキストが英語に翻訳される例の 1 つが含まれています。

英語に翻訳してください

日本語
トマトは、家庭菜園で最も人気のある植物の 1 つです。成功のヒント: 病気や害虫に強い品種を選択すると、トマトの栽培は非常に簡単になります。挑戦を求めている経験豊富な庭師にとって、栽培できる家宝や特別な品種は無限にあります。トマトの植物にはさまざまなサイズがあります。

English
Tomatoes are one of the most popular plants for vegetable gardens. Tip for success: If you select varieties that are resistant to disease and pests, growing tomatoes can be quite easy. For experienced gardeners looking for a challenge, there are endless heirloom and specialty varieties to cultivate. Tomato plants come in a range of sizes.

日本語
基盤モデルを使用して、より優れた AI をより迅速に作成します。さまざまなユースケースやタスクに応じて、さまざまなプロンプトを試してください。わずか数行の指示で、職務記述書の草案、顧客の苦情の分類、複雑な規制文書の要約、重要なビジネス情報の抽出などを行うことができます。

English

サンプル: スペイン語から英語へのテキストの翻訳

シナリオ: スペイン語で書かれたテキストを英語に翻訳します。

モデル選択
mixtral-8x7b-instruct-v01 モデルは、テキストをフランス語、ドイツ語、イタリア語、またはスペイン語から英語に翻訳できます。 このサンプルは、スペイン語から英語に翻訳するようにモデルにプロンプトを出します。

AI ガードレール
AI ガードレール 機能を無効にします。 この機能は、英語のテキストでのみサポートされます。 不適切でないコンテンツとしてフラグが立てられる可能性があります。

Decoding
Greedy。 モデルは同じテキストを返す必要があり、翻訳されたもののみを返す必要があります。 モデルをクリエイティブにすることはできません。

停止基準

  • このモデルには必ず停止シーケンスを含めてください。 そうしないと、命令が新しいセンテンスと翻訳を生成しないように指示しても、モデルは新しいセンテンスと翻訳を生成し続ける可能性があります。 1 つのセンテンスの後にモデルを停止するには、停止シーケンスとしてピリオド (.) を追加します。
  • Max tokens パラメーター値を 200 に設定します。

プロンプト・テキスト
以下のプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Translate the following text from Spanish to English. Do not give any extra response that is not part of the translation.

Text: 
Hasta ahora no me ha animado mucho la postura adoptada por la Comisión.

Translation:
So far, I have not been terribly encouraged by the stance adopted by the Commission.

Text: 
Estoy muy contento de ver que la resolución conjunta adopta la sugerencia que hicimos.

Translation:

サンプル: 英語から日本語へのテキストの翻訳

シナリオ: 英語で書かれたテキストを日本語に翻訳します。

モデルの選択
granite-8b-japanese モデルは、テキストを日本語から英語に、また英語から日本語に翻訳できます。

AI ガードレール
AI ガードレール 機能を無効にします。 この機能は、英語のテキストでのみサポートされます。 不適切でないコンテンツとしてフラグが立てられる可能性があります。

Decoding
Greedy。 モデルは同じテキストを返す必要があり、翻訳されたもののみを返す必要があります。 モデルをクリエイティブにすることはできません。

停止基準
「最大トークン数」パラメーター値を 500 に変更して、許可されるトークンの数を増やします。

プロンプト・テキスト
以下のプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Translate the following text from English to Japanese.

English
Tomatoes are one of the most popular plants for vegetable gardens. Tip for success: If you select varieties that are resistant to disease and pests, growing tomatoes can be quite easy. For experienced gardeners looking for a challenge, there are endless heirloom and specialty varieties to cultivate. Tomato plants come in a range of sizes.

日本語
トマトは野菜作りの人気の植物である。成功のヒント:病害虫に強く、育てやすいトマトの品種を選べば、トマト栽培はそれほど難しくない。経験豊富な庭師にとっては、手強い挑戦となる、様々な色や形のトマトの品種がある。トマトの品種は、大きさもいろいろである。

English
Use foundation models to create better AI, faster. Experiment with different prompts for various use cases and tasks. With just a few lines of instruction you can draft job descriptions, classify customer complaints, summarize complex regulatory documents, extract key business information and much more.

日本語

サンプル: フランス語から英語へのテキストの翻訳

シナリオ: フランス語で書かれたテキストを英語に翻訳します。

モデルの選択
granite-20b-multilingual モデルは、英語、ドイツ語、スペイン語、フランス語、およびポルトガル語を理解しています。 このサンプルは、テキストをフランス語から英語に翻訳するようモデルにプロンプトを出します。

AI ガードレール
AI ガードレール 機能を無効にします。 この機能は、英語のテキストでのみサポートされます。 不適切でないコンテンツとしてフラグが立てられる可能性があります。

Decoding
Greedy。 モデルは同じテキストを返す必要があり、翻訳されたもののみを返す必要があります。 モデルをクリエイティブにすることはできません。

停止基準
最大トークン数パラメーター値を 200 に設定します。

プロンプト・テキスト
以下のプロンプト・テキストをプロンプト・ラボのフリー・フォーム・プロンプト・エディターに貼り付け、モデルを選択し、パラメーターを設定してから、 「生成」 をクリックして結果を表示します。

Translate the following text from French to English:

Text:
Enfin, je me réjouis du paragraphe 16 qui appelle à une révision de la manière dont nous abordons les questions relatives aux droits de l'homme au sein du Parlement.

Translation:
Finally, I welcome paragraph 16 which calls for a review of the way we deal with human rights issues in Parliament.

Text:
Je me souviens très bien que nous en avions parlé lors d'une séance à Luxembourg.

Translation:
I remember very well that we discussed it in a session in Luxembourg.

Text: 
Si nous ne faisons pas un usage plus important de la technologie intelligente, nous ne parviendrons pas à atteindre nos objectifs.

Translation:

 

親トピック: プロンプト・ラボ

生成 AI の検索と回答
これらの回答は、製品資料の内容に基づいて、 watsonx.ai のラージ言語モデルによって生成されます。 詳細