プロンプト設計戦略

このページでは、プロンプトの設計時に採用できる一般的なプロンプトの設計戦略について説明します。プロンプトの設計に正しい方法や間違った方法はありませんが、モデルのレスポンスに影響を与えるために使用できる一般的な戦略があります。モデルのパフォーマンスを最適化するには、厳格なテストと評価が不可欠です。

大規模言語モデル(LLM)は、言語単位間のパターンと関係を学習するために、膨大なテキストデータでトレーニングされています。テキスト(プロンプト)を受け取った言語モデルは、高度なオートコンプリート ツールのように、次に来ると思われるものを予測できます。したがって、プロンプトを設計する際は、モデルによる次の予測に影響を与える可能性のあるさまざまな要因を考慮してください。

明確で具体的な指示にする

何をすべきかモデルに指示することは、モデルの動作をカスタマイズする効果的かつ効率的な方法です。指示は明確かつ具体的にしてください。指示には手順のリストのような単純なものもあれば、ユーザー エクスペリエンスやマインドセットを示すような複雑なものもあります。

実行するタスクを定義する

モデルに実行させたいタスクを詳しく記述します。タスクには段階的な手順のリストのような単純なものもあれば、ユーザー エクスペリエンスや考え方を示すような複雑なものもあります。次のプロンプトは、テキストのブロックを要約するようモデルに指示しています。

Summarize this text.
Text: A quantum computer exploits quantum mechanical phenomena to perform calculations exponentially
faster than any modern traditional computer. At very tiny scales, physical matter acts as both
particles and as waves, and quantum computing uses specialized hardware to leverage this behavior.
The operating principles of quantum devices is beyond the scope of classical physics. When deployed
at scale, quantum computers could be used in a wide variety of applications such as: in
cybersecurity to break existing encryption methods while helping researchers create new ones, in
meteorology to develop better weather forecasting etc. However, the current state of the art quantum
computers are still largely experimental and impractical.
  
Quantum computers utilize quantum mechanical phenomena to perform computations significantly faster
than traditional computers. By exploiting the particle-wave duality of matter at tiny scales,
quantum computers leverage specialized hardware to solve problems beyond classical physics.
Potential applications include breaking encryption, developing better weather forecasting, and more.
However, current quantum computers are still largely experimental and impractical.
  

制約を指定する

プロンプトの読み取りやレスポンスの生成に関する制約を指定します。行うべきことと、行うべきでないことをモデルに指示できます。前の例では、要約が元のテキストよりも短くなっていますが、さらに短い要約がほしい場合もあります。その場合、必要な要約の長さについてプロンプトで制約を指定できます。

Summarize this text in two sentences.
Text: A quantum computer exploits quantum mechanical phenomena to perform calculations exponentially
faster than any modern traditional computer. At very tiny scales, physical matter acts as both
particles and as waves, and quantum computing uses specialized hardware to leverage this behavior.
The operating principles of quantum devices is beyond the scope of classical physics. When deployed
at scale, quantum computers could be used in a wide variety of applications such as: in
cybersecurity to break existing encryption methods while helping researchers create new ones, in
meteorology to develop better weather forecasting etc. However, the current state of the art quantum
computers are still largely experimental and impractical.
    

Quantum computers use quantum mechanical phenomena to perform calculations much faster than
traditional computers. They have the potential to revolutionize various fields, but current quantum
computers are still experimental and impractical.
    

レスポンスの形式を定義する

指示の中でレスポンスの形式を指定することもできます。たとえば、表、箇条書き、エレベーター ピッチ、キーワード、文、段落の形式でレスポンスを求めることができます。次のプロンプトは、テキストの重要な情報を箇条書きにするようモデルに指示しています。

Summarize this text as bullets points of key information.
Text: A quantum computer exploits quantum mechanical phenomena to perform calculations exponentially
faster than any modern traditional computer. At very tiny scales, physical matter acts as both
particles and as waves, and quantum computing uses specialized hardware to leverage this behavior.
The operating principles of quantum devices is beyond the scope of classical physics. When deployed
at scale, quantum computers could be used in a wide variety of applications such as: in
cybersecurity to break existing encryption methods while helping researchers create new ones, in
meteorology to develop better weather forecasting etc. However, the current state of the art quantum
computers are still largely experimental and impractical.
  
- Quantum computers leverage quantum mechanical phenomena for exponentially faster calculations than
  traditional computers.
- Quantum devices utilize specialized hardware to exploit tiny-scale matter behavior as both
  particles and waves.
