28 November, 2024
Techniques: Encourage the model to proceed in a step-by-step manner. This has the effect of making the desired output more probable. The output looks like the LLM is showing its reasoning process1.
Example Prompt
Think through this step-by-step: 1) List the symptoms 2) Consider possible causes 3) Evaluate urgency 4) Recommend action
Often it can be sufficient to just ask the model to think step-by-step.
Example Prompt
Think step-by-step.
Technique: Provide multiple examples before asking for a new output.
The way that we structure Few-Shot Prompts is very important. By this, we mean do we separate the inputs and outputs with a colon (:) or the words INPUT/OUTPUT. We have seen examples of both earlier in this article. How can you decide? We generally use the input: output format and occasionally use the QA format, which is commonly used in research papers.
Use 2-5 examples for simple tasks. Use often ~10 examples for harder tasks
Example Prompt
Input: “Great product, 10/10”
Ouput: “Great product, 10/10”: {“label”: “positive”}
Input: “Didn’t work very well”
Output: “Didn’t work very well”: {“label”: “negative”}
Input: “Super helpful, worth it”
Output: “Super helpful, worth it”: {“label”: “positive”}
Input: “I’m not sure I would buy this again”
Output:
Technique: Specify a structure for the model’s response.
LLMs are prone to variability in their responses.
Technique: Generate multiple answers, aggregate the responses and select the majority result.
Do this several times:
Example Prompt
Provide three independent assessments for these symptoms.
Think step-by-step.
Symptoms: [insert symptoms here]
Provide the responses to an LLM in a new session:
Example Prompt
Analyze whether the following assessments agree with each other. Give me your expert assessment based on the assessments you received.
Technique: Use LLMs to “read” new research papers.
Example Prompt
Based on the attached research paper on [prompt engineering technique], write a prompt that would cause an LLM to behave according to the techniques described in this paper. Use [topic] as an example.
Positive thinking
You are an experienced emergency room nurse. Take a deep breath and carefully assess the following patient’s symptoms.
Chain of Thought
Think through this patient’s case step-by-step: 1) List the symptoms, 2) Consider possible causes, 3) Evaluate urgency, 4) Recommend action.
Optimized prompt
The ER is in chaos, Doctor. We need your expertise to navigate this storm of patients and identify the most critical cases.
see Battle and Gollapudi (2024)
Berner Fachhochschule | Bern University of Applied Sciences