[With Examples] How to Master Chat-GPT: Decoding the '26 Principles of Prompt Engineering' (Part 2)
Last month, a group of researchers at the Mohamed bin Zayed University of Artificial Intelligence (MBZUAI) in Abu Dhabi published '26 Principles' for optimizing interactions with Large Language Models (LLMs) and it became a hot topic.
In response, in the previous article, I provided supplementary explanations for tips ① to ③ of the 26 prompt input tips (the list is included in the article below, and also at the end of this article).
This time, we will cover the continuation, from ④ to ⑦.
Let's get started!
④ Use affirmative instructions: Use affirmative words instead of negative ones → 〇 Be clear and easy to understand. Double negatives are NG (+ examples)
For example, the colloquial expression often used in daily life between Japanese people, 'Don't you understand that?' (conveying 'I don't understand' indirectly), when you think about it, is actually confusing because it's unclear whether you understand or not, isn't it?
It might sound a bit harsh to other native Japanese speakers, but when trying to speak kindly to someone who is learning Japanese, it is safer to say it straight: 'I don't understand that' or 'I don't understand'.
The same applies to Chat-GPT. This is ④, 'Use affirmative words instead of negative ones'.

As with the previous example, if you use a negation of a negation, i.e., a double negative, Chat-GPT might misunderstand you.
Let's do an experiment.
What happens if you give the following two responses to Chat-GPT?
・Example interpreted as not understanding: Me: 'What does cause and effect mean?' GPT: 'XXX...' Me: 'I don't not understand what you're saying' (a Japanese double negative). GPT: 'Understood. I will explain it more simply,' and gave a different answer.
It seems it thought 'I don't not understand' meant I didn't understand.
・Example interpreted as understanding: Me: 'What does cause and effect mean?' GPT: 'XXX...' Me: 'It is not that I don't understand what you are saying' (a Japanese double negative). GPT: 'Thank you. I'm glad you understood.'
It seems it thought 'It is not that I don't understand' meant I understood.
We often use negative words or double negatives in Japanese. Yes, as I wrote earlier, it's convenient when you don't want to say things clearly.
But for AI and computers, these are extremely annoying expressions that are difficult to understand. When you want to say 'I understand. But...', end the sentence once.
'I don't not understand what you're saying, but...'...✕ 'I understand what you're saying. However...'
...〇
If you don't use affirmative words, you won't be friends with Chat-GPT (lol). Don't assume the other party is a native Japanese speaker, and try to be as clear, simple, and affirmative as possible.

⑤ Instructions for clarification: 'In simple words,' 'So that a middle school student can understand,' etc. → ◎ Important enough to be in the top 3. Convey 'something like this' (+ examples)
This is an important tip. It's important enough to be in the top 3 of the 26 tips. I use it frequently too.
As I wrote before, using Chat-GPT means having a conversation. And, Chat-GPT is always struggling with how it should answer.
When answering, Chat-GPT calculates and outputs the words it deems most suitable for the response to our input, but it relies heavily on the 'contextual information' of the words to calculate and judge this 'suitability'.
One piece of information useful for helping with this hesitation is information about what kind of answer I am expecting.
What becomes effective at that time is information like 'answer in this kind of way'.

Requests like 'answer in this kind of way'
Specifically, if you include the following types of information in your input, it will return answers closer to your expectations.
・Provide information about your knowledge level (*Most important!)
'Answer as if you were teaching an elementary school student'
'Answer with the premise that I understand XX but do not understand YY'
'I have programming experience, so answer with that in mind'
・Specify the response method
'Answer in bullet points'
'Answer within 300 characters'
'Answer in Japanese'
・Specify the tone
'Answer like a friend'
'Teach me like a teacher'
'Answer politely'
Also, 'in Japanese'
Sometimes Chat-GPT (especially when the content is complicated) starts answering in English. But you don't need to panic.
In that case, if you input 'in Japanese' or 'please answer in Japanese', it will return to Japanese.

