Humanizing Artificial Intelligence

One-Shot Prompting

One-Shot Prompting involves providing the language model with a single example of the desired input-output format to guide its response.

By showing the model one example of what you want, you give it a pattern to follow. This helps the model understand both the task and the expected format of the response.

Pros:

  • Provides a minimal level of context, which can significantly improve the model’s understanding
  • Output quality is typically better than zero-shot prompting
  • Helps clarify ambiguous instructions
  • Demonstrates the desired format or style

Cons:

  • A single example might not be sufficient to capture the desired complexity
  • May not cover all variations in the task
  • The model might overly rely on the specific example provided

Example:

Prompt:

Translate 'hello' to Spanish.
Example: 'goodbye' -> 'adiós'

Expected Output:

'hello' -> 'hola'

One-shot prompting works best for:

  • Simple translation tasks
  • Format conversion
  • Basic classification
  • When you need to specify a particular output format
  • When zero-shot prompting isn’t quite getting the right results

When one example isn’t enough to capture the complexity of your task, consider moving to few-shot prompting with multiple examples.