方言を話すおしゃべり猫型ロボット『ミーア』をリリースしました(こちらをクリック)

What are good prompts to give to ChatGPT? Six tactics to get good results.

chatgpt-six-tactics-to-get-good-results
この記事は約15分で読めます。

Importance of questioning skills

One of the business skills often mentioned is the ability to ask questions, and the prompts given to ChatGPT are similar, only the target has changed to a machine instead of a person.

If you throw a question into ChatGPT as a prompt, such as “Please tell me about XXX (a rough description),” which is too vague even for you and has not yet been verbalized, you will not get the answer you intended. Conversely, ChatGPT is also useful as a tool for improving one’s questioning skills.

In the prompting stage, it is important to ask yourself questions such as, “What kind of answer am I expecting from this question? If so, I should ask this question more specifically,” etc., and sublimate it to a good question, which will ultimately be more efficient in eliminating the process of repeatedly interacting with ChatGPT.

There are six tactics introduced by OpenAI officials to help you do this, and we will summarize them here.

https://platform.openai.com/docs/guides/prompt-engineering

In both cases, the process of creating a type and then filling in the variables in the question statement (prompt ) will encourage the students to think concretely during the questioning phase.

Six tactics to get good results

The six tactics covered are

  • Write clear and specific instructions.
  • Specify persona
  • Use delimiters to clearly indicate different parts of the input
  • Specify the steps required to complete the task
  • Provide examples
  • Specify the desired length of output

Write clear and specific instructions.

Bad example

  • How do I add numbers in Excel?
  • Who is the President?
  • Summarize meeting notes.

Case in point.

  • How do I sum rows of amounts in Excel? I would like to do this automatically for the entire sheet of rows so that all totals appear in a column on the right called “Total”.
  • Who was the president of Mexico in 2021? How often are elections held?
  • Summarize your meeting notes into a single paragraph. Next, create a markdown list of speakers and their key points. Finally, list the next steps or action items suggested by the speaker, if any.

This goes directly to the questioning skills I mentioned earlier, but it means that we should not throw the question as it is in the abstract stage. However, how can we make it concrete? So, one idea would be to further utilize ChatGPT to further sublimate the first question that comes to mind into a clearer instruction, and then ask the question.

For example, with regard to the last item, “Summarizing Meeting Minutes,” I asked, “I would like to summarize my notes from the meeting; I need further clarification from ChatGPT in order to get better results. Please enumerate what points should be considered,” and he listed the items to be considered.

After reading these results, I see, that I should try to adopt some of these specific instructions and include them in the prompts.

It is also useful to have ChatGPT ask the reverse question, “If you don’t have enough information, ask a question”.

Establish personas

This is well known but set the role at the beginning of the prompt.

‘a brilliant AI researcher,’ ‘an experienced writer,’ ‘a professional marketer.’

例)

あなたは優秀なAIの研究者です。

下記の文章を中学生にもわかるように

段階的に考えて明確で正しい要約をしてください。

#

(ここに文章を貼る)

Use delimiters to clearly indicate different parts of the input.

The # and ” are recommended as delimiters.

A single delimiter (#) is acceptable. There is no need for more than one (####).

The prompt I just gave you.

#
(ここに文章を貼る)

This is the part that is

Specify the steps required to complete the task

Models make more inference errors when they try to answer quickly rather than taking their time to get to the answer. Asking for a “chain of thought” before the answer helps the model more reliably infer a path toward the correct answer.

Instructions such as “Think step by step” or “Perform the task step by step” give the language model time to think.

例)あなたはAI機械学習の専門の研究者です。

各セクションとそれに基づく内容を日本語で出力します。

与えられた文章において、次のステップで段階的にタスクを行なってください

1. 各セクションのタイトルを抽出する
2. そのタイトルの要約を明確に意味がわかるように行う。必要に応じて専門知識で補完する
3. 中学生にもわかるようにどのような技術なのかを説明してください。

