An employee works on a computer at a desk in a home office.
Feature

What Is Prompt Engineering?

9 minute read
Sharon Fisher avatar
By
SAVED
Examine the field of prompt engineering in the AI market.

You might have heard the expression “garbage in, garbage out.” To get the best results out of artificial intelligence, it’s important to make sure that what you’re feeding it isn’t garbage. That’s where prompt engineering comes in.

While it seems like we just started hearing about prompt engineering recently, the term has been used in the AI community for several years. Prompt engineering is the practice of crafting precise and effective inputs (prompts) to optimize AI model outputs. It involves structuring prompts in a strategic way to guide AI toward accurate, relevant and high-quality outputs. 

Why Is Prompt Engineering Important?

Prompt engineering is important because people and AI systems aren’t necessarily good at communicating with each other. Without prompt engineering, people may get frustrated by getting the wrong response from an AI system.

As Georgetown University puts it: "Good prompts help the AI help you." The right prompt will allow AI tools to give you useful results. A bad prompt, on the other hand, may lead to inaccurate or irrelevant responses. 

Good prompts are also economical. Many AI tools charge per task, while others charge based on the size out the input and subsequent output. Crafting the right prompt means that you can get the desired response without the need for many (or any) follow-up inputs, ultimately saving time and money. 

In addition, carefully designed prompts help avoid two of AI’s biggest difficulties: bias and hallucinations.

  • AI BiasBias within AI can happen for a number of reasons, with one of the most common being biased or "bad" training data. When this data is fed to AI, the tools themselves can respond with biased outputs. Researchers suggest prompt modifiers (descriptive words like "some" or "most" or "thoroughly") and prompt sequencing (using a series of related prompts instead of attempting to get accurate outputs from one prompt) can sometimes mitigate AI bias. 
  • Hallucinations: AI can lie confidently (and provide fake citations) when it does not have access to the information you're looking for. Because of this, it's crucial to have a thorough understanding of what you're asking for, phrase prompts carefully and fact check the results. To limit hallucinations, you can guide the tool toward a specific source for information, use chain-of-verficiation prompting (asking the tool to critique its own outputs) and use step-back prompting (asking a broad, high-level question before diving into specifics). 

Ultimately, because AI systems continue to learn, effective prompt engineering has the effect of improving the AI system over time. Using your feedback, it can "remember" what it did right when providing outputs and what it did wrong, theoretically keeping it from making the same missteps. 

How Does Prompt Engineering Work?

It’s important to remember that prompt engineering is an iterative process, content marketer Rohit Auddy explained in a blog post. 

 

, according to Rohit Auddy, content marketing manager at Neuralgo.ai, a generative AI consulting firm. He describes four key steps in prompt engineering in a post at goML:

Crafting the prompt: “This is not just about asking a question or making a request; it’s about framing that input in a way that the AI system can understand and respond to effectively,” Auddy says.

Interaction with the AI model: The AI model parses the prompt.

Response generation: The AI model generates a response based on the prompt and other context.

Iterative refinement: The prompt engineer refines the prompt by providing corrections, context, and additional information.

Crafting the prompt can involve a number of different techniques, depending on the type of information that’s available and the sort of analysis that’s being requested, writes workflow automation software developer Zapier. These include:

Few-shot prompting: The prompt engineer starts out by giving the AI system some examples. In addition to making it clearer what’s being requested, this method also tells the AI system how to format the replies.

Zero-shot prompting: In contrast, this method requests information by giving no examples.

Chain-of-thought prompting: This method is preferable when assigning the AI system to a task that has multiple steps. It can also be combined with zero-shot prompting simply by adding “Explain your reasoning,” or with few-shot prompting by giving examples of how to perform the steps.

Least-to-most prompting: Like chain-of-thought prompting, this method is useful for analysis with multiple steps, particularly when the answer to one step is used in calculating the next step.

Self-consistency prompting: This is another variation on chain-of-thought prompting, which involves retrieving information in multiple steps and also gives the AI system multiple examples of how to format the results, which lets the prompt engineer check the various steps.

When Is Prompt Engineering Done?

Going to a generative AI app, such as ChatGPT, and starting to type can work for consumers and one-off projects, but that’s not enough for businesses, Christopher Penn, co-founder and chief data analyst at Trust Insights, said on a recent podcast episode

“When you’re talking about enterprises, when you’re talking about deployments — we’re talking about scaling AI. Prompt engineering 100% matters, getting it right, because you don’t get revisions in an individual conversation. And if you’re going to be having a million conversations an hour with the world from your website, you want it to be right.”

Penn and Trust Insights CEO Katie Robbert recommended various prompt engineering steps, including: 

  • Defining the AI’s role
  • Priming the AI by asking what it knows about the topic
  • Creating an action
  • Providing context
  • Asking the model whether it has questions
  • Refreshing the model by asking what other information it needs
  • Executing the prompt

Asking the model to evaluate whether it completely fulfilled the conditions of the prompt

And while people typically think of a prompt engineer as someone typing questions into an AI system, prompt engineering is done within software as well, AWS notes.  In this case, prompt engineers design prompts that anticipate user queries and preferences, guiding the AI system to generate relevant, coherent, and contextually appropriate responses.

“For example, consider AI chatbots,” AWS writes. “A user may enter an incomplete problem statement like, ‘Where to purchase a shirt.’ Internally, the application's code uses an engineered prompt that says, ‘You are a sales assistant for a clothing company. A user, based in Alabama, United States, is asking you where to purchase a shirt. Respond with the three nearest store locations that currently stock a shirt.’ The chatbot then generates more relevant and accurate information.”

Finally, it’s important to remember that prompt engineering typically isn’t a one-and-done event, but is an iterative process of refining the prompts to improve the results, according to AWS. “It's essential to experiment with different ideas and test the AI prompts to see the results,” the company writes. “You may need multiple tries to optimize for accuracy and relevance. Continuous testing and iteration reduce the prompt size and help the model generate better output. There are no fixed rules for how the AI outputs information, so flexibility and adaptability are essential.”

Where is Prompt Engineering Done?

An increasing number of industries and fields are taking advantage of prompt engineering. For example, the digital workflow company ServiceNow created a suite of AI tools called Now Assist. These include Now Assist for Code, which uses prompt engineering to generate code to help its clients write scripts more quickly.

Other examples of companies using prompt engineering in GenAI applications are detailed in an article by the consulting firm McKinsey & Company:

Morgan Stanley rolled out a GenAI tool internally to help its financial advisers “better apply insights” from the firm’s over 100,000 research reports

The government of Iceland partnered with OpenAI to work on “preserving the Icelandic language”

Salesforce integrated GenAI into its customer relationship management (CRM) platform.

McKinsey also has its own AI offering, Lilli, which it says is intended to provide search and synthesis of “vast stores of knowledge” to McKinsey clients.

Other ways that specific industries could take advantage of prompt engineering include the following, according to Alex York, in a blog post for project management software company ClickUp:

Education. Creating lesson plans, generating content, and providing tutoring and other support

Research and development. Reviewing literature, data mining, generating hypotheses, and simulating experiments

Learning Opportunities

Healthcare. Assisting in diagnostics, recommending treatment plans, and discovering potential drugs

More generally, prompt engineering use cases include software development and debugging; cybersecurity; healthcare diagnostics and treatment; customer support via chatbots; enhancing creativity; subject matter expertise; critical thinking and decision support; data analysis and interpretation; and developing and refining software engineering processes, according to ServiceNow.

Regardless of the industry, prompt engineering generally falls into one of several tasks, according to a blog post written by Akash Takyar, CEO of LeewayHertz , an AI consulting and development company. These can be broken down into:

Text summarization

Information extraction

Question answering

Text classification (such as sentiment analysis, which tests whether a given social media post is considered positive or negative)

Conversation

Code generation

Reasoning

How Can You Become a Prompt Engineer?

Job requirements vary in the prompt engineering field. For example, Geographic Solutions’ requirements for an AI prompt engineer I are “relevant training and/or certifications in computer science, AI or a related field” as well as a number of general programming requirements.

