avada.ai
Home > ChatGPT > Prompt Engineering With ChatGPT: A Beginner Guide

Prompt Engineering With ChatGPT: A Beginner Guide

Olivia
June 05, 2024
9 min read

ChatGPT is an amazing tool for many things, but even though it’s popular, some people still find it tricky to give ChatGPT the right instructions to get the best results.

The good news is, you don’t need to write code to interact with ChatGPT effectively. In this guide, we’ll dive into the basics of prompt engineering. You’ll learn how to craft the perfect questions and instructions to get exactly what you need from this powerful language model.

What Is ChatGPT Prompt Engineering?

An Overview Of ChatGPT Prompt Engineering

ChatGPT prompt engineering is a technique used to optimize the interaction with ChatGPT to achieve more accurate, relevant, and useful outputs. It involves understanding how the model works and adjusting the input to guide the chatbot’s responses.

For example, you want about the benefits of regular exercise and use ChatGPT-4 to generate information about it. You might start with “Tell me about exercise.”

While ChatGPT can still generate a response to this prompt. But it’s a bit too vague and doesn’t give enough direction. It might be tough for ChatGPT to give a good response without more specific information.

Let’s try a clearer prompt and see what happens.

Explain the physical and mental health benefits of regular cardiovascular exercise, focusing on how it contributes to overall well-being.

This prompt is specific and guides ChatGPT in providing detailed information on a particular aspect of the exercise. It helps generate a more focused and relevant response.

Overview Of ChatGPT Prompt Engineering

Strategies For Effective Prompt Engineering

Clear Instruction

  • Ensure instructions are clear, specific, and easy to understand.
  • Repeat important requests and custom instructions to reinforce understanding.
  • Use affirmative language in prompts, avoiding negations.
  • Employ markup language to clearly separate different requests in the prompt.
  • Provide sequential, step-by-step instructions for complex tasks.
  • Specify the desired output format, including tone, writing style, and length.

Leverage Role-playing

By giving ChatGPT a specific role, like “Imagine you are a football player” or “Act as a famous football player,” you guide how it responds. You can even create your own custom GPTs for specific roles and use them for more focused results.

Provide examples

Examples help set a clear expectation for the format, style, and content of the response, making it easier for the model to understand and meet your requirements. You can even include several examples covering different perspectives to really guide the AI.

Chain-of-Thought

Instead of giving the AI one big, complicated task, break it down into smaller, easier-to-understand steps. This way, you make ChatGPT think step-by-step and explain its thought process along the way. This is especially useful for tasks that involve math, logic, or reasoning.

Experiment and Iterate:

  • Try various phrasing, keywords, and structures for the most effective prompt.
  • Analyze the AI’s responses and refine the prompt accordingly.
  • Observe how the AI responds to different prompts and adapt your approach.

Applying ChatGPT Prompt Engineering In Real-life Scenarios

Example 1: You’re searching for an outdoor activity

Give me something to do outdoors that’s not boring and not too hard. But it shouldn’t take all day.

Could you suggest a list of engaging outdoor activities suitable for beginners, each with an estimated duration of 2-3 hours? Please include a brief description of each activity, highlighting any special equipment or preparation needed. The tone should be upbeat and motivating, designed to inspire participation.

This request clearly outlines the response criteria and provides detailed guidance on what is needed. It sets clear expectations, resulting in a more useful and engaging answer.

Example 2: You work in a restaurant and need to broaden your customer care skills.

What is the solution if the customer receives the wrong order?

You are a server at a popular restaurant known for its excellent customer service. A diner at one of your tables flags you down, expressing disappointment that they received the wrong order. They ordered vegetarian pasta but were served a meat dish instead. The diner seems frustrated and hungry. Define the interaction, demonstrating active listening, empathy, quick problem-solving, and professionalism in resolving the situation to ensure customer satisfaction.