#

(ここに文章を貼る)

Provide examples (FEW SHOT PROMPTING)

A Zero-shot prompt is a prompt that asks only questions without giving any information in advance. Few-shot prompting, on the other hand, is a prompt that gives a few examples and allows the user to generate answers.

As shown below, the accuracy of the response will be improved by presenting an example and the correct answer and then asking the original question.

It would be useful for arithmetic, or for outputting poetic sentences, for example.

問題:4, 2, 5, 7, 10, 13の偶数を合計するといくつになりますか?
答え:16

問題:4, 2, 5, 6, 10, 15の偶数を合計するといくつになりますか?

Specify the desired length of output

The length of the target output is specified by the number of words, sentences, paragraphs, bullets, etc.

三重引用符で区切られたテキストを約 50 語に要約します。
"""ここにテキストを挿入"""

三重引用符で区切られたテキストを 2 つの段落にまとめます。
"""ここにテキストを挿入"""

三重引用符で区切られたテキストを 3 つの箇条書きで要約します。
"""ここにテキストを挿入"""

When you want to output in tabular format, add column names as follows.

#出力
表形式:|質問|意図|

I’ll list some of the principles listed in the paper “26 Principles of Prompting” that improve responses to large-scale language models, which I thought were a heck of a good idea.

https://arxiv.org/abs/2312.16171v1

  • Eliminate politeness: no need for courtesy terms such as “please”.
  • Instructions for clarification: “Explain in simple language,” “Explain in a way that a junior high school student can understand,” etc.

The rest,

“Modify the prompt so that you get the answer I just gave you from the beginning.”

is also useful. If you have obtained the desired response by trial and error, and want to get the same response from the input information in the future, you can use this function. ChatGPT will then tell you the best prompt for you.

For other prompt tactics in the case of GPT-4V, which supports multimodal input, click here.

  1. Multiple images and text information can be combined and processed (Interleaved Image-text Pairs)
  2. Following Text Instructions
  3. Constrained prompting
  4. Condition on good performance

summary

There are a lot of articles on the street about better prompts, calling it prompt engineering, but if you read them all, you will drown in a sea of information, and there are actually four simple things to think about

  • If you want to ask a question, the first sentence is the persona setting, so set up a role (e.g., a professional engineer if the question is about programming) that would answer the question accurately and incorporate it into the opening sentence.
  • Make the desired output results that are fluffy in your mind materialize (format, number of characters, etc.)
  • Think about the steps before getting to that output result and put them in the prompt
  • If you feel that inserting an example would give a better result, add an example that a question A would result in an answer B.

Template Example

You are a professional XXXX.
Based on the following constraints and input statements, please think step by step to obtain the correct answer.

#Constraints

#Examples (if needed)
Examples of input and output are listed below.
– Input statement:
– Output statement:

#Procedure Execution Process (if necessary)
1.
2.
3.

#Output

If anything, the most difficult part seems to be holding back the urge to ask prompt questions immediately at the fluffy stage and focusing on the specifics of the question. Well, it is a matter of training.

The image of aiming for one straight shot instead of hitting many small jabs (wrong…).

Regarding what to keep in mind when utilizing ChatGPT in programming, it is described here.

Read up on examples of prompts.

Now that I have presented the six tactics for getting good results that were introduced on the official website, I think it is important to read up on the examples of prompts presented on the official website.

Examples of prompts in various categories are provided.

https://platform.openai.com/examples

For example, one could read the prompt “interview questions” and get the idea, “Can ChatGPT also be used to create interview questions for recruiting?

As for the prompts to create code from specifications, it is also helpful to see that if the prompts are fleshed out to this level, they will write code that meets the objective in a single shot.

The tutor’s prompt is also interesting. It could be used as an educational tool as it is.

Summaries of meeting notes may be copied and pasted as is.

コメント

タイトルとURLをコピーしました