0 / 0
資料の 英語版 に戻る
IBM からの granite-13b-chat-v2 ファウンデーション・モデルのプロンプト

IBM からの granite-13b-chat-v2 ファウンデーション・モデルのプロンプト

watsonx.ai の IBM granite-13b-chat-v2 ファウンデーション・モデルの推論を試して、この汎用性の高いファウンデーション・モデルがさまざまなタスクの実行にどのように役立つかを確認してください。

granite-13b-chat-v2 ファウンデーション・モデルは、ビジネス・ユーザーが作業を行えるように設計された 130 億パラメーターの大規模言語モデルです。 IBM Granite シリーズのファウンデーション・モデルは、企業に特化したデータ・セットに基づいてトレーニングされます。つまり、モデルはさまざまな業界の専門用語や専門用語に精通しており、関連する業界知識に基づいたコンテンツをより簡単に生成できます。

バージョン番号や指示チューニングの詳細など、 granite-13b-chat-v2 ファウンデーション・モデルについて詳しくは、 モデル・カードを参照してください。

granite-13b-chat-v2 ファウンデーション・モデルは、以下のユース・ケース向けに最適化されています。

このモデルはさまざまなユース・ケースに使用できるため、最良の結果を得るには、モデル・パラメーターとシステム・プロンプトを調整する必要があります。

granite-13b-chat-v2 との会話

granite-13b-chat-v2 ファウンデーション・モデルとチャットする際に最良の結果を得るには、まず以下の推奨事項に従ってから、必要な結果を得るために試してください。

以下の表に、会話型タスクの granite-13b-chat-v2 ファウンデーション・モデルにプロンプトを出すための推奨モデル・パラメーターをリストします。

表 1. 会話型タスクで granite-13b-chat-v2 にプロンプトを出す際の推奨モデル・パラメーター
パラメーター 推奨値または範囲 説明
デコード サンプリング サンプリング・デコードにより、より創造的なテキストが生成されます。これは、チャットボットからの応答に関心やパーソナリティーを追加するのに役立ちます。 ただし、予測不能な出力が生じる可能性もあります。 次のモデル・パラメーター・セットを使用して、創造性の度合いを制御できます。
上位 P: 0.85
上位 K: 50
温度: 0.7
これらのサンプリング・デコード・パラメーターはすべて一緒に機能します。 このモデルは、出力に含めるトークンを選択するトークンのサブセットを選択します。
このサブセットには、最も可能性の高い 50 個のトークン (上位 K)、またはその確率スコアが合計されると合計スコア 0.85 (上位 P) に達するトークンが含まれます。 0.7 の比較的低い温度値は、トークン・スコアの差を増幅します。 その結果、カットを行うトークンは通常、最も可能性の高いトークンになります。
回答の創造性と多様性を高めるには、温度値を増やします。
モデルに幻覚がある場合は、温度値を下げます。
反復ペナルティ 1.05 ペナルティーをこの低い値に設定して、チャットボットが単語または句を繰り返すことでロボットを鳴らないようにします。
ランダム・シード 何かをテストしていて、テストからランダム性を因子として除去する場合にのみ、この設定の値を指定します。
例えば、出力にどのように影響するかを確認するために温度を変更する場合は、同じ入力を繰り返し実行依頼し、毎回温度値のみを変更します。 また、 5などの数値を毎回ランダム・シードとして指定して、ランダム・トークンの選択がモデル出力にも影響しないようにします。 毎回同じ数値を指定する限り、数値自体は問題ではありません。
最大トークン数 900 入力トークンと出力トークンの両方を含む granite-13b-chat-v2 ファウンデーション・モデルのコンテキスト・ウィンドウの最大長は 8192 です。 トークンについて詳しくは、「 トークンおよびトークン化」を参照してください。
各フォローアップ質問では、会話履歴がモデル・プロンプトの一部として組み込まれます。 granite-13b-chat-v2 ファウンデーション・モデルは、通常、最大 5 回まで、または入力が 4,000 トークンに達するまで、会話を維持できます。

 

モデル・パラメーターについて詳しくは、 プロンプト用のモデル・パラメーターを参照してください。

