Prompt Engineering: Zero-Shot
Zero-shot prompting means asking the model to do a task with no examples. The prompt states the task and nothing else.
A cold ask about order 1042
One short question, no examples, and the order facts in the prompt.
You are a support agent for ShopStack. A customer asks, 'Where is my order 1042?' Order 1042 belongs to Maya. It shipped and the tracking shows out for delivery. Answer in one sentence.A cold ask about a product
A simple product question needs no example either.
You are a support agent for ShopStack. A customer asks, 'Is the Trailhead Canvas Tote big enough for a 13-inch laptop?' The tote fits a 13-inch laptop and has an inner pocket. Answer in one sentence.A cold ask that is too vague
A vague task with no example gives a vague answer.
Write a reply to a customer who has a problem with an order.Example
You are a support agent for ShopStack. A customer asks, 'How long does a refund take?' The ShopStack refund policy says refunds are processed within 3 to 5 business days after the returned item arrives. Answer in one sentence.Key points
- Zero-shot prompting asks for a task with no examples in the prompt.
- The model relies on what it learned in training to understand the task.
- A simple task with a clear name works well with zero-shot prompting.
- A tracking question is a good zero-shot task. The task is one lookup and one short answer.
- A vague task fails with zero-shot prompting. The model has no example to show it the shape of the answer.
This example runs a zero-shot prompt against the local model and shows the reply it gave. The task is simple and the policy is in the prompt, so no example is needed.
Note
Zero-shot prompting is the starting point. Examples are added only when the cold ask falls short.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
When does a zero-shot prompt work best?