ChatGPT Prompt Engineering: Key Takeaways

ChatGPT Prompt Engineering: Key Takeaways

Level up your prompt engineering skills with ChatGPT

ChatGPT Prompt Engineering: Key Takeaways header

Just a couple of weeks ago (or months?), DeepLearning. AI released a brand new course called “ChatGPT Prompt Engineering for Developers”. Being a huge fan of ChatGPT (I even used ChatGPT to assist me in writing this article!), I just had to try it out! The course teaches you how to effectively use ChatGPT for a variety of tasks (which I’ll share with you shortly). But I’m not here to give you a typical course review — I want to share my key takeaways and show you how I have applied what I’ve learned.

So without further ado, here’s what you can expect from this article:

  1. Principles for effectively using ChatGPT

  2. The impressive capabilities of ChatGPT

  3. A LOT of ChatGPT prompts

Let’s dive in!


Principles for effectively using ChatGPT

Principle 1: Write clear and specific instructions

I got two points here: 1) clear input == clear output. By having clear and specific inputs/instructions, ChatGPT will be less confused and will provide a more accurate response. 2) shorter input != clear output. Brief instructions are sometimes not clear. Longer prompts that contains specific details and instructions will always provide better outputs than short but vague ones.

In addition to these points, the course provided four tactics on how to write clear and specific instructions. Let’s go!

Tactic 1: Use delimiters

Delimiters provide a better way to help ChatGPT focus on specific text in a prompt. Some delimiters that you can use, but not limited to (*wink*), are triple backticks (```), triple single quotes (’’’), and triple double quotes (”””). I always use double quotes btw. You can put your instructions inside those delimiters to make them stand out and easily identifiable by ChatGPT.

That’s it! While it may seem impractical to type longer prompts, using delimiters can be useful when you need to provide multiple instructions and want ChatGPT to focus on certain parts of your prompt.

Tactic 2: Ask for structured output

JSON, HTML, Markdown, these are some of the outputs that ChatGPT can generate.

These are just some examples tho. One practical application I can think of for this is providing a JSON file of product reviews where it contains the name of the reviewer and sentiments.

Tactic 3: Check whether conditions are satisfied

Provide conditional statements so that ChatGPT knows which steps to take.

Hmmm, that’s pretty much it. This can be applied to when reading blogs. For example, I am interested in a certain topic, let’s say, about cats. Then I will provide multiple blog links. If the blog is about cats, summarize it, if it hasn’t then ignore it. Another application of this is in emails. A certain reply can be made depending on the content of an email.

Tactic 4: Few-shot prompting

This is my favorite! This is basically giving examples first then asking ChatGPT to do it.

Principle 2: Give the model time to think

Tactic 5: Specify the steps required to complete a task

This seems pretty straightforward, hmmm. Just provide specific step-by-step instructions to ChatGPT.

Tactic 6: Instruct the model to work out its own solution before rushing to a conclusion

Okay, so for this one, what I’ve learned is basically “ChatGPT, answer this then check if my solution matches yours.” Yeah, that’s it, I’ll show an example.

Hmmm, basically this is useful for math and engineering problems but you get the point of my example.


The impressive capabilities of ChatGPT

Now that you’ve learned (or refreshed?) on how to write clear and specific prompts for ChatGPT, I will now discuss the other part of the course which is the capabilities of ChatGPT. And those are: Iterative Prompts, Summarizing, Inferring, Transforming, and Expanding. Let’s start with Iterative Prompts.

Iterative Prompt Development

This is where you first write a prompt then change your prompt if the answer that you received is not what you desired.

The iterative prompt process is like this:

  1. Try something

  2. Analyze where the result does not give what you want

  3. Clarify instructions and give more time for the machine to think

  4. Refine prompts with a batch of examples

Issue 1: The output is too long

I just don’t want to share the whole prompt here because it is too long. I got the text for my prompt from this website.

I want this to be shorter so I’ll limit each step in at most 50 characters.

Now, that’s what I like.

Issue 2: Text focuses on the wrong details

For this one, it’s a little hard to explain. From what I’ve learned, ChatGPT sometimes overlooks some details just like this one.

I want ChatGPT to give me a new scenario but what he did is gave me the same scenario. It’s like he just copied my example then expanded it! So what I’ve done is to be more specific and added that I want it to be in the medical field.

Issue 3: Description needs a table of dimensions

Now on this one, the output is not something that you expect. For example:

The answer seems good, but for me I want it to be in a structured form especially ChatGPT answers multiple books.

That’s better for me!

Iterative Prompt Guidelines:

  • Be clear and specific

  • Analyze why the result does not give the desired output

  • Refine the idea and the prompt

  • Repeat

Summarizing

Hmmm, this one is straightforward. Even some of my examples are using this so I’ll just copy one of them.

Inferring

This one is divided into subparts: sentiments, extraction, and multiple tasks at once.

Sentiments

You can use ChatGPT to get the sentiments of a text, identify all types of emotions in a text, and check if a specific emotion is present in a text.

Extraction

It’s like summarizing but in a list form.

Transforming

Transforming is changing your input into something. The examples are straightforward: Translating (changing language), Tone transformation (professional? like talking to your pet?), Format conversion (HTML → JSON), and Grammar check.

Translating

Wow! As a Filipino, I honestly didn’t expect that translation but it still has the same thought. It says from the course that ChatGPT is capable of translating multiple languages such as French, Korean, and German.

Tone transformation

BRUH! WHAT IS THIS. nvm, I like it!

Format conversion

I really like this, I use this a lot! Especially for changing R into Python! Also if the formula is in Google Sheets and I need it to be in DAX. This can also be applied to changing something into HTML or JSON.

Spellcheck/Grammar check/Proofread

This is what I always do! English is not my first language so I always make grammatical errors especially on where to put commas, when to use “in”, “on”, and “at”, and not sure if the spelling is “sucessful” or “successful”. So yeah! ChatGPT is really handy in this case.

Expanding

This is another thing on ChatGPT. Most people use ChatGPT for this purpose. Brainstorming ideas, making an outline for an essay, or straight-up essay maker!

ChatGPT is a good brain storming partner, so I highly recommend to use it. However, for making essays, make sure you check the contents and paraphrase it because ChatGPT mostly produced plagiarized or erroneous contents.

Temperature Parameter

Temperature is something like the degree of randomness, where it takes values from 0.0 up to 1.0. Having a temperature of 0.0 gives ChatGPT a more accurate and deterministic response. On the other hand, a temperature of 1.0 gives ChatGPT a more creative response and a wider range of choice of words.

Temperature of 0.0

Temperature of 1.0

As you can see, I used it in two different topics. It is because having a temperature of 0 provides a more accurate response which is something that I needed when providing a brief description of linear regression. Having a temperature of 1 provides a more creative reply which is what I needed about making an essay.


ChatGPT is a great AI tool. It provides a variety of use cases in different things and tasks. However, ChatGPT alone is useless without having quality prompts provided by the user. So make sure to apply all of these in order to properly utilize ChatGPT. (NOTE: I didn’t use ChatGPT to write this part.)