- Their operating principles transcend classical physics.
- Potential applications include cybersecurity, weather forecasting, and more.
- Current quantum computers are largely experimental and impractical.
  

概要

  • 何をすべきかについてモデルに指示を与えます。
  • 指示は明確かつ具体的にしてください。
  • 出力の制約またはフォーマット要件を指定します。

少数ショットの例を含める

プロンプトには、モデルに期待する動作の例を含めることができます。モデルは、パターンと関係を例から識別し、レスポンスを生成する際にそれらを適用します。いくつかの例を含むプロンプトは少数ショット プロンプトと呼ばれ、例のないプロンプトはゼロショット プロンプトと呼ばれます。少数ショット プロンプトは、モデルのレスポンスの形式、フレーズ、範囲、一般的なパターンを規制するためによく使用されています。具体的で多様な例を使用して、モデルが焦点を絞り込み、より正確な結果を生成できるようにします。

プロンプトには、常に少数ショットの例を含めることをおすすめします。少数ショットの例は、モデルに対して指示の適用方法を示すものであり、このようなショットのないプロンプトは効果的でない可能性があります。タスクを説明するのに十分な例が含まれていれば、プロンプトから指示を削除することも可能です。

ゼロショット プロンプトと少数ショット プロンプト

次のゼロショット プロンプトでは、モデルに最良の説明を選択するよう求めます。

Please choose the best explanation to the question:

Question: How is snow formed?
Explanation1: Snow is formed when water vapor in the air freezes into ice crystals in the
atmosphere, which can combine and grow into snowflakes as they fall through the atmosphere and
accumulate on the ground.
Explanation2: Water vapor freezes into ice crystals forming snow.
Answer:
  
Explanation1
  

ユースケースでモデルが簡潔なレスポンスを生成する必要がある場合は、簡潔なレスポンスを優先する例をプロンプトに含めることができます。

次のプロンプトでは、短い説明を優先する例を 2 つ示します。レスポンスでは、前の例のような長い説明(説明 1)ではなく、短い説明(説明 2)を選択するように例がモデルをガイドしたことがわかります。

Please choose the best explanation to the question:

Question: Why is sky blue?
Explanation1: The sky appears blue because of Rayleigh scattering, which causes shorter blue
wavelengths of light to be scattered more easily than longer red wavelengths, making the sky look
blue.
Explanation2: Due to Rayleigh scattering effect.
Answer: Explanation2

Question: What is the cause of earthquakes?
Explanation1: Sudden release of energy in the Earth's crust.
Explanation2: Earthquakes happen when tectonic plates suddenly slip or break apart, causing a
release of energy that creates seismic waves that can shake the ground and cause damage.
Answer: Explanation1

Question: How is snow formed?
Explanation1: Snow is formed when water vapor in the air freezes into ice crystals in the
atmosphere, which can combine and grow into snowflakes as they fall through the atmosphere and
accumulate on the ground.
Explanation2: Water vapor freezes into ice crystals forming snow.
Answer:
  
Explanation2
  

最適なサンプル数を求める

最も望ましい結果が得られるように、プロンプトに表示するサンプルの数をテストできます。PaLM や Gemini などのモデルでは、多くの場合、いくつかの例を使用してパターンを検出できますが、望ましい結果につながる例の数をテストすることが必要な場合があります。BERT などの単純なモデルでは、さらに多くの例が必要になる場合があります。同時に、過剰に多くの例を追加すると、モデルが例に対するレスポンスを過学習し始める可能性があります。

例を使用してアンチパターンではなくパターンを示す

回避すべきアンチパターンを例示するよりも、従うべきパターンをモデルに例示するほうが効果的です。

ネガティブ パターン:

Don't end haikus with a question:
Haiku are fun
A short and simple poem
Don't you enjoy them?
  

ポジティブ パターン:

Always end haikus with an assertion:
Haiku are fun
A short and simple poem
A joy to write
  

サンプル全体で一貫した形式を使用する

レスポンスが望ましくない形式で返されないように、少数ショットの例の構造と形式を同じにする必要があります。プロンプトに少数ショットの例を追加する主な目的の 1 つは、モデルにレスポンスの形式を示すことです。そのため、すべてのサンプルで形式を統一することが重要になります。特に、XML タグ、空白、改行、サンプルの分割子には注意してください。

