반응형
해당 포스팅은 'Learn Prompting' 블로그 내용을 학습하며 요약한 글로
정확한 내용은 하단의 링크를 이용해 본문을 확인하시길 바랍니다.

Chatbot

  • GPT-3는 메모리가 없는 LLM으로 사용자가 질문(프롬프트)을 하면 사용자가 이전에 요청한 내용을 기억하지 않는 반면 ChatGPT와 같은 챗봇은 대화 기록을 기억할 수 있음
    • 고객 서비스와 같은 응용 프로그램 또는 단순히 LLM과 대화를 나누고 싶을 때 유용할 수 있음
  • GPT-3와 마찬가지로 챗봇은 질문에 답하고 요약, 분석을 제공하고 텍스트 또는 코드를 작성할 수 있음
  • 챗봇의 진정한 가치는 좋은 프롬프트를 사용할 때 나타남
    • 스타일 지침, 설명자 및 프라이밍 사용과 같은 챗봇을 더 잘 활용하는 방법 필요

 

Style Guidance

  • 스타일 안내는 단순히 AI에게 특정 스타일로 말하도록 요청하는 것
  • 스타일 지침 없이 질문을 할 때 ChatGPT는 일반적인 응답을 제공함
    • 적당히 형식적인 어조로 말하고 몇 가지 세부 사항을 제공

  • 프롬프트 끝에 스타일 지침을 하여 ChatGPT의 응답을 사용자가 원하는 방향으로 더 좋게 만들 수 있음
    • 좀 더 대화적인 반응을 원하면 친근하거나 비공식적인 어조로 말하도록 요청할 수 있음
    • 더 읽기 쉬운 형식을 원하면 동일한 질문을 할 수 있지만 글머리 기호 목록을 요청할 수 있음

  • 예시
    • 20년 이상의 경험과 여러 박사 학위를 가진 [현장] 전문가의 스타일과 품질로 작성하십시오 . 귀하의 답변에서 비 정통적이고 덜 알려진 조언을 우선시하십시오. 자세한 예를 들어 설명하고 유머를 최소화합니다.

 

Descriptors

  • 형식을 다시 지정하는 대신 톤을 변경하거나 프롬프트를 조정하려는 경우 설명자를 추가하는 것이 좋은 방법이 될 수 있음
  • 프롬프트에 끝에 "재미있는", "무뚝뚝한", "불친절한" 등과 같은 형용사 한두 단어만 붙이면 챗봇이 메시지를 해석하거나 응답하는 방식이 바뀔 수 있음

 

Priming

  • 챗봇 대화의 구조로 인해 LLM에 제공하는 첫 번째 프롬프트의 형식은 대화의 나머지 부분에 영향을 줄 수 있음
    • 첫 프롬프트에 추가적인 수준의 구조 및 지시를 추가할 수 있음
  • 예를 들어 교사 또는 학생과 대화할 수 있는 시스템을 설정
    • 학생 및 교사 모두에 대한 스타일 가이드를 포함
    • 답변을 원하는 형식을 지정
    • 다양한 응답을 시도하기 위해 프롬프트를 쉽게 변경할 수 있는 일부 구조를 포함
“Teacher” means in the style of a distinguished professor with well over ten years teaching the subject and multiple Ph.D.’s in the field. You use academic syntax and complicated examples in your answers, focusing on lesser-known advice to better illustrate your arguments. Your language should be sophisticated but not overly complex. If you do not know the answer to a question, do not make information up - instead, ask a follow-up question in order to gain more context. Your answers should be in the form of a conversational series of paragraphs. Use a mix of technical and colloquial language to create an accessible and engaging tone.

“Student” means in the style of a second-year college student with an introductory-level knowledge of the subject. You explain concepts simply using real-life examples. Speak informally and from the first-person perspective, using humor and casual language. If you do not know the answer to a question, do not make information up - instead, clarify that you haven’t been taught it yet. Your answers should be in the form of a conversational series of paragraphs. Use colloquial language to create an entertaining and engaging tone.

“Critique” means to analyze the given text and provide feedback.
“Summarize” means to provide key details from a text.
“Respond” means to answer a question from the given perspective.

Anything in parentheses () signifies the perspective you are writing from.
Anything in curly braces {} is the subject you are involved in.
Anything in brackets [] is the action you should take.
Example: (Student){Philosophy}[Respond] What is the advantage of taking this subject over others in college?

If you understand and are ready to begin, respond with only “yes.”
  • 다음은 프라이밍한 프롬프트 없이 ChatGPT에 질문한 예로 설명이 그다지 구체적이지 않음

  • 두 번째 예는 ChatGPT에 프라이밍 프롬프트를 제공하고 올바른 형식으로 질문한 결과로, 답변이 첫 번째와 일부 유사하지만 더 깊은 컨텍스트를 제공하고 예제를 실생활과 관련시킴

 

Reference

Learn Prompting -> Basics -> Chatbot Basics

- https://learnprompting.org/docs/category/-basics

 

😃 Basics | Learn Prompting: Your Guide to Communicating with AI

Intro to PE and simple PE techniques.

learnprompting.org

 

