Master ChatGPT — OpenAI Prompt Engineering Demystified
OpenAI dropped the Prompt Engineering guide a few days ago. Hopefully this helps the broader audience get more savvy, and gain insights into more effective ways to interact with OpenAI models for more accurate and desired outputs. Let’s dive straight into it.
1. Write clear instructions
OpenAI emphasized the importance of users being explicit about their requirements. If you desire brief responses, express that precisely. For more sophisticated answers, request expert-level writing. ChatGPT will write in the persona you specify too. Providing clear instructions helps systems like ChatGPT understand your requirements accurately.
2. Provide reference text
The creators of ChatGPT advocate that providing reference texts can reduce inaccuracies in generated outputs. OpenAI recommends directing the model to respond supplying reference text or include citations from a specified source to achieve this.
3. Split complex tasks into simpler subtasks
Divide and Conquer — an axiom in programming and is still and especially relevant in OpenAI prompt engineering. In this case, it means breaking down a complicated question or problem into smaller, more straightforward components. This approach can help improve the model’s understanding and response accuracy.
E.g. instead of asking a single complex question like “War and its impacts?”, you can split it into simpler subtasks:
A. Historical Conflicts — “Provide some background on wars and historical conflicts, describing the context and evolution of war”
B. Geopolitical Impacts — “Discuss the possible implications of War and Geopolitical Impacts”
C. Humanitarian Impacts “Do the same for War and Humanitarian Impacts” *
By approaching the question in this way, you provide the model with clearer directions, making it more likely to provide accurate and relevant information for each subtask.
* Note: The prompt for item 3C works and is related to the next point — the OpenAI model actually understands your history and context.
4. Give the model time to “think”
Much like humans, problem-solving by AI takes time too. In short, be patient with it and let it work through a complex task; otherwise models may face reasoning errors when rushed for immediate answers. In OpenAI prompt engineering, tactics like instructing the model to work out its solution step by step, using inner monologue to hide reasoning, and asking the model if it missed anything aim to improve reasoning and provide more reliable responses. These strategies emphasize a thoughtful approach over immediate conclusions.
5. Use external tools
The effectiveness of models such as ChatGPT is much contingent on their underlying structures. OpenAI’s prompt guide notes that plugins or external tools can offset the model’s weaknesses. OpenAI also recommends leveraging embeddings-based search for efficient knowledge retrieval and employing code execution for more precise calculations. Integrating external tools with these systems can enhance overall performance, augmenting its capabilities — much like how we are using ChatGPT to augment ours!
6. Test changes systematically
OpenAI recommends that users assess the models they employ to determine if the system produces the desired results. The creators of ChatGPT propose that users consider conducting evaluations, such as presenting various scenarios or questions to the model, to verify its satisfactory performance.
Do’s and Don’ts Guide
In addition, here are some tips to your OpenAI usage journey:
Dos
1. Be specific.
Provide clear details about what you’re looking for. Specify the context, desired tone, or format.
Good: “Write a creative story about a futuristic city where robots coexist with humans.”
Bad: “Write something futuristic.”
2. Ask Open-Ended Questions.
Encourage detailed responses by avoiding yes/no questions.
Good: “Explain the impact of artificial intelligence on society, considering both positive and negative aspects.”
Bad: “Is ChatGPT good or bad?”
3. Use Descriptive Language.
Create a clear and detailed depiction of what you require.
Good: “Provide a detailed overview of the prominent patterns and fluctuations observed in the sales figures throughout the preceding year.”
Bad: “Sales data trends”
4. Specify Length of Expected Content.
Clearly mention if you want a short paragraph, an essay, or any other specific length. This is particularly useful and affects the generated output.
Good: “Compose a concise poem (10–12 lines) about the beauty of roses.”
Bad: “Write a poem about roses.”
Don’ts:
1. Avoid Ambiguity.
Ambiguity is the enemy of ChatGPT. Ensure your prompt has a clear focus to prevent misinterpretation.
Good: “Describe the process of rainfall in simple terms.”
Bad: “Explain rain.”
2. Steer Clear of Compound Requests.
Keep it focused on one idea to maintain clarity.
Good:
A. “Analyze customer satisfaction survey data to identify key trends.”
B. “Based on the analysis, provide recommendations for improving service quality.”
Bad: “Analyze customer satisfaction survey data and provide recommendations for improving service quality
3. Minimize Jargon.
Use simple language to avoid confusion as much as possible and being unnecessarily convoluted.
Good: “Study the data thoroughly and find important insights.”
Bad: “Conduct an exhaustive and all-encompassing analysis of the multifaceted facets inherent in the data, examining its intricacies and elucidating comprehensive insights.”
4. Don’t Assume Prior Knowledge.
Make sure your prompts are accessible to a broad audience.
Good: “Examine the relationships between variables in the dataset. Identify any patterns or trends that may help in understanding how changes in one variable relate to changes in another.
Bad: “Analyze the regression coefficients in the dataset.”
To sum it all up
Adhering to these outlined principles will contribute to the creation of responses that closely align with your anticipated outcomes. By following these guidelines, you can enhance the likelihood of obtaining replies that better meet your expectations and requirements. Now go try it out 😉
References:
https://platform.openai.com/docs/guides/prompt-engineering
https://community.openai.com/t/openais-dec-17th-2023-prompt-engineering-guide/562526/1
https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-openai-api