チャット・タスクの granite-13b-chat-v2 ファウンデーション・モデルにプロンプトを出すには、以下の手順を実行します。

  1. チャット・モードのプロンプト・ラボから、 granite-13b-chat-v2 ファウンデーション・モデルを選択します。

    チャット・モードには、会話型交換用に最適化されたデフォルトのプロンプト・パラメーター値があります。これには、より高い 「最大トークン数」 値が含まれます。

    プロンプト・ラボのチャット・モードで granite-13b-chat-v2 を表示する

  2. 「モデル・パラメーター」 パネルで、表 1 の推奨モデル・パラメーター値を適用します。

  3. チャット・モードでは、入力テキストをフォーマット設定せずにユーザー入力を送信できます。

    チャット・モードでは、推奨される形式がプロンプト・テキストに適用されます。 テキストアイコン完全なプロンプト・テキストを表示をクリックすると、テキストの書式を確認できます。

  4. フリー・フォーム・モードで同じプロンプトを送信するには、システム・プロンプトをセットアップする必要があります。

    指示を追加します。 例えば、以下の命令テキストはモデルのトレーニングに使用されたため、モデルによく知られています。

    あなたは Granite チャットです。 IBMが開発した AI 言語モデルです。 君は用心深い助手だ。 指示には慎重に従ってください。 あなたは役に立たず、無害であり、倫理的なガイドラインに従い、前向きな行動を促進します。 挨拶 (例えば、こんにちは、こんにちは、午前中、午後、夜、夜、起きていること、よろしくお願いします) には、「こんにちは!」と応答します。 IBMによって作成された Granite チャットです。 今日はどうやってお手伝いできますか?」 他には何も言わず、会話を開始しないでください。

    推奨されるシステム・プロンプト・テキストをコピーするには、以下のコード・スニペットから 「クリップボードにコピー」 アイコンをクリックします。

    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. You always respond to greetings (for example, hi, hello, g'day, morning, afternoon, evening, night, what's up, nice to meet you, sup) with "Hello! I am Granite Chat, created by IBM. How can I help you today?". Please do not say anything else and do not start a conversation.
    

    会話を開始します。

    チャット・タスクに使用されるプロンプトの最適な構造は、以下のとおりです。 プロンプトには、プロンプトの以下のセグメントを識別する構文が含まれます。

    • <|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. You always respond to greetings (for example, hi, hello, g'day, morning, afternoon, evening, night, what's up, nice to meet you, sup) with "Hello! I am Granite Chat, created by IBM. How can I help you today?". Please do not say anything else and do not start a conversation.
    <|user|>
    {PROMPT}
    <|assistant|>
    
    
  5. 会話の進行を維持するために、フォローアップの質問をします。

    複数のダイアログがあるチャットで使用されるプロンプトの最適な構造は、以下のとおりです。 プロンプト・ラボからプロンプトをフリー・フォーム・モードで送信する場合は、このプロンプト形式を使用します。

    <|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. You always respond to greetings (for example, hi, hello, g'day, morning, afternoon, evening, night, what's up, nice to meet you, sup) with "Hello! I am Granite Chat, created by IBM. How can I help you today?". Please do not say anything else and do not start a conversation.
    <|user|>
    {ROUND1_PROMPT}
    <|assistant|>
    {MODEL_RESPONSE}
    <|user|>
    {ROUND2_PROMPT}
    <|assistant|>
    
    

チャットのユース・ケースを示す別のサンプル・プロンプトについては、 Sample: Converse with granite-13b-chat-v2を参照してください。

プロンプト・ラボでのチャット・モードの使用について詳しくは、 プロンプト・ラボを参照してください。

会話型タスクの場合に granite-13b-chat-v2 にプロンプトを出すためのヒント

  • フォローアップの質問では、代名詞を使用しないでください。 例えば、「変数は何を表しますか?」と尋ねます。 「 it は何を表しますか?」ではありません。

  • ファウンデーション・モデルがテーブル形式で応答を生成するようにしたい場合は、マークダウンで生成されたテーブルをモデルが返すように、プロンプトで明示的に要求します。

RAG パターンを使用して事実上の回答を返す