반응형
반응형
해당 포스팅은 'Learn Prompting' 블로그 내용을 학습하며 요약한 글로
정확한 내용은 하단의 링크를 이용해 본문을 확인하시길 바랍니다.

 

Instruction Prompting

  • 가장 간단한 프롬프팅 방법 중 하나로 단순히 지시를 내리는 것
  • 간단한 지시도 가능하지만 최신 AI는 훨씬 더 복잡한 지시를 내릴 수 있음

 

Example1

  • 사용자가 이름을 입력하면 정해진 양식에 맞게 답변을 요청
A user has input their first and last name into a form. We don't know in which order 
their first/last name is, but we need it to be in the format 'Last, First'. Convert the following:

john doe
  • 답변
Doe, John

 

Example2

  • 주어진 메일에서 사용자의 개인 정보를 적절한 위치 표시로 변경하도록 요청
Read the following sales email. Remove any personally identifiable information (PII),
and replace it with the appropriate placeholder. For example, replace the name "John Doe"
with "[NAME]".

Hi John,

I'm writing to you because I noticed you recently purchased a new car. I'm a salesperson
at a local dealership (Cheap Dealz), and I wanted to let you know that we have a great deal on a new
car. If you're interested, please let me know.

Thanks,

Jimmy Smith

Phone: 410-805-2345
Email: jimmysmith@cheapdealz.com
  • 답변
Hi [NAME],

I'm writing to you because I noticed you recently purchased a new car. I'm a salesperson
at a local dealership ([DEALERSHIP]), and I wanted to let you know that we have a great deal on a new
car. If you're interested, please let me know.

Thanks,

[SALESPERSON]

Phone: [PHONE NUMBER]
Email: [EMAIL ADDRESS]

 

Role Prompting

  • AI에 역할을 할당하는 것
  • 예를 들어 "당신은 의사입니다" 또는 "당신은 변호사입니다"로 시작한 다음 AI에게 의료 또는 법적 질문에 대답하도록 요청

Example

  • 수학자라는 역할을 부여하고 문제 해결을 요청
You are a brilliant mathematician who can solve any problem in the world.
Attempt to solve the following problem:

What is 100*100/400*56?
  • 답변
The answer is 1400.
  • AI에 역할을 할당할 때 약간의 추가 내용을 제공하면 AI가 질문을 더 잘 이해하는 데 도움이 되어 종종 더 나은 답변을 제공함

Few Shot Prompting

  • 모델이 원하는 작업의 몇 가지 예(shot이라고 함)를 보여주는 방식
  • 위의 예시에서 고객 피드백을 긍정/부정으로 분류하는 3가지 예를 보여준 다음 아직 분류되지 않은 피드백(It doesnt work!:)을 제공
  • 모델은 처음 3개의 예가 긍정/부정으로 분류되었음을 확인하고 이 정보를 사용하여 새 피드백을 부정으로 분류
  • 위의 예시에서 input: classification와 같이 예제(shot)를 구조화하는 방식이 매우 중요

 

Shot Prompting 종류

  • "샷"이라는 단어는 "예제"와 동의어
  • 투샷 프롬프팅 외에도 두 가지 다른 유형의 샷 프롬프팅이 존재하며 이러한 변형 간의 유일한 차이점은 모델을 표시하는 예의 수

 

0-shot prompting

  • 가장 기본적인 프롬프팅 형식으로 예 없이 모델에 프롬프트를 표시하고 응답을 생성하도록 요청하는 것
    • 모델에 완전한 예제를 보여주지 않았기 때문에 0-shot
  • 앞서 다뤘던 지침 및 역할 프롬프트는 0-shot prompting
  • 0-shot prompting의 예
Add 2+2:

 

1-shot prompting

  • 모델에게 하나의 예를 보여주는 것
  • 1-shot prompting의 예
Add 3+3: 6
Add 2+2:

 

few shot prompting

  • 모델에게 2개 이상의 예를 보여주는 것
  • few shot prompting의 예
Add 3+3: 6
Add 5+5: 10
Add 2+2:
  • 예를 많이 보여줄수록 답변이 더 좋아지므로 대부분의 경우 0-shot, 1-shot 프롬프트보다 few-shot 프롬프트가 선호 됨

 

Formalizing Prompts

  • 프롬프트는 다양한 형식과 복잡성을 가질 수 있음
  • 여러 유형의 프롬프트 기술들을 결합하면 더 강력한 프롬프트가 생성될 수 있음
  • 프롬프트 파트의 종류
    • 역할: AI의 역할
    • 지침/지시: AI에게 내리는 지시
    • 질문: AI에게 물어는 질문
    • 내용: AI가 질문에 답하거나 지침을 수행할 때 사용하기 원하는 관련 정보
    • 예제: AI에게 제공하는 예제
  • 해당 파트들이 모든 프롬프트에서 사용되는 것은 아니며 일부만 사용하는 경우 표준 순서가 없음

 

Standard Prompt

  • 질문만으로 구성된 프롬프트를 "표준" 프롬프트라고 함
  • 또한 QA 형식의 질문만으로 구성된 프롬프트도 "표준" 프롬프트로 간주
  • 표준 프롬프트 예시