⑥ Presenting rewards: Indicating 'I will give a reward for a good answer' → △ Supplement for Chat-GPT's understanding. Try scoring the answer (+ example)
This is a technique you don't really need to use often, but I will add a little supplement to help you understand Chat-GPT.
Chat-GPT has been trained through machine learning and has learned a vast amount of knowledge, and during that training, it is trained by assigning scores, such as 10 points for a correct (good) answer, 5 points for a not-so-good answer, and 0 points for a mistake.
In other words, since Chat-GPT is instructed to increase its score, it recognizes that a higher score is a better answer. In short, it is used to being scored.
Therefore, when Chat-GPT gives you various answers, if you input 'Your answer XX is 10 points, YY is 5 points, and ZZ is 0 points. Based on that, please answer from now on!', it will, on the spot, 'temporarily learn what a good answer is'.

Evaluating answers with scores for AI → Faster understanding
This method of scoring the response results is often used in AI development. If you evaluate the AI's answers with scores, it will understand what is good and what is not good more quickly.
If you are interacting with Chat-GPT and think, "I'm not getting a very good answer," you can improve the quality of the response by evaluating it when it gives a good one, saying, "The current answer is 100 points. The previous answer was 0 points.". You only need to do this when Chat-GPT's answers are consistently off-base, so please give it a try.

⑦ Provide examples: Use existing examples → 〇 Important. Try showing your own answer examples (+ actual examples)
This is also important.
If there is a specific way you want it to answer, you can say "Answer on the premise that XX" or "Answer like XX" as explained in ⑤, but if you want to be more specific, providing an answer example is the most effective method.
For example,
"Please list 5 recommended side jobs. However, please answer in the following format."
① Side job name (please number them starting from ①)
② Ease of starting: 5-point scale from 1 to 5 (5 is the easiest to start) and the reason
③ Profitability: 5-point scale from 1 to 5 (5 is the easiest to make a large profit) and the reason
④ Risk: 5-point scale from 1 to 5 (5 is the highest risk) and the reason
① Amazon Affiliate
Ease of starting: 5
Reason: Because you can start immediately after registering for the affiliate program.
Profitability: 2
Reason: Because it depends on the traffic-drawing power of the media where you post the links.
Risk: 1
Reason: Because anyone can start with no initial investment, and there are no approvals or conditions.
②, ③... (similarly)
If you find it easier to understand when summarized like this, or if you want it summarized in a certain way, it is convenient to define output examples or formats as shown above.
It will also output in table format, which is convenient, isn't it?

To be continued next time.
* The "26 Principles" are as follows (translated into Japanese).
① Omit politeness: Polite terms like "please" are unnecessary
② Specify the target audience: Specify who the response is for, such as "for experts"
③ Break down complex tasks: Divide complex tasks into simple prompts
④ Use affirmative instructions: Use affirmative words rather than negative ones
⑤ Instructions for clarification: "In simple terms," "So that a middle school student can understand," etc.
⑥ Offer rewards: Indicate that "a reward will be given for a good answer"
⑦ Provide examples: Use existing examples
⑧ Prompt format: Start with "###Instruction###" and include "###Example###" or "###Question###" as appropriate.
⑨ Clear task instructions: Instruct with "Your task is".
⑩ State penalties: Tell it "there is a penalty".
⑪ Natural language response instruction: Instruct to "answer in natural language".
⑫ Use leading words: Instruct to "think step by step".
⑬ Eliminate bias: Instruct to "be unbiased and not rely on stereotypes".
⑭ Encourage dialogue with the user: Have the model ask questions until the problem is solved.
⑮ Instruction including tests: Have it give you a test to check your understanding.
⑯ Assign a role to the model: Assign a specific role to the model.
⑰ Use delimiters: Use specific delimiters.
⑱ Use repetition: Use specific words or phrases multiple times.
⑲ Chain of thought: Generate intermediate steps and combine examples.
⑳ Use output primers: End the prompt with the beginning of the expected output.
㉑ Detailed text creation instruction: Instruct to "write in detail".
㉒ Prevent style changes: Instruct to "not change the style".
㉓ Coding prompts for multiple files: To streamline coding tasks spanning multiple files, suggest creating a script that automatically creates new files and inserts the generated code into the appropriate files.
㉔ Continue with specific words: Instruct to "complete with the given words".
㉕ Specify model requirements: Specify the requirements the model must follow to produce content in the form of keywords, regulations, hints, instructions, etc.
㉖ Text creation based on samples: Instruct to write in the same language as the sample.

