Prompt Engineering (source:
Prompt Engineering | Definition und Beispiele - IONOS AT) are techniques and methods to optimizes prompt for Natural language Processing and Large Language Models, as GPT-3 or GPT4, based on Machine Learning. The goal is to get better more precise and specific answers, as it is very important how a question or statement is formulated, and as big impact of the quality and relevance of the answer provided by AI. Prompt Engineering for AI needs creativity and precision to fully understand the speech model, as the selection or order of word can have a big impact to the output. The same prompt can come to different results on different AI platforms. Therefore, Prompt Engineering needs to be processed individually for every AI test generator, AI image generator or AI video generator.
Typical prompt engineering process to develop a communication interface could look like:
(Source: Was ist Prompt Engineering? - Wissen kompakt - t2informatik )
- Data collection: First, you collect data to build the system. This data can come from various sources such as customer dialogues, chat logs or other similar sources.
- Data preparation: The collected data must be prepared and cleaned to remove invalid or unusable data and to make the system efficient.
- Model selection: Next, choose a suitable ML model to train the system. Here you can choose between different models such as regression models, neural networks or decision tree models.
- Model training: The selected model is trained on the prepared data to tune it to the task to which it is to be applied
- Deployment: Once the model is trained, it can be deployed to be used in a productive environment.
- Monitoring and optimization: Finally, the system is monitored and continuously optimized to ensure that it meets current requirements and provides a good user experience.
I looked at the following techniques source from https://www.promptingguide.ai/
Prompt technique 1: Zero-shot Prompting source: Zero-Shot Prompting | Prompt Engineering Guide<!-- -->
- How it works: e.g., you are directly prompting the model for a response without any examples or demonstrations about the task you want it to achieve. Some large language models have the ability to perform zero-shot prompting but it depends on the complexity and knowledge of the task at hand and the tasks the model was trained to perform good on.
- Potential impact: It can help to finetune models on datasets.
Prompt technique 2: Few-shot Prompting source: Few-Shot Prompting | Prompt Engineering Guide<!-- -->
- How it works: Few-shot prompting can be used as a technique to enable in-context learning where we provide demonstrations in the prompt to steer the model to better performance. The demonstrations serve as conditioning for subsequent examples where we would like the model to generate a response.
Prompt technique 3: Chain-of-Thought Prompting source: Chain-of-Thought Prompting | Prompt Engineering Guide<!-- -->
- How it works: chain-of-thought (CoT) prompting enables complex reasoning capabilities through intermediate reasoning steps. You can combine it with few-shot prompting to get better results on more complex tasks that require reasoning before responding.
- Potential impact: When applying chain-of-thought prompting with demonstrations, the process involves hand-crafting effective and diverse examples. This manual effort could lead to suboptimal solutions. Zhang et al. (2022)(opens in a new tab) propose an approach to eliminate manual efforts by leveraging LLMs with âLetâs think step by stepâ prompt to generate reasoning chains for demonstrations one by one. This automatic process can still end up with mistakes in generated chains. To mitigate the effects of the mistakes, the diversity of demonstrations matter. This work proposes Auto-CoT, which samples questions with diversity and generates reasoning chains to construct the demonstrations.
Auto-CoT consists of two main stages:
- Stage 1): question clustering: partition questions of a given dataset into a few clusters
- Stage 2): demonstration sampling: select a representative question from each cluster and generate its reasoning chain using Zero-Shot-CoT with simple heuristics
The simple heuristics could be length of questions (e.g., 60 tokens) and number of steps in rationale (e.g., 5 reasoning steps). This encourages the model to use simple and accurate demonstrations.
