SYSTEM NOTICE

Auto translation by AI. Be sure, accuracy, nuances and authorial intent may not be fully reflected.
見出し画像

[With Examples] How to Master Chat-GPT 02: Decoding [26 Principles of Prompt Engineering] Part 1

I recently wrote about how to actually use Chat-GPT.

Thank you for the comments, including, "It's important to have a stance of conversation and dialogue." While that is true, there is, of course, also value in the know-how of how to use it.

Last month, a group of researchers from the Mohamed bin Zayed University of Artificial Intelligence (MBZUAI) in Abu Dhabi published "26 Principles" for optimizing interaction with Large Language Models (LLMs) and it became a hot topic.

The original text is here.



Japanese Translation: "26 Principles"

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 positive language rather than negative words
⑤ Instructions for clarification: Use phrases like "in simple terms" or "explain it so a middle schooler can understand"
⑥ Offer rewards: Indicate that "a reward will be given for a good answer"
⑦ Provide examples: Use existing examples
⑧ Prompt formatting: Start with "###Instruction###" and include "###Example###" or "###Question###" as appropriate.
⑨ Clear task instructions: Instruct with "Your task is".
⑩ Mention penalties: State that "there is a penalty".
⑪ Instruct to answer in natural language: 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.
⑮ Include testing in instructions: Have the model provide 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.
㉑ Instructions for detailed text creation: Instruct to "write in detail".
㉒ Prevent style changes: Instruct to "not change the style".
㉓ Coding prompts for multiple files: To streamline coding tasks across 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: Clearly state the requirements the model must follow to create content, in the form of keywords, regulations, hints, instructions, etc.
㉖ Create text based on samples: Instruct to write in the same language as the sample.

Quite a lot of techniques have been researched.

The "Useful Principles" I've Experienced: ①-③

From here on, I will explain, in several parts, using actual examples I have used myself, and focusing onthings that I personally feel are "actually useful".

① Omit politeness: Polite terms like "please" are unnecessary → × I don't necessarily think so (+ actual example)

Regarding this, I don't necessarily think so. Rather than politeness (I call it emotional prompting), there are cases where encouraging or praising Chat-GPT is effectivetoo.

I wrote an article about emotional prompting before.

From my experience,at least with the Japanese version of Chat-GPT4, I think it's better to include polite terms. To be precise, it meansthere is a possibility that performance will improve if you include them.

When I use Chat-GPT, after entering instructions or questions, I enter the following kind of text at the end.

".... So, I look forward to your response!"
"... You can do better than this, so do your best."

Just saying "please" has almost no effect, but I feel thatwhen you add an "!" at the end like "Please!", you often get more polite and longer answers.

When you"be polite" in your interactions with Chat-GPT, it seems that Chat-GPT perceives me as a person with a high intellectual level and consciously outputs higher-level answers.


② Specify the target audience: Specify who the response is for, such as "for experts" → ◎ I think this is the most important rule (+ actual example)

As I wrote in a previous article, conversation with Chat-GPT is similar to a conversation with someone who is socially awkward and whom you are meeting for the first time.

Since it is our first meeting, Chat-GPT does not know who we are.

If we were talking to another human, we would start with an introduction, and it is the same when talking to Chat-GPT.Chat-GPT cannot have a good conversation with us unless it knows what knowledge we have, what our interests are, and why we wanted to talk to it in the first place.

Therefore, it is clearly better to get a good response if we briefly introduce ourselves and explain who we are as the target user.

For example,

・I am XX
・I want to know about XX for the reason of XX
・But my knowledge about XX is about XX level
・My level of understanding is about XX
・Please have a conversation based on that

If you input this at the beginning, the subsequent conversation will go smoothly.

In short,if you declare who you are at the beginning, it becomes easier to get the answers you want. This is absolute, so I think it is the most important rule among the 26 rules.


3. Complex Task Decomposition: Breaking down complex tasks into simple prompts -> Yes (+ examples)


It is good to keep this in mind as a set with12: 'Use leading words: Instruct it to "think step-by-step."'but it means thatit is better to break it down and write it out rather than cramming too much into one prompt.

Let me start with an example of what should be improved.

"Make a song for a female singer that uses recent trendy words, lyrics that make children feel energetic, includes some English words, has a stylish feel, but also feels funny, makes them happy to listen to, follows current trends, and is sung by a female singer."

Even if you give instructions like that,Chat-GPT will get confused.

This is because, unlike English, Japanese sentences are constructed with subjects, predicates, and conjunctions intricately intertwined. That is very difficult for AI to understand.

If you want to request the above,

Please create lyrics as follows.

1. Something a female singer would sing. Something that feels like it was written by a woman.
2. Use trendy words, words that are often used in lyrics recently.
3. For children.
4. Include some English words.
5. Something funny and pleasant to listen to.

If you write it this way, Chat-GPT will understand it properly and create lyrics that sound like that.Since it is difficult to tell where sentences end in Japanese, the trick is to break them down and input them in a numbered list or bullet points.

To be continued next time.



いいなと思ったら応援しよう!