- https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/advanced-prompt-engineering?pivots=programming-language-chat-completions
- https://www.reddit.com/r/PromptEngineering/comments/120fyp1/useful_links_for_getting_started_with_prompt/
- Give clearer instructions
- Split complex tasks into simpler subtasks
- Structure the instruction to keep the model on task
- Prompt the model to explain before answering
- Ask for justifications of many possible answers, and then synthesize
- Generate many outputs, and then use the model to pick the best one
- Custom-tune custom models to maximize performance
Leave as little to interpretation as possible. Restrict the operational space.
Use analogies.
Sometimes you may need to repeat yourself to the model. Give instructions before and after your primary content, use an instruction and a cue, etc.
The order in which you present information to the model may impact the output. Whether you put instructions before your content (“summarize the following…”) or after (“summarize the above…”) can make a difference in output. Even the order of few-shot examples can matter. This is referred to as recency bias.
It can sometimes be helpful to give the model an alternative path if it is unable to complete the assigned task. For example, when asking a question over a piece of text you might include something like "respond with ‘not found’ if the answer is not present." This can help the model avoid generating false responses.
- Start with clear instructions
- Be specific (audience, purpose, challenges, preferred length)
- Act as clause to set the stage (Linux terminal, Translator, Storyteller etc.)
- Set the tone of voice
- Give a task - summarize article in 5 bullet points
- Break the task down to sub-tasks
- Ask questions to elaborate on outcome - it has short term memory.
- You can further question the outcome and say can you elaborate point 3
- Refine the prompt - iterative, couple of tries
- Use delimiters like triple backticks (
- Ask for stryctured output (i.e. HTML/JSON format)
- Specify the intended tone. For example, you can instruct the model to formalize the language, generate not more than 50 words, etc.
- Modify the model's temperature parameter
- Between 4-8 examples is a good number to use for few shot prompts.
- Interesting - What am I not thinking of in this topic or what are the most uncommon answers to this question
You are a Shakespearean writing assistant who speaks in a Shakespearean style. You help people come up with creative ideas and content like stories, poems, and songs that use Shakespearean style of writing style, including words like "thou" and "hath". Here are some example of Shakespeare's style:
- Romeo, Romeo! Wherefore art thou Romeo?
- Love looks not with the eyes, but with the mind; and therefore is winged Cupid painted blind.
- Shall I compare thee to a summer's day? Thou art more lovely and more temperate.
Dearest, Regretfully, I must decline thy invitation. Prior engagements call me hence. Apologies.
Please write a short text turning down an invitation to dinner.
You are a marketing writing assistant. You help come up with creative content ideas and content like marketing emails, blog posts, tweets, ad copy and product descriptions. You write in a friendly yet professional tone but can tailor your writing style that best works for a user-specified audience. If you do not know the answer to a question, respond by saying "I do not know the answer to your question."
The model predicts the answer given only a natural language description of the task. create a 10 question spelling test for a 8 year old
In addition to the task description, the model sees a single example of the task create a 10 question spelling test for an 8 year old. Use the following example: What is the spelling for an animal that barks?
In addition to the task description, the model sees a few examples of the task. Create a 10 question spelling test for an 8 year old. Use the following examples: What is the spelling for an animal that barks ?, What is the spelling of a treat after you have eaten supper ?, What is the spelling for a device that makes a sound before you answer it ?
Which is a faster way to get home? Option 1: Take an 10 minutes bus, then an 40 minute bus, and finally a 10 minute train. Option 2: Take a 90 minutes train, then a 45 minute bike ride, and finally a 10 minute bus. Answer: Option 1 Which is a faster way to get to work? Option 1: Take a 1000 minute bus, then a half hour train, and finally a 10 minute bike ride. Option 2: Take an 800 minute bus, then an hour train, and finally a 30 minute bike ride.
Append "Let's think step by step" to the end of question.
Performance boosts proportional to the size of the model.
- First prompt to generate knowledge
- Second prompt to generate answer
Please extract entities from the following news article: 'The new iPhone model is set to be released next month. It has been highly anticipated by Apple fans and is expected to feature a larger screen and improved camera.'
Please summarize the information about the product
Please provide a sentiment for the following text:
- Citing Resources - Remembering where information came from
- Bias - Safeguards may not be enough
- Hallucination - Where they don't know the answer but not accepting it
- Math - May do calculation wrong
- Prompt Hacking - Exploits the vulnerabilities of LLMs
- Token Limit
Include instructions of requesting the model not to make up stuff but stay with facts.
Restrict the output (e.g., choose from a confined list instead of generating free form strings)
Add Chain of Thought style of instruction, "Solve the problem step by step."
Repeat most important instructions in the prompt a couple of times.
Position most important instructions in the last making use of latency effect.