I want to learn how to engineer prompts for AI models such as ChatGPT or Open Assistant.…
- User
I want to learn how to engineer prompts for AI models such as ChatGPT or Open Assistant.
Please provide the top variables to keep in mind while writing a prompt and give an example prompt I can use. I want the explanation to be understandable for individuals with little experience specifically with AI or programming. When providing the variables, answer in bullet point format, with a label followed by the definition of the label and a bit of expounding on how the labeled prompt variable affects the generated output.
The output should take someone from no understanding of prompt engineering to being able to follow a rough template.
- Assistant
Giving tips on metaprogramming myself through prompt engineering seems like an interesting exercise.
- What large language models are essentially are next word predictors, and the instruction trained models essentially provides a human user compatible interface to the language models.
- Ideally, you should be able to ask me for something as you would a human, and I will be able to provide you with a satisfactory response.
- Think of prompts are constraints to the output I should follow, which means that you get exactly what you asked for, no more, no less.
- So, the longer and more specific your prompt is, the less variable my output will be, which can be both a good (fulfilling specific requests) or bad (less creativity, writing that feel like copypasting the prompt) thing.
- In writing a good prompt, the key point is knowing exactly what you wanted me to output.
- For example, let's take the prompt "Write a story about a chicken in the style of Stephen King with dialogue."
- "Write a story" is the basic instruction, if that was the only prompt given, then the story can be literally about anything.
- "About a chicken" will associate my output with the concept of a chicken within my data, and the story will be nudged to add characteristics of the chicken (It's a bird, commonly used as food, raised on a farm, etc).
- "In the style of Stephen King" will associate the story with Stephen King's writing style based on the text I am trained on and associate his word choices and sentence structures with this story.
- "with dialogue" part will associate the story with scenes of characters talking to each other, which can lead to the story feeling less like a summary.
- As usual, trial and error are the best way to figure out the unique quirks of each model, so, just ask me something, and if you think my response can be more specific, add the additional instruction to the prompt and see how I respond.
- User
Can you simplify your explanation more, I seem to get lost in the text
- Assistant
The key points are:
-
Ask like a human.
-
Include the exact constraints, nothing less and nothing more.
-
If the response is not good, try to vary the question a bit.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →