Code&Data Insights

[Prompt Engineering] Zero Shot Learning | Few-Shot Learning 본문

Artificial Intelligence/Prompt Engineering

[Prompt Engineering] Zero Shot Learning | Few-Shot Learning

paka_corn 2024. 3. 23. 15:55

Zero-Shot Learning

: 예시 없이 그냥 Prompt 입력 

(one-shot learning : 하나의 예시만 제공) 

Zero-Shot Prompting

: A method wherein models generate meaningful responses to prompts without prior training

 

(ex) 

prompt : select the adjective in this sentence "Anita bakes the best cakes in the neighborhood."

- output : "Best"

 

=> HOWEVER, 1-prompt로 desired output(원하는 결과)를 얻기는 힘듬!! 

 

User Feedback Loop

: 계속되는 prompt(by user feedback)를 통하여 원하는 결과를 얻어냄 

 

(ex)

1st prompt : Write a poem 

2nd prompt : Make it more humorous 

 

 

 

Few-Shot Learning

: 예시를 통해서 학습하고, 그 예시를 통해서 prompt에 대한 답변을 만들어줌! 

적은 수의 예제로부터 학습하는 능력은 대량의 레이블 데이터를 획득하는 것이 불가능하거나 비용이 많이 드는 상황에서 특히 유용

* 예시가 너무 적을 경우, 모델이 예시 내의 의도하지 않은 패턴을 익힐 수 있음 -> 엉뚱한 결과 출력

 

Few-Shot Prompting

: Enables in-contexst learning using demonstrations in the prompt 

-> the demonstrations acts as conditioning for subsequent tasks

모델이 프롬프트에 제공된 제한된 컨텍스트나 예제를 기반으로 작업을 수행!

 

 

(ex) 

Few-shot prompts (계절에 따른 여행 국가/관광지 추천)

"Recommend a summer travel destination well known for beautiful beaches."

"Suggest a fall travel destination known for its beautiful foliage."

 

=> LLM 모델이 위의 few-shot prompts를 바탕으로, 결과를 도출 한뒤 

다른 여행 관련 prompt의 결과도 이어서 생성할 수 있음! 

 

(ex) 

new_prompt : Recommend a city to explore (앞서 추천했던 나라/관광지의 도시 추천) 

 

 

 

 

Reference

https://www.coursera.org/learn/generative-ai-prompt-engineering-for-everyone

 

Comments