DEV Community

Taskade
Taskade

Posted on • Originally published at taskade.com

AI Prompt Engineering: Shaping the Future of Human-Machine Interaction

"To prompt or not to prompt, that is the question." If Shakespeare lived today, he would have more success in using AI tools like ChatGPT than a software engineer. After all, interacting with powerful AI, a.k.a. prompt engineering, is more of a verbal soliloquy than a coding symphony.

Chances are that by now you've tried a dozen popular AI tools. Maybe you've coaxed ChatGPT to generate witty haikus or used DALL-E to craft an 8-bit image of a Shiba Inu. If that's the case, you're already on your way to becoming a prompt engineer. Well, kind of.

In today's article, you'll learn what prompt engineering means, why it's one of the hottest skills of 2023, and how to design effective prompts for your personal and professional projects.

Table of Contents

👨‍💻 What Is Prompt Engineering?

In a nutshell, prompt engineering or prompt design is the art and science of crafting queries or instructions to elicit a specific response from an AI model. Prompts can be as simple as:

compose a lullaby about the moon
Enter fullscreen mode Exit fullscreen mode

or as elaborate as:

Generate a blueprint for a city of the future. But not just any city, make it a jaw-dropping, awe-inspiring, double-taking, "is that a flying car?"-exclaiming city that looks like it time-traveled from the year 3000, but took a pit stop in the 1800s.
Enter fullscreen mode Exit fullscreen mode

