• Bot & Beyond
  • Posts
  • I was weary of hearing the term Prompt Engineering

I was weary of hearing the term Prompt Engineering

What I learned about Prompt Engineering so far

Spoiler alert: this episode is all about prompt engineering!

When chatgpt came out in 2022, I started seeing, and hearing about prompt engineering all over social media.

My initial thoughts were like, "how hard could it be to get some decent results from AI? Do you need a whole engineering discipline? These people are making things up."

But when I started with AI automations I realized the importance of prompting techniques.

Don't get me wrong, anyone can learn to build an automation on a no code platform.

Now that we have AI in the mix, it's all about the prompt.

If your prompt doesn't produce accurate results consistently, the automation is of no use.

That's why I focus on learning and mastering prompt engineering from the get go.

Here's what I have learned so far.

What is prompt engineering?

Prompt engineering is about curating prompts that produce replicable and reliable outputs to fulfil a specific function.

There are many prompting techniques, some of the most popular include:

  • Zero-shot prompting

  • Multi-shot prompting

  • Chain-of-Thought prompting

  • Prompt chaining

Zero-shot prompting

This is what most of us do most of the time when using Chatgpt or Claude i.e. we give a bunch of instructions without any examples.

It's good for most use cases, but we cannot guarantee the consistency of results when the prompt is reused.

Many shot prompting

This simply means giving several examples to the LLM along with instructions.

You should give example input along with example output.

LLs perform way better in producing accurate results when examples are given because of its pattern matching capabilities.

You can do this using "user" and "assistant" message pair in make.com

user message is the example input and assistant message is the example output.

A recent study evaluated some models' accuracy in performing a specific task based on the number of examples provided. The results showed that providing at least one example significantly improved the models' accuracy compared to zero-shot prompting, where no examples are given. On average, zero-shot prompting resulted in an accuracy of around 70%.Providing just one example, or one-shot prompting, increased the accuracy to approximately 73-74%.Further increasing the number of examples to 32 (32-shot prompting) resulted in a further accuracy boost to 77-78%.

I don’t remember source, found it in my notes.

Chain-of-Thought prompting

This is simply asking the model to think step by step and show the reasoning or the logic of how it arrived at the solution along with an example.

Here's a simple CoT prompt:

"John has 3 apples. He buys 4 more apples. Then he gives 2 apples to his friend. How many apples does John have now? Let's think step-by-step:

  1. John starts with 3 apples.

  2. He buys 4 more apples, so he has 3 + 4 = 7 apples.

  3. Then, he gives 2 apples to his friend, so he has 7 - 2 = 5 apples left.

Answer: John has 5 apples."

This approach prevents the llm from skipping steps or making mistakes.

Prompt chaining

This is when you break down a task in to a sequence of prompts.

For example, suppose you want the llm to write a blog post or an article. Instead of prompting it to generate it at once, first you ask for the outline, then ask to write each section separately.

This is obviously good for more complex and larger tasks.

Structured output

This is specially important in automations.

You can get the output in any format such as XML, JSON, or CSV.

When asking for structured output always provide an example to get consistent results.

I use this all the time in make automations. Because it makes it so much easier to feed data to the next module by just parsing it.

The best method to get consistent results with structured output is to use function calling feature in OpenAI API. I’m experimenting with it right now, will write about it in a later episode.

Testing and iterating

Another useful practice I learned is to test prompts, rate it, then modify and test and rate again. Iterating this will help curate the best prompts for the purpose.

That's all for this week!

Hit reply and tell me what you think or what you look forward to in a future episode...

I read every reply.

Have a great week!

Dilini