Essence Notes of "ChatGPT Prompt Project for Developers" by Wu Enda and OpenAI

《ChatGPT Prompt Engineering for Developers》

 ChatGPT hint project for developers

0ea0e20e623a65b7ebda62bd6715e165.png

shadow

Taking advantage of the vacation, I studied the prompt course, made some simplifications and sorted out key knowledge points, and shared them with everyone.

LLM Achievable Tasks

include:

Summary (such as summarizing user reviews)

Inference (e.g. sentiment classification, topic extraction)

Transforming text (e.g. translation, rewriting)

Extensions (such as auto-composing emails)

3ba1431da46b876da19c9aac2a0b0c86.png

Summarize with ChatGPT https://chirper.ai/shadowai

abb67e5eb56828567db2111f10605db5.png

Inference - Sentiment Classification

de9949b03a1b8421455a944208db819c.png

Convert text and turn an esoteric article into a story suitable for children

66b3253a46bc5328e6b40a76ad6c0917.png

extensions, auto-write emails, introductory articles

prompt skills

When you use a prompt to tune your LLM, consider sending the prompt to someone who is smart but doesn't understand the details of your assignment. If LLM is not working properly, sometimes it is because the prompt is not clear enough.

Principle number one: Write clear and specific instructions.

The second principle: give the model enough time to think.

Don't confuse clear prompts with short prompts, as in many cases longer prompts actually provide more clarity and context, which is beneficial for LLM to match expected output.

Principle 1: Clear and Specific Instructions

Tip 1: Use specifiers

Use delimiters to clearly indicate different parts of the input. The discriminator can be any symbol, such as ```, """, < >, <tag> </tag>, so that the model clearly knows which are independent parts to avoid hint injection.

Prompt injection refers to user instructions in the input that may contradict our instructions, causing the model to follow the user's instructions instead of our instructions.

Without discriminators, users may add irrelevant inputs, causing the model to output wrong results. Therefore, using discriminators can improve the accuracy and stability of the model.

3e98ff964ff5e818118cc76c6a4d1819.png

Tip 2: Structure output

To make parsing model output easier, it may be helpful to require model output in a structured format such as HTML or JSON.

a0fea48b3ef805fe71b38f1c196d6b08.png

Tip 3: Whether the conditions are met

If the task has some assumptions that are not necessarily satisfied, we can tell the model to check those assumptions first, point out and stop the task if they are not satisfied.

fdee6890b35edfa5cbac01fe9550ded0.png

d86e62e35d4b2e3c1a1a75287e757dae.png

Tip 4: Few Sample Hints

few-shot prompting. This approach is to provide examples that have successfully performed the desired task before letting the model perform the actual task.

4ce78ba79847c42479612c810cb91246.png

Principle 2: Give the model time to think

If you give the model a task that is too complex, it may get incorrect results in a short period of time.

Tip 1: Complete step by step

First, we can use explicit steps to complete a task. In this example, we feed the model a paragraph containing the story of Jack and Jill, and instruct the model to complete four tasks with explicit steps:

1. First, summarize the text in one sentence

2. Second translate the overview into French

3. Then list each name in French overview

4. And output a JSON object containing two keys "French summary" and "num names".

After running this model, we can see that the model has completed these four tasks respectively, and output the results in the format we require.

ce44130966d88a3963090d48eaf15ea4.png

7af4626f4cd81b1f2d4c26e8739f76c4.png

Tip 2: Let the model sort out before giving conclusions

Sometimes we get better results when we explicitly instruct the model to sort out the order of things before drawing conclusions.

In this question, we ask the model to judge whether the student's answer is correct. First, we have this math problem, and then the student's solution.

cd7a75a4812488f9efe63109da772c78.png

0e7a1edd0c12b36c8b365b8a433a63f2.png

f527eff52abd7cf65b2b7f8ac246a43e.png

2e611bc9b8af637d8446e8863d940320.jpeg

Xiaobai's Prompt Getting Started Experiment Guide & Mixlab Recommendation

b8922f329696421d0d0a5eb544dcb325.png

opus

For more tips and engineering skills, you can pay attention to the community or the knowledge planet~~

ff54551c32c7aa98b61f0d03dbec5c72.jpeg

Guess you like

Origin blog.csdn.net/shadowcz007/article/details/130479224