C.W.K.
Stream
Lesson 03 of 10 · published

Few-shot example — 언제, 몇 개

~22 min · instructions, examples, few-shot

Level 0수련생
0 XP0/100 lessons0/14 achievements
0/120 XP to next level120 XP to go0% complete

example 한 개가 형용사 다섯 개를 이긴다

worked example은 가리킬 수 있는 contract야. "이 모양 맞춰"를 진짜 input/output 쌍이랑 같이 주면 — 형용사 한 단락보다 모델한테 더 많이 말해줘. GPT-3 시대부터 few-shot prompting이 살아남은 이유야 — example이 너의 형용사 해석을 우회하고 target distribution을 직접 보여줘.

몇 개 example

  • 0개 — frontier 모델이 익숙한 task와 명확한 schema에 OK.
  • 1개 — 새로운 shape나 특정 tone에 가장 좋아. 가장 싸고 leverage 큰 step.
  • 2~5개 — task가 너가 모델한테 cover시키고 싶은 shape 다양성을 가질 때 (짧은 input 하나, 긴 input 하나).
  • 6개 이상 — context 토큰 비용 지불, diminishing return. schema가 진짜 어려운 케이스용.

example design 룰

  • example은 input space의 edges를 cover해야 해 — 평균이 아니라. 짧은 거 하나, 긴 거 하나, happy path 하나, failure case 하나.
  • example을 explicit boundary (XML, JSON, fenced section)로 태그해서 모델이 user input이랑 안 섞도록.
  • chain-of-thought 요청하면 example output에 reasoning 포함. 아니면 생략.
  • 틀린 example은 example 없는 것보다 나빠 — 모델을 잘못된 shape에 pin해.

Code

explicit boundary 박힌 few-shot·xml
<task>Classify customer messages into one of: refund, complaint, feature_request, other.</task>

<example>
  <input>The shipping took 3 weeks and arrived dented. I want my money back.</input>
  <output>{"category": "refund", "reason": "damaged_late"}</output>
</example>

<example>
  <input>It would be great if you supported dark mode in the iOS app.</input>
  <output>{"category": "feature_request", "reason": "ui_dark_mode"}</output>
</example>

<input>{{user_message}}</input>

External links

Exercise

지금 zero-shot으로 쓰는 프롬프트에 잘 고른 example 쌍 하나 추가. 추가 전후로 10개 input에 돌려. example이 고친 구체적 행동 하나 메모.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.