๋ณธ๋ฌธ์œผ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

๐ŸŸข ํ”„๋กฌํ”„ํŠธ ๊ณต์‹ํ™”

RoleExample 1InstructionExample 2Example 3ContextQuestion

์ด์ œ ์šฐ๋ฆฌ๋Š” ๋‹ค์–‘ํ•œ ํ”„๋กฌํ”„ํŠธ๋“ค์„ ์•Œ๊ฒŒ ๋˜์—ˆ๊ณ  ๋˜ ๊ฐ๊ฐ์„ ์œตํ•ฉํ•˜๋Š” ๋ฐฉ๋ฒ•๋„ ์•Œ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ํŽ˜์ด์ง€๋Š” ๋‹ค์–‘ํ•œ ํ”„๋กฌํ”„ํŠธ๋“ค์„ ์„ค๋ช…ํ•˜๊ธฐ ์œ„ํ•œ ๋‹จ์–ด๋ฅผ ์—ฌ๋Ÿฌ๋ถ„์—๊ฒŒ ์ œ๊ณตํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ํ”„๋กฌํ”„ํŠธ ์—”์ง€๋‹ˆ์–ด๋ง ๊ณต์‹ํ™”์— ๋Œ€ํ•œ ๋‹ด๋ก ์ด ๊พธ์ค€ํžˆ ์žˆ์—ˆ์Œ์—๋„ ์ด ๋ถ€๋ถ„์€ ๊ณ„์† ๋ฐ”๋€Œ์–ด์™”์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์šฐ๋ฆฌ๋Š” ์—ฌ๋Ÿฌ๋ถ„์—๊ฒŒ ์‹œ์ž‘ํ•˜๊ธฐ์— ์•Œ๋งž์€ ์ •๋„์˜ ์ •๋ณด๋งŒ์„ ์ œ๊ณตํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

ํ”„๋กฌํ”„ํŠธ์˜ ๊ตฌ์„ฑโ€‹

์—ฌ๋Ÿฌ๋ถ„์ด ์•ž์œผ๋กœ ๊ณ„์†ํ•ด์„œ ๋งˆ์ฃผํ•  ํ”„๋กฌํ”„ํŠธ์˜ ๊ตฌ์„ฑ์ž…๋‹ˆ๋‹ค. ๊ฐ„๋‹จํ•˜๊ฒŒ ํ‘œํ˜„ํ•˜๋ฉด:

  • ์—ญํ• (role)
  • ์ง€์‹œ(instruction/task)
  • ์งˆ๋ฌธ(question)
  • ๋ฌธ๋งฅ(Context)
  • ์˜ˆ์‹œ(few shot)

์šฐ๋ฆฌ๋Š” ์ด์ „ ํŽ˜์ด์ง€๋“ค์—์„œ ์—ญํ• , ์ง€์‹œ, ์˜ˆ์‹œ๋ฅผ ์ด๋ฏธ ์‚ดํŽด๋ณด์•˜์Šต๋‹ˆ๋‹ค. ์งˆ๋ฌธ์€ ๋‹จ์ˆœํžˆ ์งˆ๋ฌธ์ž…๋‹ˆ๋‹ค!(์˜ˆ๋ฅผ ๋“ค์–ด what is the capital of France?). ๊ทธ๋ฆฌ๊ณ  ๋ฌธ๋งฅ์€ AI๊ฐ€ ์งˆ๋ฌธ์— ๋‹ต๋ณ€์„ ํ•  ๋•Œ ์ฐธ๊ณ ํ–ˆ์œผ๋ฉด ํ•˜๋Š” ๋ชจ๋“  ์ •๋ณด๋ฅผ ๋งํ•ฉ๋‹ˆ๋‹ค.

