Prompt engineering is the process of iterating a generative AI prompt to improve its accuracy and effectiveness. Learn all about prompt engineering and how it works.
Prompt engineering is a technical term for a straightforward action: It means prompting (or requesting) a generative AI tool to perform a task. Strong prompt engineering typically requires refining your prompts with context to get the most specific—and useful—result. Whether you’re prompting ChatGPT to help you write your resume or using DALL-E to generate a photo for a presentation, anybody can be a prompt engineer.
In this article, we'll discuss ways to prompt engineer. Want to get started right away? Consider enrolling in Vanderbilt University's Prompt Engineering Specialization. You'll learn how to tap into the emerging capabilities of large language models to automate tasks, increase productivity, and augment human intelligence.
Generative AI can create text, images, video, and more. Prompt engineering is the process of refining what you ask a generative AI tool to do. Anyone can do this using natural language in generators like ChatGPT or DALL-E. It's also a technique AI engineers use when refining large language models (LLMs) with specific or recommended prompts.
For example, if you're using ChatGPT to brainstorm a professional summary while refining your resume, you might begin by prompting it with a simple command like, “Write a sample professional summary for a marketing analyst.” Since that prompt is on the vague side, you might follow up with additional context or feedback: “that was too formal” or “shorten to less than 100 words.”
Prompt engineering is important for AI engineers to create better services, such as chatbots that can handle complex tasks like customer service or generate legal contracts. Making sure that generative AI services like ChatGPT are able to deliver outputs requires engineers to build code and train the AI on extensive and accurate data.
We’ve reached a point in our big data-driven world where training AI models can help deliver solutions much more efficiently without manually sorting through large amounts of data. Proper prompt engineering can also identify and mitigate prompt injection attacks (malicious attempts to hack the logic behind ChatGPT or chatbots) to ensure companies deliver consistent and accurate services.
Learn more about generative AI and its potential to help accelerate your projects with the Google AI Essentials course. You'll use generative AI tools to help develop ideas and content, make more informed decisions, and speed up daily work tasks.
Here are a few examples of prompt engineering to give you a better understanding of what it is and how you might engineer a prompt with a text and image model.
For text models like ChatGPT:
What’s the difference between a professional summary and an executive summary?
Write a professional summary for a marketing analyst looking for a marketing manager job.
Now trim it down to less than 60 words.
Rewrite it with a less formal tone.
For image models like DALL-E:
A painting of a cat.
A painting of a cat chasing a mouse in Impressionist style.
Now use only warm tones in the painting.
Here’s a quick step-by-step guide to engineering your prompts.
Because generative AI is a deep learning model trained on data produced by humans and machines, it doesn’t have the capability to sift through what you’re communicating to understand what you’re actually saying.
What you say is what you get.
When inputting a query into an AI generator, it’s best to query with specific, plain language and context. For example, instead of, “Write an outline that includes a title and next steps,” you could query, “Write an outline for an academic research proposal that includes sections for title, summary, and next steps.”
For each type of output, such as a brief outline, research proposal, or resume bullet points, you’ll want to experiment with the generative AI by using different variations of the same request. This way, you’ll determine whether you need to include guidance such as “in a formal tone of voice.” If you do need to include “tone” in your prompt, should you write “in a professional tone” or “in a formal tone”?
Play with your inputs, too. Consider inputting sample outlines in a prompt or providing examples you’d like the generator to model.
Once you’ve shaped your output into the right format and tone, you might want to limit the number of words or characters. Or, you might want to create two separate versions of the outline, one for internal purposes.
The generator can do this based on the output it provided earlier. Iteration is your friend. Continue to “engineer” the prompt until you achieve your desired results.
Generative AI is still a new (and developing) technology, but that doesn't mean researchers haven't already developed some strategies for designing effective prompts. As you play with generative AI, try using some of these prompting techniques to achieve the results you're looking for:
Zero-shot prompting: This is the most direct and simplest method of prompt engineering in which a generative AI is simply given direct instruction or asked a question without being provided additional information. This is best used for relatively simple tasks rather than complex ones.
Few-shot prompting: This method involves supplying the generative AI with some examples to help guide its output. This method is more suitable for complex tasks than zero-shot prompting.
Chain-of-thought (CoT) prompting: This method helps improve an LLM's output by breaking down complex reasoning into intermediate steps, which can help the model produce more accurate results.
Prompt chaining: The prompter splits a complex task into smaller (and easier) subtasks, then uses the generative AI's outputs to accomplish the overarching task. This method can improve reliability and consistency for some of the most complicated t
asks.
These are just some of the prompting techniques that you might play with as you continue to explore prompt engineering. Often, in fact, the most effective prompt strategy is to combine several different techniques to achieve the desired output.
Prompt engineering will continue to evolve in this era of AI and machine learning. Soon, there will be prompts that allow us to combine text, code, and images all in one. Engineers and researchers are also generating adaptive prompts that adjust according to the context. Of course, as AI ethics evolve, there will likely be prompts that ensure fairness and transparency.
As far as a career in prompt engineering goes, it has a promising future. There are currently over 3,788 prompt engineer jobs open on Indeed, and jobs can pay up to $335k, according to TIME [1, 2].
Prompt engineers need to be skilled in the fundamentals of natural language processing (NLP), including libraries and frameworks, Python programming language, generative AI models, and contribute to open-source projects.
Most commonly, prompt engineers need a bachelor’s degree in computer science or a related field. However, there are some prompt engineers who have a less technical background, such as in writing, and gained experience by studying and experimenting with AI.
Gain confidence with prompt engineering through the Vanderbilt Prompt Engineering Specialization. You’ll learn to master engineering patterns, techniques, and approaches to effectively leverage Generative AI.
Indeed. “Prompt engineer, https://www.indeed.com/q-prompt-engineer-jobs.html?vjk=97f8ac1d0bbcb5df.” Accessed February 21, 2024.
Time. “The AI Job That Pays Up to $335K – and You Don’t Need a Computer Engineering Background, https://time.com/6272103/ai-prompt-engineer-job/.” Accessed February 21, 2024.
Editorial Team
Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...
This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.