Prompt Engineering: How Many Examples Is Enough?
More examples help until the improvement flattens. The way to find the right number is to try two, five and ten on the same task and compare the answers.
Two examples on the tracking question
Two examples set the format, and the new question follows it.
You are a support agent for ShopStack. Answer each customer question in one sentence. Example 1. Question: Where is my order 1042? Answer: Order 1042 shipped and is out for delivery. Example 2. Question: How long does a refund take? Answer: Refunds are processed within 3 to 5 business days after the returned item arrives. Question: How do I track my delivery? Answer:Five examples on the same question
Five examples add the edges to the format.
You are a support agent for ShopStack. Answer each customer question in one sentence. Example 1. Question: Where is my order 1042? Answer: Order 1042 shipped and is out for delivery. Example 2. Question: How long does a refund take? Answer: Refunds are processed within 3 to 5 business days after the returned item arrives. Example 3. Question: Do you ship to Canada? Answer: ShopStack ships within the country only. Example 4. Question: Can I use two discount codes on one order? Answer: No, only one code can be used per order. Example 5. Question: Is the tote bag big enough for a 13-inch laptop? Answer: Yes, it fits a 13-inch laptop and has an inner pocket. Question: How do I track my delivery? Answer:Ten examples on the same question
Ten examples add length, and the answer is compared with the shorter sets.
You are a support agent for ShopStack. Answer each customer question in one sentence. Example 1. Question: Where is my order 1042? Answer: Order 1042 shipped and is out for delivery. Example 2. Question: How long does a refund take? Answer: Refunds are processed within 3 to 5 business days after the returned item arrives. Example 3. Question: Do you ship to Canada? Answer: ShopStack ships within the country only. Example 4. Question: Can I use two discount codes on one order? Answer: No, only one code can be used per order. Example 5. Question: Is the tote bag big enough for a 13-inch laptop? Answer: Yes, it fits a 13-inch laptop and has an inner pocket. Example 6. Question: My mug arrived chipped. What do I do? Answer: Please send a photo, and you can choose a replacement or a refund. Example 7. Question: Can I return the cushion? I bought the wrong colour. Answer: Yes, returns are allowed within 30 days for unused items. Example 8. Question: Please cancel order 1043. Answer: Order 1043 is still processing, so it can be cancelled with a full refund. Example 9. Question: What is the difference between the Aurora Mug and the Ember Set? Answer: The Aurora Mug is a blue ceramic mug for 18 dollars, and the Ember Set is a pour-over coffee dripper with 100 paper filters for 35 dollars. Example 10. Question: I never got a shipping email for order 1042. Answer: Please check your spam folder, and we can resend the tracking link. Question: How do I track my delivery? Answer:Example
You are a support agent for ShopStack. Answer each customer question in one sentence. Example 1. Question: Where is my order 1042? Answer: Order 1042 shipped and is out for delivery. Example 2. Question: How long does a refund take? Answer: Refunds are processed within 3 to 5 business days after the returned item arrives. Example 3. Question: Do you ship to Canada? Answer: ShopStack ships within the country only. Example 4. Question: Can I use two discount codes on one order? Answer: No, only one code can be used per order. Example 5. Question: Is the tote bag big enough for a 13-inch laptop? Answer: Yes, it fits a 13-inch laptop and has an inner pocket. Question: What is the difference between the Aurora Mug and the Ember Set? Answer:Key points
- Two examples teach the format. Five examples add the edges. Ten examples add little more.
- The right number is found by trying, not by guessing.
- Each count runs on the same task, so the answers can be compared fairly.
- When the answers stop getting better, more examples only make the prompt longer.
- A longer prompt costs more and leaves less room for the answer.
This example runs the five-example prompt against the local model and shows the reply it gave. Five examples covered the edges, and the new answer followed the set.
Note
Stop adding examples when the answers stop improving. Extra examples add length, not quality.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
How is the right number of examples found?