概要

  • モデルが応答方法を効率的に学習できるように、プロンプトにはプロンプト / レスポンスの例を含めてください。
  • 回避するパターンの例ではなく、従うべきパターンの例をモデルに提示します。
  • 表示するプロンプトの数を調べてみてください。モデルによっては、例が少なすぎると、モデルの動作の変更は期待できません。サンプルが多すぎると、モデルが過学習する原因となります。
  • サンプル全体で一貫した形式を使用してください。

コンテキスト情報を追加する

モデルに必要な情報がすべて与えられていると仮定するのではなく、モデルが問題を解決するために必要な情報をプロンプトの手順と情報に含めることができます。このコンテキスト情報により、モデルは、要求された内容の制約と詳細を理解できます。

次の例では、モデルにルーターのトラブルシューティング ガイダンスを提供するよう求めています。

What should I do to fix my disconnected wifi? The light on my Google Wifi router is yellow and
blinking slowly.
  
1. **Check the Cables:**
- Make sure that all cables are securely connected to your Google Wifi router and modem.
- Try replacing the cables with new ones to ensure they are not faulty.


2. **Reboot the Router:**
- Unplug your Google Wifi router and modem from the power outlet.
- Wait for at least 30 seconds.
- Plug the modem and router back in and wait for them to start up.


3. **Factory Reset the Router:**
- Resetting the router will restore it to its default settings.
- Find the small reset button on the back of the router.
- Press and hold the reset button with a paper clip or similar object for 10 seconds.
- Release the button and wait for the router to restart.


4. **Check Your Internet Connection:**
- Use a wired connection to connect a device directly to your modem.
- If the internet works, the issue may be with your router.
- If the internet still doesn't work, contact your Internet Service Provider (ISP).


5. **Update Router's Firmware:**
- Check if there is a firmware update available for your Google Wifi router.
- Download and install the latest firmware update from the Google Wifi app.


6. **Interference and Obstacles:**
- Make sure the router is not near electronic devices that can cause interference, like microwaves or cordless phones.
- Remove any obstacles between the router and your devices, such as furniture or thick walls.


7. **Change Wi-Fi Channel:**
- In the Google Wifi app, go to Settings > Network & General > Advanced Networking.
- Try changing the Wi-Fi channel to a less congested one.


8. **Contact Google Support:**
- If you've tried the above steps and the issue persists, contact Google support for further assistance.
  

レスポンスにはルーターや LED インジケーター ライトのステータスのように固有なものはなく、一般的なトラブルシューティング情報のように見えます。

特定のルーターに関するレスポンスをカスタマイズするには、ルーターのトラブルシューティング ガイドを、レスポンスの提供時に参照するコンテキストとしてプロンプトに追加します。

Answer the question using the text below. Respond with only the text provided.
Question: What should I do to fix my disconnected wifi? The light on my Google Wifi router is yellow and blinking slowly.

Text:
Color: Slowly pulsing yellow
What it means: There is a network error.
What to do:
Check that the Ethernet cable is connected to both your router and your modem and both devices are turned on. You might need to unplug and plug in each device again.

Color: Fast blinking yellow
What it means: You are holding down the reset button and are factory resetting this device.
What to do:
If you keep holding down the reset button, after about 12 seconds, the light will turn solid yellow. Once it is solid yellow, let go of the factory reset button.

Color: Solid yellow
What it means: Router is factory resetting.
What to do:
This can take up to 10 minutes. When it's done, the device will reset itself and start pulsing white, letting you know it's ready for setup.

Color: Solid red
What it means: Something is wrong.
What to do:
Critical failure. Factory reset the router. If the light stays red, contact Wifi customer support.
  
Check that the Ethernet cable is connected to both your router and your modem and both devices are turned on. You might need to unplug and plug in each device again.
  

概要

  • レスポンスの生成時にモデルが使用するように設定するプロンプトに情報(コンテキスト)を追加します。
  • コンテキスト情報の用途について、モデルに指示を与えます。

接頭辞を追加する

接頭辞は、プロンプト コンテンツに追加する単語またはフレーズであり、接頭辞を付加する場所に応じてさまざまな目的で使用できます。

  • 入力接頭辞: モデルへの入力の意味的に重要な部分である入力シグナルに接頭辞を追加します。たとえば、接頭辞「English:」と「French:」は 2 つの異なる言語を識別可能にします。
  • 出力接頭辞: 出力はモデルによって生成されますが、プロンプトで出力に接頭辞を追加できます。出力接頭辞は、レスポンスとして期待される内容に関する情報をモデルに与えます。たとえば、出力接頭辞「JSON:」は、出力を JSON 形式にする必要があることをモデルに伝えます。
  • 接頭辞の例: 少数ショット プロンプトでは、例に接頭辞を追加すると、モデルが出力の生成時に使用できるラベルが提供されます。これにより、出力内容の解析が容易になります。