The second prompt provides specific details, including the role and context, with clear expectations for demonstrating active listening, empathy, problem-solving, and professionalism. ChatGPT will give a more detailed answer to the case you are dealing with.

Example 3: You’re a social media content creator who is looking for an ideal post for promoting the reuse of water bottles.

Create a social media post promoting our new eco-friendly reusable water bottles.

Create a social media post promoting our new line of eco-friendly reusable water bottles. The post should highlight the environmental benefits of using reusable bottles. Incorporate a visually appealing image of the water bottle in use, along with a catchy caption. Here's an example of the type of post we're looking for: 'Join the movement towards sustainability! Say goodbye to single-use plastic with our stylish and eco-friendly reusable water bottles. Together, we can make a difference for our planet. #ReduceReuseRecycle #SustainableLiving


The second prompt gives detailed guidance on what the social media post should include. It sets clear criteria for the content, tone, and visual elements and provides an example to show the desired outcome. This leads to more targeted and effective results from ChatGPT.

Example 4: You’re solving a math problem

How much wood could a woodchuck chuck if a woodchuck could chuck 2 logs of wood every day for a month?

If a woodchuck could chuck 2 logs of wood every day, and we assume a month has 30 days, how many logs of wood could 4 woodchucks chuck in a month? First, calculate the daily wood chucking, then multiply by the number of days in a month.

The second prompt is better because it gives the AI specific details about the problem and walks it through the steps to find the answer. While this specific example might be simpler, this approach is even more helpful for more complex problems involving multiple steps.

Troubleshooting ChatGPT Prompts

Even with well-crafted prompts, sometimes ChatGPT doesn’t respond as expected, which can be frustrating.

Here are some useful ways to troubleshoot your ChatGPT prompts and get you back on track:

Check the Basics:

Before diving into complex troubleshooting, start with the basics. Double-check your spelling and grammar to avoid confusing the model. Also, confirm that you’re using a language that ChatGPT supports.

Experiment with phrasing

Adjust the wording of the prompt to see if subtle changes in phrasing lead to better results.

Example: Instead of “Summarize the article,” try

Provide a concise summary of the article's main points.

Iterative refinement

Gradually refine the prompt by making small adjustments based on the model’s previous responses.

Context expansion

Provide additional context or background information in the prompt to enhance the model’s understanding.

Example: Instead of “Explain the concept of climate change,” add context with

As if explaining to someone unfamiliar with environmental science, explain the concept of climate change.

Clarify ambiguous requests

If the prompt contains ambiguous requests, provide explicit clarification to guide ChatGPT.

Example: Instead of “Tell me about artificial intelligence,” specify

List three key components of artificial intelligence.

Experiment with Parameters

ChatGPT’s behavior can be influenced by parameters like “temperature” and “max tokens.” Temperature controls the randomness of the output, with lower values producing more focused responses and higher values leading to more creative ones. Adjust this parameter to see if it improves the relevance of the output.

Additionally, the “max tokens” parameter limits the length of the response. If the responses are too short, try increasing this limit to get more detailed answers.

Seek Help

If you’ve tried all the previous steps and still face issues, don’t hesitate to seek help. You can turn to community forums where other ChatGPT users share their experiences and solutions. If nothing else works, reach out to OpenAI’s support team directly for personalized assistance.

Bottom Line

Now that you’ve learned basically how to craft effective prompts with ChatGPT, put these tips into practice to get the answers you want. Remember to keep it simple and improve your prompts (provide information, make clearer instructions one at a time, etc.) for better results!

FAQs

What tools or resources can help with prompt engineering?

Do I need any technical background to learn prompt engineering?

What are some advanced prompt engineering techniques?

Olivia
AI Expert at Avada.ai
Olivia brings her AI research knowledge and background in machine learning/natural language processing to her role at Avada AI. Merging professional expertise in computer science with her passion for AI's impact on technology and human development, she crafts content that engages and educates, driven by a vision of the future shaped by AI technology.
Suggested Articles