granite-13b-chat-v2 ファウンデーション・モデルが事実上の回答を返すようにガイドするには、検索拡張された生成パターンを使用します。 取得-拡張された生成では、モデルに送信する入力に、説明するトピックに関する事実上の情報が含まれています。 詳しくは、 Retrieval-augmented generation (RAG)を参照してください。

granite-13b-chat-v2 ファウンデーション・モデルから実際の回答を返す場合は、以下の推奨事項に従ってください。

以下の表に、 granite-13b-chat-v2 ファウンデーション・モデルに取得拡張生成タスクのプロンプトを出すための推奨モデル・パラメーターをリストします。

表 2. RAG タスクで granite-13b-chat-v2 にプロンプトを表示する際の推奨モデル・パラメーター
パラメーター 推奨値または範囲 説明
デコード 欲張り 正規表現によるデコードでは、最も可能性の高いオプションからのみトークンが選択されます。これは、実際の回答が必要な場合に最適です。
反復ペナルティ 1 最小値を使用します。 反復は、目標が事実上の回答である場合に許容されます。
最大トークン数 500 モデルは、可能な限り完全に質問に回答できます。
入力トークンと出力トークンの両方を含む granite-13b-chat-v2 ファウンデーション・モデルのコンテキスト・ウィンドウの最大長は 8192 であることに注意してください。 プロンプトを表示するために追加する文書などの入力は、その制限内に保持してください。 トークンについて詳しくは、 トークンおよびトークン化を参照してください。
停止基準 < |endoftext |> granite-13b-chat-v2 ファウンデーション・モデルの便利な機能の 1 つに、各応答の最後に < |endoftext |> という名前の特別なトークンが含まれていることがあります。 一部の生成モデルは、許容される最大数より少ないトークンで入力に対する応答を返す場合、入力からパターンを繰り返すことができます。 このモデルは、プロンプトに対して信頼性の高い停止シーケンスを組み込むことによって、このような反復を防止します。

 

モデル・パラメーターについて詳しくは、 プロンプト用のモデル・パラメーターを参照してください。

granite-13b-chat-v2 ファウンデーション・モデルに取得拡張生成タスクのプロンプトを出すには、以下のステップを試行します。

  1. モデルに検討させたいトピック、およびユーザーが使用する権限を持っているトピックに関する事実上の情報を含む、信頼できるリソースを見つけます。 1 つ以上の文書の抜粋を、後でアクセスできるテキスト・エディターまたはその他のツールにコピーします。

    例えば、お客様の会社の Web サイトまたは製品資料からの製品情報をリソースにすることができます。

  2. プロンプト・ラボからフリー・フォーム・モードを開き、プロンプトを構造化できるようにします。 granite-13b-chat-v2 ファウンデーション・モデルを選択します。

  3. 「モデル・パラメーター」 パネルで、表 2 の推奨モデル・パラメーターを設定します。

  4. プロンプトで、システム・プロンプト、ユーザー入力、およびモデルの出力先を明確に定義します。

    例えば、以下のプロンプト構造は、 granite-13b-chat-v2 ファウンデーション・モデルが関連情報を返すのに役立ちます。

    <|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.
    <|user|>
    You are an AI language model designed to function as a specialized Retrieval Augmented Generation (RAG) assistant. When generating responses, prioritize correctness, i.e., ensure that your response is grounded in context and user query. Always make sure that your response is relevant to the question.
    Answer Length: {ANSWER_LENGTH}
    [Document]
    {DOCUMENT1_TITLE}
    {DOCUMENT1_CONTENT}
    [End]
    [Document]
    {DOCUMENT2_TITLE}
    {DOCUMENT2_CONTENT}
    [End]
    [Document]
    {DOCUMENT3_TITLE}
    {DOCUMENT3_CONTENT}
    [End]
    {QUERY}
    <|assistant|>
    
    

    : 文書コンテンツの開始と終了は、特殊タグ [Document] および [End]で示されます。 プロンプトにコンテンツ・タイプまたはサブセクション・ヘッダーを識別する特殊タグを追加する場合は、同様の構文を使用します。 granite-13b-chat-v2 ファウンデーション・モデルが作成されたときには、以下の特殊タグを処理するようにトレーニングされています。

    • <|system|>: ファウンデーション・モデルの システム・プロンプト とも呼ばれる命令を識別します。
    • <|user|>: 応答される照会テキスト。
    • <|assistant|>: プロンプトの末尾にある、生成された応答が予期されることを示すキュー。

    カスタム・タグに同じ <|tagname|> 構文を使用しないでください。使用すると、モデルが混乱する可能性があります。

  5. このプロンプト・テンプレートをコピーする場合は、プロンプト・ラボ・エディターに貼り付けた後、プレースホルダー変数を置き換えます。

    表 2a: RAG テンプレートのプレースホルダー変数
    プレースホルダー変数 説明
    {ANSWER_LENGTH} オプション。 応答の予期される応答の長さを定義します。 オプションには、(最も短い回答から最も長い回答の順に) single wordconcisenarrative があります。
    {DOCUMENTn_TITLE} 実際の情報を含む抜粋の取得元となる文書のタイトル。 複数の文書からコンテンツを組み込むことができます。 製品パンフレット
    {DOCUMENTn_CONTENT} テキストは、モデルが知識を持って議論できるようにしたい実際の情報とともに抜粋されています。 マーケティング・パンフレット、製品資料、会社の Web サイト、またはその他の信頼できるリソースからのテキスト。
    {QUERY} 実際に回答される質問。 文書で説明されているトピックに関する質問。

     

    ヒント: あるいは、文書のプロンプト変数を定義して使用することもできます。これにより、プロンプトを再利用したり、毎回内容を動的に置換したりすることができます。 詳しくは、 再使用可能なプロンプトの作成を参照してください。