次の例では、「Text:」が入力接頭辞であり、「The answer is:」が出力接頭辞です。

Classify the text as one of the following categories.
- large
- small
Text: Rhino
The answer is: large
Text: Mouse
The answer is: small
Text: Snail
The answer is: small
Text: Elephant
The answer is:
  
large
  

モデルに部分的な入力を任せる

生成言語モデルは、高度なオートコンプリート ツールのように機能します。部分的なコンテンツを提供すると、モデルは残りのコンテンツ、またはコンテンツの継続として認識したコンテンツをレスポンスとして提供できます。その場合、例やコンテキストを含めると、モデルはそれらの例やコンテキストを参考にできます。

次の例では、指示とエンティティ入力を含むプロンプトを示しています。

For the given order, return a JSON object that has the fields cheeseburger, hamburger, fries, or
drink, with the value being the quantity.

Order: A burger and a drink.
  
```
{
"cheeseburger": 0,
"hamburger": 1,
"fries": 0,
"drink": 1
}
```
  

モデルはプロンプトに従って動作しましたが、自然言語での指示は難しい場合があり、モデルの解釈に多くの負担が残ります。たとえば、レストランのメニューに多くのアイテムが含まれているとします。JSON レスポンスのサイズを小さくするには、オーダーされていないアイテムを省略します。この場合、例とレスポンス接頭辞を指定して、モデルに完成させることができます。

Valid fields are cheeseburger, hamburger, fries, and drink.
Order: Give me a cheeseburger and fries
Output:
```
{
  "cheeseburger": 1,
  "fries": 1
}
```
Order: I want two burgers, a drink, and fries.
Output:
  
```
{
"hamburger": 2,
"drink": 1,
"fries": 1
}
```
  

「cheeseburger」は注文に含まれていないため、出力から除外されています。

レスポンスの形式をモデルに指示する

完了戦略は、レスポンスの形式にも活用できます。次の例では、小論文の概要を作成するようにモデルに指示しています。

Create an outline for an essay about hummingbirds.
  
I. Introduction
A. Hook: Begin with an intriguing fact or description of hummingbirds.
B. Provide some background information on hummingbirds.
1. Mention their small size and long, thin beaks.
2. Highlight their unique ability to hover and fly backward.

II. Body
A. Anatomy and Physiology
1. Elaborate on their tiny size, making comparisons to other animals.
2. Describe their wings and how they enable hovering and swift flight.
3. Discuss their metabolism and energy requirements, emphasizing their caloric needs.

B. Feeding Habits and Diet
1. Explain their primary food source, nectar, and how they extract it from flowers.
2. Describe their ability to feed from a wide variety of flowers.
3. Mention their consumption of insects and the nutritional value they provide.

C. Migration Patterns
1. Discuss the incredible long-distance migrations of some hummingbird species.
2. Explain the phenomenon of seasonal migration and the environmental factors driving it.
3. Describe the routes taken by different species during migration.

D. Conservation and Threats
1. Highlight the importance of hummingbirds in ecosystems as pollinators.
2. Discuss the challenges and threats they face, such as habitat loss, nectar scarcity, and climate change.
3. Mention conservation efforts and ways to support hummingbird populations.

III. Conclusion
A. Summarize the main points covered in the essay.
B. Reinforce the importance of hummingbirds and their ecological role.
C. Provide a final thought or call to action to protect these fascinating creatures.
  

プロンプトでアウトラインの形式が指定されていないため、モデルによって形式が選択されています。モデルが特定の形式でアウトラインを返すようにするには、アウトラインの始点を表すテキストを追加し、開始パターンに基づいてモデルを完成させます。

Create an outline for an essay about hummingbirds.
I. Introduction
   *
  
I. Introduction
* Capture the reader's attention with an interesting anecdote or fact about hummingbirds.
* Provide a brief background on hummingbirds, including their unique characteristics.
* State the main points that will be covered in the essay.

II. The Unique Characteristics of Hummingbirds
* Discuss the hummingbird's exceptionally rapid wing-beat, allowing them to hover and fly backward.
* Highlight their tiny size, making them the smallest birds in the world.
* Describe their long, slender beaks and tongues, allowing them to reach deep into flowers to extract nectar.
* Explain their iridescent plumage, which creates brilliant and vibrant colors.