์ด ์š”์†Œ๋“ค์ด ๋ชจ๋“  ํ”„๋กฌํ”„ํŠธ์— ํ•ญ์ƒ ๋“ค์–ด๊ฐ€์ง€๋Š” ์•Š์ง€๋งŒ ๋•Œ๋•Œ๋กœ ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์š”์†Œ๋“ค ์‚ฌ์ด์— ์ •ํ•ด์ง„ ์ˆœ์„œ๋Š” ์—†์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด์„œ ์—ญํ• , ์ง€์‹œ, ๋ฌธ๋งฅ์ด ํฌํ•จ๋œ ์•„๋ž˜ ๋‘ ํ”„๋กฌํ”„ํŠธ๋Š” ์„œ๋กœ ์ˆœ์„œ๊ฐ€ ๋‹ค๋ฅด์ง€๋งŒ ๋˜‘๊ฐ™์ด ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

You are a doctor. Read this medical history and predict risks for the patient:

January 1, 2000: Fractured right arm playing basketball. Treated with a cast.
February 15, 2010: Diagnosed with hypertension. Prescribed lisinopril.
September 10, 2015: Developed pneumonia. Treated with antibiotics and recovered fully.
March 1, 2022: Sustained a concussion in a car accident. Admitted to the hospital and monitored for 24 hours.
January 1, 2000: Fractured right arm playing basketball. Treated with a cast.
February 15, 2010: Diagnosed with hypertension. Prescribed lisinopril.
September 10, 2015: Developed pneumonia. Treated with antibiotics and recovered fully.
March 1, 2022: Sustained a concussion in a car accident. Admitted to the hospital and monitored for 24 hours.

You are a doctor. Read this medical history and predict risks for the patient:

ํ•˜์ง€๋งŒ ์ง€์‹œ๊ฐ€ ํ”„๋กฌํ”„ํŠธ์˜ ๋งˆ์ง€๋ง‰ ๋ถ€๋ถ„์ด๋ฏ€๋กœ ๋‘ ๋ฒˆ์งธ ํ”„๋กฌํ”„ํŠธ์˜ ํ˜•ํƒœ๊ฐ€ ์กฐ๊ธˆ ๋” ์„ ํ˜ธ๋ฉ๋‹ˆ๋‹ค. LLM์ด ์ง€์‹œ๋ฅผ ๋”ฐ๋ฅด๋Š” ๊ฒƒ ๋Œ€์‹ ์— ์˜๋„์น˜ ์•Š์€ ๊ธ€์„ ์ž‘์„ฑํ•  ๊ฐ€๋Šฅ์„ฑ์ด ์ ์–ด์ง€๊ธฐ ๋•Œ๋ฌธ์— ๋” ์ข‹์€ ๋ฐฉ๋ฒ•์ด ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด์„œ, ์ฒซ ๋ฒˆ์งธ ํ”„๋กฌํ”„ํŠธ์—์„œ LLM์€ March 15, 2022: Follow-up appointment scheduled with neurologist to assess concussion recovery progress.๊ณผ ๊ฐ™์€ ์ถ”๊ฐ€์ ์ธ ๋ฌธ์žฅ์„ ์ž‘์„ฑํ•  ์ˆ˜ ๋„ ์žˆ๋‹ค.

"ํ‘œ์ค€" ํ”„๋กฌํ”„ํŠธโ€‹

์šฐ๋ฆฌ๋Š” ์ง€๊ธˆ๊นŒ์ง€ ๋ช‡ ๊ฐ€์ง€ ๋‹ค์–‘ํ•œ ํ”„๋กฌํ”„ํŠธ ํฌ๋งท์— ๋Œ€ํ•ด์„œ ์‚ดํŽด๋ณด์•˜์Šต๋‹ˆ๋‹ค. ์ฒ˜์Œ์œผ๋กœ ๋Œ์•„๊ฐ€์„œ "ํ‘œ์ค€" ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ •์˜ํ•ด๋ณผ ๊ฒƒ์ž…๋‹ˆ๋‹ค. Kojima et al์— ๋”ฐ๋ผ1, ์šฐ๋ฆฌ๋Š” ์งˆ๋ฌธ์œผ๋กœ๋งŒ ์ด๋ฃจ์–ด์ง„ ํ”„๋กฌํ”„ํŠธ๋ฅผ "ํ‘œ์ค€" ํ”„๋กฌํ”„ํŠธ๋กœ ๋ฐ”๊ฟ”๋ณผ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋˜ํ•œ ์šฐ๋ฆฌ๋Š” QA ํฌ๋งท์œผ๋กœ ๋˜์–ด์žˆ๋Š” ์งˆ๋ฌธ์„ "ํ‘œ์ค€" ํ”„๋กฌํ”„ํŠธ๋กœ ๋ฐ”๊ฟ”๋ณผ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์™œ ์•Œ์•„๋‘ฌ์•ผ ํ• ๊นŒ?โ€‹