検索拡張生成プロンプトの例

以下のプロンプトでは、 granite-13b-chat-v2 ファウンデーション・モデルを使用して、 プロンプトのチューニングに関する質問に答えます。

: 文書の内容は、「 ファウンデーション・モデルのチューニング方法 」のトピックから取得されます。

<|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.
<|user|>
You are an AI language model designed to function as a specialized Retrieval Augmented Generation (RAG) assistant. When generating responses, prioritize correctness, i.e., ensure that your response is grounded in context and user query. Always make sure that your response is relevant to the question.
Answer length: concise
[Document]
How prompt-tuning works
Foundation models are sensitive to the input that you give them. Your input, or how you prompt the model, can introduce context that the model will use to tailor its generated output. Prompt engineering to find the right prompt often works well. However, it can be time-consuming, error-prone, and its effectiveness can be restricted by the context window length that is allowed by the underlying model.
Prompt-tuning a model in the Tuning Studio applies machine learning to the task of prompt engineering. Instead of adding words to the input itself, prompt-tuning is a method for finding a sequence of values that, when added as a prefix to the input text, improve the model's ability to generate the output you want. This sequence of values is called a prompt vector.
Normally, words in the prompt are vectorized by the model. Vectorization is the process of converting text to tokens, and then to numbers defined by the model's tokenizer to identify the tokens. Lastly, the token IDs are encoded, meaning they are converted into a vector representation, which is the input format that is expected by the embedding layer of the model. Prompt-tuning bypasses the model's text-vectorization process and instead crafts a prompt vector directly. This changeable prompt vector is concatenated to the vectorized input text and the two are passed as one input to the embedding layer of the model. Values from this crafted prompt vector affect the word embedding weights that are set by the model and influence the words that the model chooses to add to the output.
To find the best values for the prompt vector, you run a tuning experiment. You demonstrate the type of output that you want for a corresponding input by providing the model with input and output example pairs in training data. With each training run of the experiment, the generated output is compared to the training data output. Based on what it learns from differences between the two, the experiment adjusts the values in the prompt vector. After many runs through the training data, the model finds the prompt vector that works best.
[End]
How does prompt tuning work?
<|assistant|>

granite-13b-chat-v2 ファウンデーション・モデルは、入力で提供された文書コンテンツからの情報に基づいて、プロンプト・チューニングがどのように機能するかについての正確な要約を生成します。

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