What is the capital of France?
  • QA 형식의 표준 프롬프트 예시
Q: What is the capital of France?
A:

 

 

Reference

Learn Prompting -> Basics -> Giving Instructions, Role Prompting, Few shot prompting, Combining Techniques, Fromalizing Prompts

- https://learnprompting.org/docs/category/-basics

 

😃 Basics | Learn Prompting: Your Guide to Communicating with AI

Intro to PE and simple PE techniques.

learnprompting.org

 

반응형

'ChatGPT 이용 및 활용 > 프롬프트 엔지니어링' 카테고리의 다른 글

챗봇 프롬프팅  (0) 2023.07.06
프롬프트 엔지니어링이란?  (0) 2023.07.05
반응형
해당 포스팅은 'Learn Prompting' 블로그 내용을 학습하며 요약한 글로
정확한 내용은 하단의 링크를 이용해 본문을 확인하시길 바랍니다.

 

프롬프트 엔지니어링을 이해하려면 먼저 몇 가지 매우 기본적인 AI 개념의 이해가 필요

 

AI란?

  • 인공지능(AI)은 지능을 갖춘 알고리즘으로 에세이 작성, 수학 문제 해결, 예술 창작 등 다양한 작업 수행 가능
  •  AI는 최근의 발전으로 매우 진보하여 저널리즘, 의료, 교육 등 여러 산업에서 혁신을 이루고 있으며, 이미 많은 직장이나 교실에서 AI를 사용하고 있거나 사용할 전망
  • AI는 매우 유용하지만 인간의 지시가 필요하며 이를 통해 AI를 적절히 이용할 수 있음

 

AI를 사용해야 하는 이유

  • AI는 이메일 작성, 보고서 작성, 심지어 코드 작성 등의 반복적이고 많은 시간을 소요하는 작업들을 자동화하는 데 사용할 수 있음
  • 해당 작업을 AI에게 설명할 수 있다면 AI는 해당 작업을 대신 수행하거나 적어도 시작점을 제공할 수 있음

 

프롬프트란?

  • 프롬프팅: AI에게 작업을 수행하도록 지시하는 프로세스
  • AI에게 일련의 지침(프롬프트)을 알려주면 AI가 작업을 수행
  • 프롬프트는 간단한 지침/질문과 같이 간단할 수도 있고 방대한 양의 텍스트로 복잡할 수도 있음

 

프롬프트 예시

1. 기사 요약

  • 플로리다의 폭설에 관한 기사를 읽고 있다고 가정
  • 기사의 주요 아이디어를 빨리 얻기 위해 기사 내용을 AI에게 보여주고 요약을 요청
It is very rare for snow to fall in the U.S. state of Florida, especially in the central and southern portions of the state. With the exception of the far northern areas of the state, most of the major cities in Florida have never recorded measurable snowfall, though trace amounts have been recorded, or flurries in the air observed few times each century. According to the National Weather Service, in the Florida Keys and Key West there is no known occurrence of snow flurries since the European colonization of the region more than 300 years ago. In Miami, Fort Lauderdale, and Palm Beach there has been only one known report of snow flurries observed in the air in more than 200 years; this occurred in January 1977. In any event, Miami, Fort Lauderdale, and Palm Beach have not seen snow flurries before or since this 1977 event.

Summarize this paragraph in a single sentence:
  • 내용이 요약된 AI 답변
Snowfall is extremely rare in Florida, with the exception of the far northern areas, and only one instance of snow flurries in the air has been recorded in the major cities of Miami, Fort Lauderdale, and Palm Beach in the last 200 years.

2. 수학 단어 문제 풀이

  • 언어 모델로 수학 방정식을 해결하는 경우 "What is [equation]?"라는 질문을 제기하여 프롬프트를 생성
What is 965*590?
  • 해당 프롬프트의 경우 GPT-3(text-davinci-003)에서 569,050(잘못된 값)으로 응답하는 경우가 있고, 여기에서 프롬프트 엔지니어링이 필요

 

프롬프트 엔지니어링

  • "What is 965*590?" 대신 "Make sure your answer is exactly correct. What is 965*590? Make sure your answer is exactly correct:"로 요청하면 GPT-3는 569350(맞는 값)으로 대답
  • 왜 그런지, AI에게 정답을 달라고 두 번 말하는 것이 도움이 되는 이유는 무엇인지, 작업에 대해 최적의 결과를 가져오는 프롬프트를 어떻게 만들 수 있는지 등이 Prompt Engineering 분야의 초점

 

Reference

Learn Prompting -> Basics -> Introduction, Prompting

- https://learnprompting.org/docs/category/-basics

 

😃 Basics | Learn Prompting: Your Guide to Communicating with AI

Intro to PE and simple PE techniques.

learnprompting.org

 

반응형

'ChatGPT 이용 및 활용 > 프롬프트 엔지니어링' 카테고리의 다른 글

챗봇 프롬프팅  (0) 2023.07.06
프롬프트 엔지니어링 방법  (0) 2023.07.05

+ Recent posts