(ok, this isn't exactly a good prompt, but you get the idea)

While prompt engineering plays a key role in human-AI communication, it has very little to do with actual engineering. Think of it as a linguistic rather than a technical exercise.

Prompt design requires a blend of solid communication skills, a deep understanding of the capabilities and limitations of AI models, and a good grasp of syntax and semantics. It also requires the ability to clearly formulate and partition the problems AI is meant to solve.

But before we learn how to write prompts, let's take a close look at how it all works.

⚙️ Deep Dive into AI Prompt Engineering

First things first, what exactly is an AI model?

AI models are computational algorithms that help artificial intelligence perform complex tasks or make predictions. They do that by learning patterns from vast amounts of training data which allows them to process, analyze, and generate information, simulating human intelligence.

A robot typing away on a computer amidst the serene peaks of a mountain range. Digital art by DALL-E 2.

A robot typing away on a computer amidst the serene peaks of a mountain range. Digital art by DALL-E 2

But "feeding" large language models (LLMs) --- a type of an AI model trained on a wide range of text sources, such as books or websites --- Whitman's body of work is one thing. Convincing them to write a poem imitating "Song of Myself," well... that's a different kind of challenge.

This is where natural language processing (NLP) comes into play.

NLP is a subfield of artificial intelligence that focuses on the interaction between humans and computers. It's also a set of technologies that allow AI to understand the nuances of language.

Thanks to NLP, AI models can understand your silly prompts and turn them into new content. Even if you're not a programmer, you can still communicate with powerful AIs writing this:

"write me a short story about a space-traveling cat who is a renowned sushi chef"
Enter fullscreen mode Exit fullscreen mode

instead of this:

import AI

settings = {
    "length": "short",
    "genre": "sci-fi",
    "main_character": "cat",
    "occupation": "sushi chef",
    "setting": "space"
}

AI.create_story(settings)
Enter fullscreen mode Exit fullscreen mode

(in case you're wondering, this is Python code)

NLP is a multi-step process that involves tasks like tokenization, part-of-speech tagging (POS) ,or named entity recognition (NER), just to name a few. The good news is, you don't need to know or understand any of those concepts since the magic of NLP happens behind the scenes.

(but if you still want to learn more, check our guide on what is NLP when you're done reading)

🪚 Principles of Effective Prompt Engineering

"So, how do I write effective prompts?" Well, mostly by experimenting. 

In many ways, writing prompts is a process of trial and error, a creative exploration with a dash of serendipity. Keep in mind that every AI model is unique and requires a slightly different approach, which means you'll fail a lot before you start getting good results.

But don't worry. There are a few universal rules you can follow to get up to speed.

Be Clear and Specific

While AI models are excellent at untangling the nuances of natural language, they can't read your mind (yet). You need to clearly state what results you expect, whether that's writing a paragraph on climate change or... generating an image of a cat sitting in a gazebo.

Like this one. 👇

cat in a gazebo

A cat sitting in a gazebo looking at the setting sun. Digital art by DALL-E 2

Rule no.1? Try to avoid ambiguity and prompts that could be interpreted in multiple ways. For instance, if you're interested in learning about the cultural history of Japan, a prompt like:

"tell me about Japan"
Enter fullscreen mode Exit fullscreen mode

might give you a broad range of information, from geographical facts to current news. But you need specifics. Instead, a more effective prompt would be:

"provide an overview of Japan's cultural history"
Enter fullscreen mode Exit fullscreen mode

If possible, try to limit the scope of your prompts down to specific categories or context. Instead of a vague "tell me about art" try "describe the main characteristics of Renaissance art."

Finally, use direct, command-based language ("write," "generate," "create"). AI won't sulk in the corner or file a complaint if you're too direct and skip the sugar-coating. Cutting the fluff is a great way to reduce the odds of the AI "hallucinating" (read: making stuff up).

Here are a few more examples:

Specific and Precise Prompts Vague or Broad Prompts
"describe the process of photosynthesis in plants, including the key steps involved, the role of chlorophyll, and how it relates to the production of glucose and oxygen" "explain photosynthesis in plants"
"explain the main causes and consequences of the Industrial Revolution in Europe, considering factors such as technological advancements, social changes, and economic impacts" "discuss the Industrial Revolution in Europe"
"provide step-by-step instructions for baking a chocolate chip cookie, including the ingredients, measurements, mixing techniques, baking temperature, and recommended baking time" "give me a recipe for chocolate chip cookies"
"compare and contrast the major theories of human evolution, such as Darwin's theory of natural selection, Lamarckism, and the multiregional hypothesis, highlighting their key differences and supporting evidence" "discuss theories of human evolution"

Define the Desired Format and Style

Depending on the AI model you choose, it's likely that many of the responses will follow a similar pattern. This is because the model's settings and training data influence its output.

If you want the AI output to follow a specific style or format, specify that in the prompt, e.g.

"generate an outline highlighting the key sections and subtopics for a research paper. Include sections like introduction, methodology, findings, and conclusion, and provide subtopics within each section that can be further developed"
Enter fullscreen mode Exit fullscreen mode

This rule is even more relevant when working with text-to-image diffusion models like DALL-E or Midjourney. Your prompts can control everything from a color palette and lens type to lighting effects and even the perspective or camera angle of generated images.

Detailed prompts also come in handy when you want to tailor your content to a specific audience. You can ask an AI model to write in a specific tone or even sneak a few insider jokes.

"write a weather report using a dramatic and poetic tone inspired by the works of William Shakespeare. Infuse the report with rich language, metaphor, and a touch of humor"
Enter fullscreen mode Exit fullscreen mode

See what we meant about experimentation? Here are a few more ideas:

Define the Desired Format and Style Without Defined Format and Style
"Write a sonnet about the beauty of a sunset, making sure to follow the Shakespearean rhyme scheme." "Write a poem about a sunset."
"Draft a professional email to a client expressing appreciation for their recent order, while ensuring to include salutations, thank you note, and mention of future business." "Write an email to a client about their recent order."
"Compose a blog post about the importance of healthy eating, incorporating headings, subheadings, bullet points, and pictures." "Write about the importance of healthy eating."
"Create an argumentative essay that supports renewable energy use, utilizing a clear thesis, evidence-based arguments, counterarguments, and a conclusion." "Write an essay about renewable energy."

Include Examples

AI models are trained on large, diverse datasets. That gives conversational AI like ChatGPT an impressive creative power. But it also makes the generated output a bit of a lottery.

If you want the content to follow a specific format, you can provide your own examples like snippets of code, unfinished sentences, or even source images as guidance. 

For structured data tasks, that could be table labels or CSV fields:

"generate CSV data about different cities. The data should include City Name', 'Country', 'Population', and 'Average Temperature in July'. An example line might look like: New York, USA, 8398748, 28.1"
Enter fullscreen mode Exit fullscreen mode

If you want the AI to mimic your writing style, provide a few samples. The more source material you use to "train" the model, the more likely it is that the response will be spot on.

Text-to-image generative AI even allows you to upload your own images and edit them using techniques like inpainting (filling in missing or incomplete parts of an image), outpainting (extending the generated image ), or panning (extending images in a specific direction).

[compare two or three images + include prompts]

Master the Art of Follow-Ups

You've probably seen stunning digital art or read a few unsettlingly good AI-generated stories online. In most cases, the impressive outputs were a result of dozens of follow-up prompts.

An AI-generated, black and white portrait of two women.

An AI-generated image that sneaked into and won the Creative category of the prestigious Sony World Photography Award. Image credit: Boris Eldagsen

It's not that AI doesn't have a knack for churning out impressive intellectual value. Quite the contrary, it often does so much better than most of us mere mortals can. But you should keep in mind that raw AI output from initial prompts will usually need some refining.

This can work on multiple levels.

Let's say you want to generate a piece of prose about a fictional medieval kingdom. 🏰

Your first prompt could be as general as:

"describe a medieval kingdom in under 100 words"
Enter fullscreen mode Exit fullscreen mode

[

A description of a medieval kingdom written by ChatGPT.

This is pretty good. Let's try to add some details and write a follow-up prompt:

"describe the bustling market square in the heart of the kingdom"
Enter fullscreen mode Exit fullscreen mode

A description of a medieval market square written by ChatGPT.

Much better. You can almost smell the fresh bread and hear the chatter of the townsfolk. 

A step-by-step approach is more time-consuming than asking AI to generate a complete piece of content in one go. But it gives you more creative control and yields higher-quality results.

Experiment with these prompts next:

Initial Prompt Follow-Up Prompt
"analyze the sentiment of this text" "identify the key themes or topics that are prevalent in positive and negative comments"
"create an outline for a short story centered on a young astronaut's first voyage to Mars" "after the outline is complete, focus on developing the characters, their motivations, and their interactions with each other"
"summarize the provided scientific article" "identify and explain the key methods used in the research along with the main findings"
"translate from French to English" "provide the cultural context necessary for grasping the nuances of the translation"

⌨️🖱️ The Impact of AI Prompt Engineering on User Experience

The rise of generative AI opened a world of possibilities in all kinds of creative domains. With the growing access to AI tools, there's a historic opportunity for laypeople to tap into domains that traditionally required very specific skills, like graphic design, writing, or data science.

Can't tell the difference between cobalt and cerulean? You can still create stunning digital art.

Think a sonnet is a fancy bonnet? There's no reason you can't try your hand at writing haikus.

Heck, you can get into programming even if your C++ is a near-perfect grade in school.

Ok, let's get serious for a moment.

Whether we like it or not, artificial intelligence is rapidly reshaping our world and how we interact with it. Skills that used to be locked behind years of education or specialized training are becoming more accessible than ever. That's as long as you know how to prompt.

It used to be that building an app or developing a video game required a deep understanding of numerous programming technologies. Now, with the help of ChatGPT, you can write the code (or tell ChatGPT to do it for you) and debug it even if you're not a seasoned programmer.

Since basic prompting is so natural and effortless, it is quickly becoming another commonplace user experience element, right next to buttons, drop-down menus, and sliders. AI's integration with existing workflows and applications can dramatically increase productivity too.

In Taskade, you can use natural-language prompts to create project workflows, generate lists of tasks, and supercharge your writing, all seamlessly integrated with the good ol' keyboard & mouse interface. Just so you always have the power of AI at your fingertips (pun not intended).

ai task generator

Taskade's AI task generator automatically compiles lists of tasks and sub-tasks.

🚀 The Future of AI Prompt Engineering

So where do we go from here? Are prompt engineering skills the future? 

Compared to VR headsets, speech recognition, gesture-based controls, and more futuristic concepts like Elon Musk's Neuralink, text-based interfaces seem hopelessly outdated.

But written text is still a staple in human-machine interaction, and it will likely remain so in the foreseeable future. OpenAI's co-founder and CEO Sam Altman calls prompt engineering a "high-leverage" skill and the World Economic Forum predicts it may become a viable career in 2023.

We've seen a fair share of made-up careers. But given that 85% of future jobs haven't been invented, we can imagine prompt engineering playing a significant role in the coming years.

Some, though, are more skeptical. According to Oguz A. Acar, Chair in Marketing at King's Business School, the future lies elsewhere. NLP technology is advancing rapidly and AI models are getting better at deciphering the nuances of language, so prompting may become obsolete.

Acar believes that the future belongs to those who will be able to effectively formulate problems and selectively apply a range of AI-powered solutions to solve them.

Of course, there are still a few other avenues to explore. 

If there is one form of communication that feels more natural than writing, it is speaking. The progress in speech recognition and voice synthesis is already revolutionizing virtual assistants. The global market for those technologies is set to reach USD 48.1 billion by 2030.

Another exciting development in the AI space (as if AI wasn't exciting enough) is the rise of autonomous AI agents that can automate the process of interacting with large language models. We've covered agents in our article on autonomous task management, so be sure to check it out.

👋 Parting Words

Less than a year ago, artificial intelligence still seemed like a thing straight out of Asimov's or Gibson's novels. We're barely halfway through 2023, and prompt engineering has emerged as a critical skill that is becoming more important than the classic swipe & tap.

Will prompt design become a prospective career in the coming years? What's next in store for human-machine interactions?  How far are we from fully autonomous AI systems?

At this point, nobody really knows. So instead, we'll just leave you with a handful of key takeaways from this article and let you explore them yourself:

  • Prompt engineering refers to the practice of designing and crafting effective instructions to guide artificial intelligence (AI) models in generating desired outputs.
  • Prompt design has more in common with linguistics than programming.
  • Clear and specific prompts are crucial to communicate expectations effectively to AI.
  • Writing effective prompts is an iterative process that involves a lot of experimentation.
  • There are dozens of effective prompting techniques you can try yourself.
  • Content created by AI models usually requires follow-ups and refinement.
  • While text-based interfaces may seem less futuristic, conversational AI tools based on textual prompts remain prevalent and continue to evolve.
  • AI prompt design holds the potential for becoming a sought-after skill.

And that's it!

Want to tap into the power of generative AI and start writing effective prompts? Try Taskade AI 🐑, the most complete AI-powered productivity platform.

Frequently Asked Questions About AI Prompt Engineering

What is prompt engineering in AI?

Prompt engineering is a key concept in the field of artificial intelligence (AI). It involves crafting the right questions or commands that will elicit a specific, desired response from an AI system. This practice is critical when working with large language models such as OpenAI's GPT-3 and GPT-4 as well as text-to-image generators like Midjourney or DALL-E 2.

How to make a good AI prompt?

Crafting a good AI prompt is a mixture of art and science, dependent on clear communication and understanding of the AI model's capabilities. It involves creating an instructive and concise question or command that provides enough context for the AI to understand and respond effectively. The prompt should be direct, with a clear objective in mind, and, if necessary, should provide enough relevant background information. The best AI prompts are often iterative, where responses are evaluated and prompts are fine-tuned for the optimal outcome. 

What principles guide effective Prompt Engineering?

Effective prompt engineering is guided by several key principles. These include precision, clarity, and contextuality. Precision involves being specific in your prompts to avoid ambiguity. Clarity ensures the AI accurately comprehends the prompt, while contextuality allows the AI to understand the broader scope or relevance of the prompt. It's also crucial to embrace experimentation, as tweaking and refining prompts is part of the process.

Is prompt engineering hard?

Prompt engineering can indeed be challenging, particularly for those new to the field. The difficulty lies not only in understanding the intricacies of the AI model's behavior but also in crafting prompts that elicit the desired responses. It often involves a process of trial and error, combined with the understanding of how different prompts can trigger various AI behaviors.

Is prompt engineering a skill?

Yes, prompt engineering is an emerging skill, and a valuable one at that. It involves understanding the capabilities and limitations of an AI model, as well as the art of crafting prompts that provide clear instructions for the desired response. Much like programming or writing, it requires a blend of technical knowledge and creativity.

Does prompt engineering require coding?

Contrary to popular belief, prompt engineering does not necessarily require coding. It's more about understanding the AI model and grasping the nuances of natural language. However, coding skills can be beneficial in understanding AI behaviors better, creating more complex prompt structures, or if you're working on training an AI model from scratch.

Why is AI Prompt Engineering important?

Prompt engineering is key to efficient and effective interaction with AI systems. The better the prompts, the better the AI will perform, providing more relevant and useful responses. This can significantly impact various fields such as customer service, healthcare, education, and more, where AI systems are frequently used to provide assistance or information.

How will AI prompt engineering evolve in the future?

Prompt Engineering is likely to evolve in many exciting ways as AI systems become more advanced. This will potentially include the development of more sophisticated prompt crafting strategies, automated prompt generation, and voice-based AI systems that can better understand and respond to prompts even with limited context.

Top comments (0)