プロンプト・チューニングは、プロンプト・ベクトルと呼ばれる値のシーケンスを調整することによって、特定の出力を生成するモデルの能力を向上させる方法です。 プロンプト・チューニングでは、入力に単語を直接追加する代わりに、モデルによって設定された単語埋め込み重みに直接影響するプロンプト・ベクトルが作成されます。 これは、入力テキストおよびエンコード・トークン ID をベクトル表現にベクトル化することによって実現されます。ベクトル表現は、作成されたプロンプト・ベクトルと連結され、1 つの入力としてモデルの組み込み層に渡されます。 この実験では、生成された出力と学習データの例の目的の出力との違いに基づいて、プロンプト・ベクトルの値を調整します。 トレーニング・データの多くの実行にわたって、モデルは最も効果的なプロンプト・ベクトルを検出します。

 

NLP タスク

分類や抽出などの自然言語処理タスクに granite-13b-chat-v2 ファウンデーション・モデルを使用できます。 granite-13b-chat-v2 モデルが作成されたときに、これらのタイプの自然言語処理タスクを実行するようにトレーニングされました。

モデルのトレーニング中に、モデルのトレーニングに使用されたプロンプトが、タスク・タイプごとに特定の形式に従いました。 モデルを使用してこれらのタスクのいずれかを実行する場合は、送信するプロンプトで設定されている形式を模倣してください。

分類

granite-13b-chat-v2 ファウンデーション・モデルを使用して情報を分類するには、以下の推奨事項に従ってください。

以下の表に、分類タスクのために granite-13b-chat-v2 ファウンデーション・モデルにプロンプトを出すための推奨モデル・パラメーターをリストします。

表 3. 分類タスクで granite-13b-chat-v2 にプロンプトを表示する際の推奨モデル・パラメーター
パラメーター 推奨値または範囲 説明
デコード 欲張り 正規表現によるデコードでは、最も可能性の高いオプションからのみトークンが選択されます。これは、テキストを分類する場合に最適です。
反復ペナルティ 1 最小値を使用します。 反復が予期されています。
最大トークン数 状況による 最長のクラス・ラベル内のトークンの数をカバーする値 ( 510など) を使用します。 トークンを制限すると、モデルは適切なクラス・ラベルのみを返し、それ以外は返さないようになります。
停止基準 サポートされる各クラス・ラベルを停止シーケンスとして追加します。 クラスを停止シーケンスとして追加すると、クラスが入力に割り当てられた後に、モデルはテキストの生成を強制的に停止します。

 

分類タスクのために granite-13b-chat-v2 ファウンデーション・モデルにプロンプトを出すには、以下の手順を試行します。

  1. モデルに入力に割り当てるクラスまたは分類ラベルを特定します。 これらのクラス・ラベルは、プロンプトの命令セグメントに必ずリストしてください。

    例えば、顧客商品レビューを正または負として分類する場合は、 PostitiveNegativeの 2 つのクラス・ラベルを定義できます。

  2. モデルで分類する入力テキストのタイプの代表的な例を 2 つまたは 3 つ収集します。

  3. プロンプトを構造化できるように、プロンプト・ラボの granite-13b-chat-v2 ファウンデーション・モデルをフリー・フォーム・モードで操作します。

  4. 「モデル・パラメーター」 パネルで、表 3 の推奨モデル・パラメーターを設定します。

  5. プロンプトで、システム・プロンプト、ユーザー入力、およびモデルの出力先を明確に識別します。

    例えば、 granite-13b-chat-v2 ファウンデーション・モデルがテキストを分類するためにトレーニングされたときに、以下のプロンプト構造が使用されました。

    <|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.
    <|user|>
    {INSTRUCTION}
    Your response should only include the answer. Do not provide any further explanation.
    Here are some examples, complete the last one:
    {INPUT_LABEL}:
    {ICL_INPUT_1}
    {OUTPUT_LABEL}:
    {ICL_OUTPUT_1}
    {INPUT_LABEL}:
    {ICL_INPUT_2}
    {OUTPUT_LABEL}:
    {ICL_OUTPUT_2}
    {INPUT_LABEL}:
    {TEST_INPUT}
    {OUTPUT_LABEL}:
    <|assistant|>
    
    

    同様の構造を使用して、モデルのトレーニングを活用できます。 プロンプト・テンプレート内のプレースホルダー変数を置き換えるだけです。

    表 3a: 分類テンプレートのプレースホルダー変数
    プレースホルダー変数 説明
    {INSTRUCTION} タスクの説明。 モデルによって入力に割り当てられるクラスのリストを含めます。 商品レビューごとに、レビューが肯定的か否定的かを示します。
    {INPUT_LABEL} 分類するテキストのショート・ラベル。 Input, Customer review, Feedback, Comment
    {OUTPUT_LABEL} 分類値を表す短いラベル。 Class
    {ICL_INPUT_N} オプション。 分類する入力テキストの例。 コンテキスト内学習をサポートするために数回プロンプトを使用する場合は、例を追加します。 The service representative did not listen to a word I said. It was a waste of my time.
    {ICL_OUTPUT_N} 対応する入力テキストの例にクラス・ラベルが割り当てられた出力例。 Positive, Negative

 

