A perfect prompt in a nutshell

May 27, 2024

Introduction

For prompt engineering there is no one fits for all solution.

However there was one aricle which I found which was really helpful from Maximilian Vogel: The Perfect Prompt: A Prompt Engineering Cheat Sheet

He describes in detail how the prompts can be created in a stepwise manner.

What a prompt needs in a nutshell

  • System prompt instructions
  • Additional context

System Prompt Instructions

For creating the system prompt he proposes two frameworks: The AUTOMAT and the COSTAR framework. I have created two GPTs which can help you to generate the system prompt.

Additional context

After you have created your system prompt you can enhance your context with additional information:

  • Output format examples
  • Few shot learning: Few examples of the interaction with the system
  • Chain of thought made by Google Brain
  • Prompt templates (injected knowledge such as timezone, local news, etc.)
  • RAG (Retrieval Augmented Generation)
  • Chat history! (Yes this is also part of the context)
  • etc.

Limitations

Depending on model you are choosing you run into the context limit of the model.

You can check how many tokens your prompt uses with the Tokenizer.

You pay for input tokens so the bigger your prompt the more you pay.

Conlusion

There are many roads to rome.

With the described steps you have a continuous thread in creating your prompt.

Enjoy! ❤️