์šฐ๋ฆฌ๊ฐ€ ์ฐธ์กฐํ–ˆ๋˜ ๋งŽ์€ ๋…ผ๋ฌธ๋“ค์—์„œ ์ด ์šฉ์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ์•ž์œผ๋กœ ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ์™€ ๋Œ€์กฐ๋˜๋Š” ์ƒˆ๋กœ์šด ์œ ํ˜•์˜ ํ”„๋กฌํ”„ํŠธ์— ๋Œ€ํ•ด ๋…ผ์˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ์ด๋ฅผ ๋ฏธ๋ฆฌ ์ •์˜ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ์— ๋Œ€ํ•œ ๋‘๊ฐ€์ง€ ์˜ˆ์‹œ:โ€‹

ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ

What is the capital of France?

QA ํฌ๋งท์˜ ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ

Q: What is the capital of France?

A:

ํ“จ์ƒท(Few Shot) ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ๋“คโ€‹

ํ“จ์ƒท(Few Shot) ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ๋“ค์€2 ํ‘œ๋ณธ๋“ค ์ด ํฌํ•จ๋œ ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ์ž…๋‹ˆ๋‹ค. ํ‘œ๋ณธ์€ ํ”„๋กฌํ”„ํŠธ๊ฐ€ ํ•ด๊ฒฐํ•ด์คฌ์œผ๋ฉด ํ•˜๋Š” ์ผ๋“ค์— ๋Œ€ํ•œ ๋ช‡๋ช‡์˜ ์˜ˆ์‹œ๋ฅผ ์šฐ๋ฆฌ๊ฐ€ ๋ฏธ๋ฆฌ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์—ฐ๊ตฌ์— ๋”ฐ๋ฅด๋ฉด, ํ“จ์ƒท(Few Shot) ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ๋Š” ์ข…์ข… ๊ทธ๋ƒฅ ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ๋กœ ๋ถˆ๋ฆฌ๊ณคํ•ฉ๋‹ˆ๋‹ค.(์ด ๊ฐ€์ด๋“œ์—์„œ ์ถ”์ฒœํ•˜์ง€ ์•Š์Œ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ )

ํ“จ์‚ฟ(Few Shot) ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ์— ๋Œ€ํ•œ ๋‘๊ฐ€์ง€ ์˜ˆ์‹œ:โ€‹

ํ“จ์‚ฟ(Few Shot) ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ

What is the capital of Spain?
Madrid
What is the capital of Italy?
Rome
What is the capital of France?

QA ํฌ๋งท์˜ ํ“จ์‚ฟ(Few Shot) ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ

Q: What is the capital of Spain?
A: Madrid
Q: What is the capital of Italy?
A: Rome
Q: What is the capital of France?
A:

ํ“จ์‚ฟ(Few Shot) ํ‘œ์ค€ ํ”„๋กฌํ”„ํŠธ๋Š” ํŒŒ๋ผ๋ฏธํ„ฐ ์—…๋ฐ์ดํŠธ๋ฅผ ํ•„์š”๋กœ ํ•˜์ง€ ์•Š๋Š” "๋ฌธ๋งฅ ์ƒ(in context)" ํ•™์Šต์„ ์šฉ์ดํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.


  1. Kojima, T., Gu, S. S., Reid, M., Matsuo, Y., & Iwasawa, Y. (2022). Large Language Models are Zero-Shot Reasoners. โ†ฉ
  2. Liu, P., Yuan, W., Fu, J., Jiang, Z., Hayashi, H., & Neubig, G. (2022). Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processing. ACM Computing Surveys. https://doi.org/10.1145/3560815 โ†ฉ