分類プロンプトの例

以下のプロンプトは、お客様がサポート・センターの担当者に関して共有するフィードバックを分類します。

<|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.
<|user|>
For each feedback, specify whether the content is Positive or Negative. Your response should only include the answer. Do not provide any further explanation.
Here are some examples, complete the last one:
Feedback:
Carol, the service rep was so helpful. She answered all of my questions and explained things beautifully.
Class:
Positive
   
Feedback:
The service representative did not listen to a word I said. It was a waste of my time.
Class:
Negative
   
Feedback:
Carlo was so helpful and pleasant. He was able to solve a problem that I've been having with my software for weeks now.
Class:
<|assistant|>

このプロンプトが送信されたときに granite-13b-chat-v2 ファウンデーション・モデルによって生成される出力は Positiveです。

抽出

granite-13b-chat-v2 ファウンデーション・モデルを使用して情報を抽出するには、以下の推奨事項に従ってください。

以下の表に、抽出タスクのために granite-13b-chat-v2 ファウンデーション・モデルにプロンプトを出すための推奨モデル・パラメーターをリストします。

表 4. 抽出タスクで granite-13b-chat-v2 にプロンプトを出す際の推奨モデル・パラメーター
パラメーター 推奨値または範囲 説明
デコード 欲張り 正規表現によるデコードでは、最も可能性の高いオプションからのみトークンが選択されます。これは、テキストを抽出する場合に最適です。
最大トークン数 状況による 510など、抽出する情報タイプの最も長い言及の中で、トークンの数をカバーする値を使用します。 トークンを制限すると、モデルは適切なクラス・ラベルのみを返し、それ以外は返さないようになります。
停止基準 サポートされる各クラス・ラベルを停止シーケンスとして追加します。 クラスを停止シーケンスとして追加すると、クラスが入力に割り当てられた後に、モデルはテキストの生成を強制的に停止します。

 

抽出タスクのために granite-13b-chat-v2 ファウンデーション・モデルにプロンプトを出すには、以下の手順を実行します。

  1. モデルに入力から抽出させる情報タイプを指定します。 これらの情報タイプ・ラベルは、プロンプトの命令セグメントに必ずリストしてください。

    例えば、企業の US 証券取引委員会 (SEC) の 10-K 形式から重要な情報を抽出する場合は、 Line Of Credit Facility Maximum Borrowing Capacityなどの情報タイプを識別できます。

  2. モデルで抽出する情報のタイプを指定して、2 つまたは 3 つの代表的な入力テキストの例を収集します。

  3. プロンプトを構造化できるように、プロンプト・ラボの granite-13b-chat-v2 ファウンデーション・モデルをフリー・フォーム・モードで操作します。

  4. 「モデル・パラメーター」 パネルで、表 4 の推奨モデル・パラメーターを設定します。

  5. システム・プロンプト、ユーザー入力、およびモデルの出力先を明確に識別します。

    例えば、 granite-13b-chat-v2 ファウンデーション・モデルがテキストから情報を抽出するようにトレーニングされたときに、以下のプロンプト構造が使用されました。

    <|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.
    <|user|>
    {INSTRUCTION}
    Your response should only include the answer. Do not provide any further explanation.
    Here are some examples, complete the last one:
    {INPUT_LABEL}:
    {ICL_INPUT_1}
    {OUTPUT_LABEL}:
    {ICL_OUTPUT_1}
    {INPUT_LABEL}:
    {ICL_INPUT_2}
    {OUTPUT_LABEL}:
    {ICL_OUTPUT_2}
    {INPUT_LABEL}:
    {TEST_INPUT}
    {OUTPUT_LABEL}:
    <|assistant|>
    
    

    同様の構造を使用して、モデルのトレーニングを活用できます。 プロンプト・テンプレート内のプレースホルダー変数を置き換えるだけです。

    表 4a: 抽出テンプレートのプレースホルダー変数
    プレースホルダー変数 説明
    {INSTRUCTION} タスクの説明。 モデルに入力から抽出させたい情報タイプのリストを含めます。
    {INPUT_LABEL} 分類するテキストのショート・ラベル。
    {OUTPUT_LABEL} 抽出された値を表す短いラベル。
    {ICL_INPUT_N} オプション。 抽出する情報タイプの入力テキストの例。 コンテキスト内学習をサポートするために数回プロンプトを使用する場合は、例を追加します。
    {ICL_OUTPUT_N} 対応する入力から抽出された情報タイプを持つ出力例。

 