More stringently, KPMG’s requirements for an associate director, generative AI prompt engineer are eight years of experience and a bachelor’s degree in computer science, linguistics, cognitive science, or a related field, as well as “proven experience” in prompt engineering.

On the other hand, DMS International’s requirements for a prompt engineer are a bachelor’s degree in computer science, engineering, linguistics, or a related field.

Specifically, Intuit recommends that people looking to become prompt engineers learn Python, Java, R, and C++, as well as AI basics such as Large Language Models (LLMs), machine learning, deep learning, and natural language processing. “While you won’t normally be responsible for creating these things as a prompt engineer, understanding them will undoubtedly be part of your job,” the company writes. “Wrapping your head around the technology behind them is a great way to strengthen your career prospects.”

Michael Taylor, author of Prompt Engineering for Generative AI, agrees that prompt engineers who know how to code have a leg up on those who don’t. “While you can learn and apply prompt engineering principles without knowing how to code, your impact will forever be constrained if you’re relegated to copy and pasting prompts all the time instead of writing scripts to automate hundreds of API calls,” he writes in a blog post. “You’ll also miss out on trying all the latest tools in their raw form, when they’re only available via the API or in some obscure, poorly documented package on GitHub. I was using Stable Diffusion in Google Colab for months before a no code interface was even available, and that gave me an edge over anyone who couldn’t code. Being able to code also helps you program systems that supplement AI systems, like vector databases, allowing the AI to search for up to data information and decrease hallucinations (making things up). Smaller, dumber AI models using Retrieval-Augments Generation (RAG), where it can do a search first before answering, beat larger, smarter models that don’t get to search for context.”

Intuit also advises that people interested in becoming prompt engineers start a portfolio. “Keep a running collection of the prompts you create and problems you solve for various clients,” the company writes. “Assemble them all on an IT portfolio site like GitHub or Behance, so you have one clear, consolidated link to submit to future employers as your career progresses.”

Prompt engineering requires soft skills as well, Zapier notes. These include communication, subject matter expertise in fields such as healthcare and legal, language, critical thinking to be able to check results, and creativity.

Prompt Engineering Salaries

The average annual pay for prompt engineering in the U.S. is $62,977 a year, according to ZipRecruiter.com.

 

However, Glassdoor notes the salary range for a prompt engineer is $220,000 - $340,000 per year total pay, with a median of $271,000 per year. That includes a base pay range of from $151,000 - $211,000, with additional pay ranging from $69,000 - $129,000. “Additional pay could include cash bonus, commission, tips, and profit sharing,” Glassdoor says.

According to Glassdoor, here are some sample job titles and their salary ranges.

Company

Title

Salary range (per hour unless noted)

Median salary (per hour unless noted)

DataAnnotation

AI Prompt Engineer

$47-$68

$57

Outlier AI

AI Prompt Engineer

$55-$84

$67

Remotasks

AI Prompt Engineer

$60-$88

$72

Soul AI

AI Prompt Engineer

$58-$88

$71

Meta

AI Prompt Engineer

$245,000-$363,000 (per year)

$294,000 (per year)

SelfEmployed.com

AI Prompt Engineer

$110,000-$145,000 (per year)

$126,000 (per year)

Scale

AI Prompt Engineer

$63-$99

$79

Google

AI Prompt Engineer

$216,000-$315,000 (per year)

$257,000 (per year)

TEKsystems

AI Prompt Engineer

$57-$76

$66

Anthropic

AI Prompt Engineer

$92,000-$136,000 (per year)

$111,000 (per year)

ONNI

AI Prompt Engineer

$88,000-$132,000 (per year)

$108,000 (per year)

About the Author
Sharon Fisher

Sharon Fisher has written for magazines, newspapers and websites throughout the computer and business industry for more than 40 years and is also the author of "Riding the Internet Highway" as well as chapters in several other books. She holds a bachelor’s degree in computer science from Rensselaer Polytechnic Institute and a master’s degree in public administration from Boise State University. She has been a digital nomad since 2020 and lived in 18 countries so far. Connect with Sharon Fisher:

Main image: By Nicole Wolf.
Featured Research