III. Hummingbird Migration and Distribution
* Discuss the extensive migration patterns of hummingbirds, covering vast distances across continents.
* Describe the different habitats where hummingbirds can be found, including tropical rainforests, deserts, and urban areas.
* Explain the seasonal changes that influence hummingbird migration and habitat selection.

IV. Hummingbird Diet and Feeding Habits
* Focus on the hummingbird's primary food source, which is nectar from flowers.
* Describe their ability to consume insects, spiders, and other small invertebrates for protein.
* Explain how hummingbirds use their long, slender tongues to extract nectar from flowers.
* Discuss the importance of flowering plants in providing sustenance for hummingbirds.

V. Reproduction and Nesting Behavior
* Describe the mating rituals and courtship behavior of hummingbirds.
* Explain the process of nest-building, including the materials used and the unique characteristics of hummingbird nests.
* Discuss the role of the female hummingbird in laying and incubating eggs.
* Describe the development of hummingbird chicks and the role of both parents in providing care.

VI. Threats to Hummingbirds and Conservation Efforts
* Highlight habitat loss, climate change, and deforestation as significant threats to hummingbird populations.
* Describe the role of habitat conservation initiatives in protecting hummingbird habitats.
* Explain the importance of creating hummingbird-friendly gardens and landscapes.
* Discuss the efforts of organizations and individuals working to conserve hummingbird populations.

VII. Conclusion
* Summarize the main points covered in the essay, emphasizing the unique characteristics, migration patterns, diet, reproduction, and conservation of hummingbirds.
* Provide a closing statement that leaves a lasting impression on the reader and reinforces the significance of these fascinating creatures.
  

概要

  • モデルに部分的な入力を与えると、モデルはプロンプトの利用可能な例やコンテキストに基づいて、入力を補完します。
  • モデルに入力を完成するよう求めるほうが、自然言語でタスクを記述するよりも簡単な場合があります。
  • プロンプトに部分的な回答を追加すると、モデルが目的のパターンや形式に従うように指示できます。

プロンプトを単純なコンポーネントに分割する

複雑なプロンプトを必要とするユースケースでは、プロンプトをより単純なコンポーネントに分割することで、モデルでこの複雑さを管理できるようになります。

指示を分割する

1 つのプロンプトに複数の指示を記述するのではなく、指示ごとに 1 つのプロンプトを作成します。ユーザーの入力に基づいて、処理するプロンプトを選択できます。

プロンプトを連結する

複数の連続したステップを含む複雑なタスクの場合は、各ステップをプロンプトにして、プロンプトを順番に連結します。このプロンプトのチェーンでは、シーケンス内の 1 つのプロンプトの出力が次のプロンプトの入力になります。シーケンスの最後のプロンプトの出力が最終出力になります。

レスポンスを集計する

集計とは、データのさまざまな部分に対して異なる並列タスクを実行し、結果を集計して最終出力を生成することです。たとえば、データの最初の部分に対して 1 つのオペレーションを実行し、残りのデータに対して別のオペレーションを実行して、結果を集計するようにモデルに指示できます。

まとめ

  • 複雑な指示を指示のプロンプトに分解します。また、ユーザーの入力に応じて適用するプロンプトを決定します。
  • 連続した複数のステップを別々のプロンプトに分割し、前のプロンプトの出力が次のプロンプトの入力になるように連結します。
  • 並列タスクを分解し、レスポンスを集計して最終出力を生成します。

さまざまなパラメータ値を試す

モデルに送信するそれぞれの呼び出しに、モデルがどのようにレスポンスを生成するかを制御するパラメータ値が含まれています。このモデルは、パラメータ値によって異なる結果を生成できます。さまざまなパラメータ値を試して、タスクに最適な値を取得します。使用可能なパラメータはモデルに世代によって異なる場合があります。最も一般的なパラメータは次のとおりです。

  • 最大出力トークン
  • 温度
  • トップ K
  • トップ P

最大出力トークン

レスポンスで生成できるトークンの最大数。1 トークンは約 4 文字です。100 トークンは約 60~80 語に相当します。

レスポンスを短くしたい場合は小さい値を、長くしたい場合は大きい値を指定します。

温度

温度は、レスポンス生成時のサンプリングに使用されます。レスポンスの生成は、topPtopK が適用された場合に行われます。温度は、トークン選択のランダム性の度合いを制御します。温度は低いほど、確定的で自由度や創造性を抑えたレスポンスが求められるプロンプトに適しています。一方、温度が高いと、より多様で創造的な結果を導くことができます。温度 0 は確定的であり、最も高い確率のレスポンスが常に選択されることを表します。

