반응형
What is Few-shot Prompting?
- In artifical intelligence, a "shot" refers to an example
- Therefore, Few-shot means a few examples.
- Few-shot prompting is a method that helps AI models better understand and perform new tasks by providing a small number of examples when the model needs to perform a new task.
- Few-shot prompting is broadly divided into:
- Instructions: Description of the task the model needs to perform
- Examples: Examples for the model to reference when generating responses
- Input data: Optional use depending on whether there is data to analyze
- It is common to use 2-5 examples for few-shot prompting
Examples of few-shot prompting
1. Sentiment Analysis
Input: "The food was amazing!"
Output: Positive
Input: "Terrible service, would not recommend."
Output: Negative
Input: "It was an okay experience."
Output: Neutral
Input: "The concert exceeded all my expectations!"
Output: [The model should predict: Positive]
2. Text Classification
Input: "How do I reset my password?"
Category: Technical Support
Input: "I'd like to return my recent purchase"
Category: Customer Service
Input: "What are your business hours?"
Category: General Inquiry
Input: "My account is locked, please help"
Category: [The model should predict: Technical Support]
3. Language Translation (Informal -> Formal)
Informal: "Hey, what's up?"
Formal: "Hello, how are you?"
Informal: "Gimme a sec"
Formal: "Please give me a moment"
Informal: "That's awesome!"
Formal: "That is excellent"
Informal: "Can't wait to see ya"
Formal: [The model should predict: "I look forward to seeing you"]
4. Entity Extraction
Text: "John Smith lives in New York"
Person: John Smith
Location: New York
Text: "Apple Inc. is headquartered in Cupertino"
Company: Apple Inc.
Location: Cupertino
Text: "Microsoft CEO Satya Nadella announced"
Person: Satya Nadella
Company: Microsoft
Text: "Tesla opened a new factory in Berlin"
Company: [The model should predict: Tesla]
Location: [The model should predict: Berlin]
Advantages
- Few-shot prompting enables AI models to better understand and perform tasks with just a small amount of data.
- While it takes longer to write prompts compared to zero-shot prompting, it allows for more precise control of responses.
Limitations
- Since few-shot prompting only provides a small number of examples to the AI, if the quality of the given examples is low, there's a higher probability that the AI will produce incorrect results.
- Therefore, when using few-shot prompting, it's crucial to carefully check the consistency and quality of the examples.
It is a mistake to underestimate the power of a single individual to change the world.
- Elon Musk -
반응형
'NLP' 카테고리의 다른 글
[LLM] 1. Prompt Engineering Basics #1 (0) | 2025.01.05 |
---|---|
[NLP] 3. How does Transformer Work? (1) | 2025.01.03 |
[Prompt Engineering] 2. Zer0-shot Prompting (0) | 2025.01.02 |
[NLP] 2. NLP Arrangement of Terms (용어 정리) (0) | 2024.11.21 |
[NLP] 1. Natural Language Processing Basics (0) | 2024.11.18 |