Step 1 of 4Knowledge
There are various techniques you can use to improve the quality of your prompts. The three most important ones for getting started are: Zero-Shot, Few-Shot, and Chain-of-Thought.
Zero-Shot means: You simply ask your question without providing any examples. The LLM should understand the task purely from your description. Example: "Translate the following sentence into English: 'Der Hund spielt im Garten.'"
Few-Shot means: You include 2-3 examples so the LLM recognizes the pattern. This works especially well for tasks that require a specific format or style.
Example: "Classify the sentiment as positive, neutral, or negative:
- 'The food was fantastic!' -> positive
- 'The train arrived on time.' -> neutral
- 'The service was a disaster.' -> negative
- 'The delivery arrived faster than expected.' -> ???"
The LLM recognizes the pattern and responds correctly: "positive."
Chain-of-Thought means: You ask the LLM to think step by step. This leads to better results on complex tasks because the model makes its intermediate steps visible.
Example: "There are 5 people in a room. 2 leave, 3 new ones come in. Then half of them leave. How many are still there? Think step by step."
- Ask a question
- Answer
Step 2 of 4Understand
System Prompts -- The Hidden Instruction
There is a special kind of prompt that you do not always see: the system prompt. It is sent to the LLM before your actual message and defines its fundamental behavior.
For example, when you chat with the standard ChatGPT chatbot, it has a system prompt like: "You are a helpful assistant." But companies can change that: "You are a customer service representative for TechShop. Always respond politely, and for complaints refer to our return form."
Without a system prompt: "What is the weather like?" -> The LLM gives a general answer or says it has no internet access.
With a system prompt ("You are a weather assistant for Hamburg"): "What is the weather like?" -> The LLM responds in the context of Hamburg and in the style of a weather assistant.
Step 3 of 4Apply
Try all three techniques with the same task: Ask an LLM to summarize a product review. First without examples (Zero-Shot), then with examples (Few-Shot), then with "Think step by step" (Chain-of-Thought). Compare the results.