One-shot Prompt
Definition
A prompting technique that provides the model with a single example of the task before asking it to perform a similar task. This approach gives the model context about the expected input-output format and style.
Characteristics
- Contains exactly one example
- Shows input-output relationship
- Demonstrates desired format and style
- Bridges zero-shot and few-shot approaches
Example
Prompt:
Translate the following English sentence to French:
English: "Hello, how are you?"
French: "Bonjour, comment allez-vous?"
Now translate this sentence:
English: "Good morning."
French:
Expected Response: "Bonjour."
Use Cases
- Translation tasks
- Format transformation
- Style demonstration
- Classification with specific output format
- Template-based responses
Benefits
- Provides clear example of expected output
- Better performance than zero-shot for many tasks
- Efficient use of context (minimal examples)
- Good balance between guidance and brevity
- Helps establish output format and style
Limitations
- Single example may not cover edge cases
- May lead to overfitting to the specific example
- Less robust than few-shot for complex tasks
- Example quality critically impacts performance
- May not represent full task complexity
Best Practices
- Choose representative, high-quality examples
- Ensure example demonstrates desired output format
- Select examples that cover common use cases
- Avoid overly complex or edge-case examples
- Make the pattern clear and generalizable
When to Use
- When you have limited context space
- For straightforward tasks with clear patterns
- When one good example sufficiently demonstrates the task
- As a starting point before scaling to few-shot