ほとんどのユースケースでは、温度 0.2 から始めてみることをおすすめします。モデルが返すレスポンスが一般的すぎたり、短すぎたり、フォールバック レスポンスが返ってきたりする場合は、温度を高くしてみてください。

トップ K

トップ K は、モデルが出力用にトークンを選択する方法を変更します。Top-K が 1 の場合、次に選択されるトークンは、モデルの語彙内のすべてのトークンで最も確率の高いものであることになります(グリーディ デコードとも呼ばれます)。Top-K が 3 の場合は、最も確率が高い上位 3 つのトークンから次のトークン選択されることになります(温度を使用します)。

トークン選択のそれぞれのステップで、最も高い確率を持つ Top-K のトークンがサンプリングされます。その後、トークンはトップ P に基づいてさらにフィルタリングされ、最終的なトークンは温度サンプリングを用いて選択されます。

ランダムなレスポンスを減らしたい場合は小さい値を、ランダムなレスポンスを増やしたい場合は大きい値を指定します。トップ K のデフォルト値は 40 です。

トップ P

トップ P は、モデルが出力用にトークンを選択する方法を変更します。トークンは、確率の合計が Top-P 値に等しくなるまで、確率の高いもの(Top-K を参照)から低いものへと選択されます。たとえば、トークン A、B、C の確率が 0.3、0.2、0.1 であり、トップ P 値が 0.5 であるとします。この場合、モデルは温度を使用して A または B を次のトークンとして選択し、C は候補から除外します。

ランダムなレスポンスを減らしたい場合は小さい値を、ランダムなレスポンスを増やしたい場合は大きい値を指定します。トップ P のデフォルト値は 0.95 です。

プロンプトの反復処理に関する戦略

プロンプトの設計は反復プロセスであり、多くの場合は、望ましいレスポンスを一貫して取得できるように何度か反復が必要になります。このセクションでは、プロンプトを反復処理する際に試すことができるいくつかのガイダンスについて説明します。

別の言い回しを使用する

多くの場合、プロンプトで異なる単語やフレーズを使用すると、すべて同じ意味であってもモデルのレスオンスが異なります。プロンプトから期待される結果が得られない場合は、言い換えてみてください。

Version 1:
How do I bake a pie?

Version 2:
Suggest a recipe for a pie.

Version 3:
What's a good pie recipe?
  

似たタスクに切り替える

モデルに対してタスクの指示に従わせることができない場合は、同じ結果が得られる同様のタスクの指示を出してみてください。

このプロンプトは、事前定義されたカテゴリを使用して書籍を分類するようモデルに指示します。

Which category does The Odyssey belong to:
thriller
sci-fi
mythology
biography
  
The answer: mythology

Explanations:

The Odyssey is an epic poem in ancient Greek literature. It is one of two major ancient Greek epic
poems attributed to Homer. The Odyssey is an epic poem that tells the story of Odysseus, a Greek
hero who fought in the Trojan War and then spent ten years trying to return home to Ithaca. The
Odyssey is a work of mythology.
  

レスポンスは正解ですが、モデルがオプションの境界内に収まっていません。また、完全な文ではなく、いずれかのオプションのみを使用して応答するようにモデル化する必要があります。この場合、指示を多肢選択式の質問として言い換えて、モデルにオプションの選択を求めることができます。

Multiple choice problem: Which of the following options describes the book The Odyssey?
Options:
- thriller
- sci-fi
- mythology
- biography
  
The answer is: mythology
  

プロンプトのコンテンツの順序を変更する

プロンプト内のコンテンツの順序がレスポンスに影響する場合があります。コンテンツの順序を変更して、レスポンスにどう影響するかを確認してみます。

Version 1:
[examples]
[context]
[input]

Version 2:
[input]
[examples]
[context]

Version 3:
[examples]
[input]
[context]

フォールバック レスポンス

フォールバック レスポンスは、プロンプトまたはレスポンスのいずれかが安全フィルタをトリガーした場合に、モデルが返すレスポンスです。フォールバック レスポンスの例としては、「私は言語モデルにすぎないため、それについては対応できません」が挙げられます。

モデルがフォールバック レスポンスを返す場合は、Temperature を上げてみてください。

非推奨事項

  • 事実に基づく情報の生成についてモデルに頼ることは回避してください。
  • 数学や論理の問題では慎重に使用してください。

次のステップ