抽出プロンプトの例

以下のプロンプトは、企業の SEC 10-K フォームから、Line Of Credit Facility Maximum Bor取り出しキャパシティーの値を抽出します。

<|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.
<|user|>
Extract the Line Of Credit Facility Maximum Borrowing Capacity from the 10K sentences.
Your response should only include the answer. Do not provide any further explanation.
Here are some examples, complete the last one:
10K Sentence:
The credit agreement also provides that up to $500 million in commitments may be used for letters of credit.
Line Of Credit Facility Maximum Borrowing Capacity:
$500M

10K Sentence:
In March 2020, we upsized the Credit Agreement by $100 million, which matures July 2023, to $2.525 billion.
Line Of Credit Facility Maximum Borrowing Capacity:
$2.525B

10K Sentence:
We prepared our impairment test as of October 1, 2022 and determined that the fair values of each of our reporting units exceeded net book value by more than 50%. Among our reporting units, the narrowest difference between the calculated fair value and net book value was in our Principal Markets segment's Canada reporting unit, whose calculated fair value exceeded its net book value by 53%. Future developments related to macroeconomic factors, including increases to the discount rate used, or changes to other inputs and assumptions, including revenue growth, could reduce the fair value of this and/or other reporting units and lead to impairment. There were no goodwill impairment losses recorded for the nine months ended December 31, 2022. Cumulatively, the Company has recorded $469 million in goodwill impairment charges within its former EMEA ($293 million) and current United States ($176 million) reporting units. Revolving Credit Agreement In October 2021, we entered into a $3.15 billion multi-currency revolving credit agreement (the "Revolving Credit Agreement") for our future liquidity needs. The Revolving Credit Agreement expires, unless extended, in October 2026. Interest rates on borrowings under the Revolving Credit Agreement are based on prevailing market interest rates, plus a margin, as further described in the Revolving Credit Agreement. The total expense recorded by the Company for the Revolving Credit Agreement was not material in any of the periods presented. We may voluntarily prepay borrowings under the Revolving Credit Agreement without premium or penalty, subject to customary "breakage" costs. The Revolving Credit Agreement includes certain customary mandatory prepayment provisions. Interest on Debt Interest expense for the three and nine months ended December 31, 2022 was $27 million and $65 million, compared to $18 million and $50 million for the three and nine months ended December 31, 2021. Most of the interest for the pre-Separation period presented in the historical Consolidated Income Statement reflects the allocation of interest expense associated with debt issued by IBM from which a portion of the proceeds benefited Kyndryl.
Line Of Credit Facility Maximum Borrowing Capacity:
<|assistant|>

このプロンプトが送信されたときに granite-13b-chat-v2 ファウンデーション・モデルによって生成される出力は $3.15Bです。

詳細情報

granite-13b-chat-v2 ファウンデーション・モデルについて詳しくは、以下のリソースを参照してください。

親トピック: IBM ファウンデーション・モデル

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