Have you been hearing a lot about "prompt engineering" lately? It seems like this new field is generating a lot of buzz in the tech world. But what exactly is it? And could it be the next big thing in the job market? In this blog post, we'll dive into the world of prompt engineering and explore its potential. So grab a cup of coffee and let's get started!
What is prompt engineering?
Prompt engineering is a concept in natural language processing (NLP) that involves discovering inputs that yield desirable or useful results[1]. It involves designing and crafting text to prompt a machine learning model[2] and can be used to generate useful output such as summaries of articles[3].
In simple words, prompt engineering is very similar to search keywords, you need to play around with keywords to get the desired results.
The anatomy of a prompt.
A good prompt for prompt engineering should contain the most basic elements of a complete sentence, including a noun, a verb, and an adjective[1]. Additionally, it is important to be able to communicate clearly when creating prompts[2]. the anatomy prompt could be just formulated as a question for simple tasks, but if the task is more complex, utilizing the following structure can help achieve the desired outcome.
Context: business computer science
Task: write, summarize, list, count…etc
Examples
Constraints: max words
Description of the desired output
Target audience: write something for a 10-years-old child/ a non-technical audience)
Role: act as someone or something. There are tons of examples in this GitHub repo
Writing style: if you don’t know what they are, just drop the following prompt in chatGPT "list all the writing styles in bullet points"
Tone: friendly, casual, narrative, formal …etc.
General: use analogy, be concise, use simple words, whatever you like.
These are the points to go through, in case you are not satisfied with the outcome, consider adjusting or modifying the previous points. Remember, effective communication with ChatGPT-3 or any language model is crucial for achieving desired results.
Prompt Types
Zero-shot: A prompt with no examples, e.g. The name of a character from Lord of the Rings is: or English: "Hello!", French: ""
Few-shot: A prompt with one (1-shot) or more (n-shot, few-shot) examples.
Advantages of prompt engineering
The advantages you can gain from prompt engineering vary depending on whether you are an individual or a company. Here are some potential benefits:
New job title: Prompt engineering could be a new job title, as the use of natural language processing and language models such as GPT-3 becomes more prevalent in industries such as conversational AI and chatbots.
Improved quality: We all have the same chatGPT, but we don’t have the same prompt skills.
Increased efficiency: Prompt engineering can help to streamline processes and reduce the amount of time and resources needed to complete tasks.
Reduced costs: Prompt engineering can help to reduce costs as it reduces the usage of the tokens if we manage to get the desired output with minimum tries.
Increased productivity: Prompt engineering can help to increase productivity by reducing the amount of time needed to complete tasks.
Improved customer experience: Prompt engineering can help to reduce customer wait times and improve the overall customer experience.
Examples of bad and good prompts
Example 1
Bad prompt: “Write an essay about the effects of global warming"
This prompt is bad because it is too broad and doesn't provide enough direction for the model. The model doesn't know what specific aspect of global warming to focus on or what the intended audience is.
Good prompt to fix it: "Write an argumentative essay for a high school audience about the effects of carbon emissions on sea level rise"
This prompt is better because it provides a specific direction for the model. It specifies the type of essay, the intended audience, and the particular topic of carbon emissions and sea level rise. The model will have a clear understanding of what to focus on and will generate output that is more relevant and accurate.
Example 2
Bad prompt: "Make a story about a person who wins the lottery"
This prompt is bad because it is too general and doesn't provide enough information for the model. The model doesn't know what genre of the story to create, what the person's personality is like, or what they do with the money they won.
Good prompt to fix it: "Write a fiction short story in the genre of thriller, about a financially struggling person who wins the lottery but soon discovers that the winnings come with dangerous consequences"
This prompt is better because it provides more information for the model. It specifies the genre of the story, the protagonist's financial situation, and the plot twists that come with winning the lottery. The model will have a clear understanding of the story's direction and will generate an output that is more engaging and relevant.
8 steps to craft prompts
Understand the task: Before creating a prompt, it's important to understand the task that GPT will perform. Are you trying to generate text, answer a question, or complete a specific task? Understanding the task will help you to create prompts that are specific, relevant, and aligned with the task.
Define the target audience: Consider who the output is intended for. Will it be for general audiences, or a specific group of people such as high school students, or professionals in a specific field? Knowing the target audience will help you to create prompts that are relevant and easy for the audience to understand.
Be specific: Be specific in your prompts, the more specific the prompt, the more relevant and accurate the output will be. For example, if you're trying to generate text, provide a specific topic or genre for GPT to focus on.
Provide context: Provide context for GPT by including relevant information in the prompt. This will help GPT to understand the context and generate a more accurate output.
Use appropriate length: Keep the prompts of appropriate length, not too short or too long. A short prompt can be too general and doesn't provide enough information for GPT, while a long prompt can be difficult for GPT to understand.
Use clear language: Use clear and concise language that is easy for GPT to understand. Avoid using complex language or jargon that GPT may not understand.
Test and evaluate: Test the prompts with GPT and evaluate the output. Use this feedback to make adjustments to the prompts and fine-tune them for better results.
Continuously improve: With more experience and feedback, you will be able to continuously improve the prompts and make them more effective.
By following these steps, you'll be able to create highly specific, actionable, and concrete prompts that will lead to more accurate and relevant output from ChatGPT. Remember, prompt engineering is an iterative process, so be prepared to test and refine your prompts as needed.
Finally, repetition leads to mastery. Practicing is essential as certain skills can only be developed through experience. By actively engaging and experimenting, you will improve and achieve the desired results.
I hope I you liked the blog, let me know what are the tricks you use to get most of chatGPT and for what do you use it.