Code&Data Insights

[Prompt Engineering] What Is Prompt Engineering? | Prompt Engineering Basic Principles 본문

Artificial Intelligence/Prompt Engineering

[Prompt Engineering] What Is Prompt Engineering? | Prompt Engineering Basic Principles

paka_corn 2024. 3. 23. 15:38

What Is Prompt Engineering? 

프롬프트 엔지니어링은 AI 모델, 특히 LLM을 원하는 결과로 유도하기 위해 정교하게 설계된 질문이나 지시를 만드는 과정.

원하는 결과물을 얻기 위해 프롬프트를 최적화하는 기술 

 

Prompt engineering is essential for enhancing AI-powered services and maximizing the output of existing generative AI tools. 

 

Powerful prompts lead to 

=> Optimize the response of generative AI models

=> Power lies in the questions we ask

=> Write a prompt that is effective and direct

 

What is a prompt? 

: an input that produces the desired output

원하는 결과를 도출할 수 있는 인풋 

 

How to be a well-constructed prompt?

=> Building blocks! -> instruction, context, input data, ouput indicators

 

                                                                                                           

 

 

Prompt Engineering Basic Principles

1) Specificity & Clarity - 구체성 & 명확성

- Clear Instructions & Clear Requirements & Clear Goals

LLM은 답변을 생성할 때 바로 다음 나올 단어를 (통계적으로) 예측하여 문장을 생성하기 때문에 

구체적이고 상세한 프롬프트를 입력해야 내가 원하는 키워드와 내용에 대한 확률이 올라가서 원하는 답변을 받을 확률이 높아짐

불필요하거나 모호한 요소들이 많고, 너무 많은 요구사항이 있으면, 좋은 답변을 얻을 수 없다! 

 

 

2) Providing/Elaborating Context & In-context Learning - 문맥이해 

AI는 입력된 데이터를 기반으로 학습하고 문맥을 이해하여 답변을 생성

프롬프트를 작성할때도 이를 고려하여 원하는 답변이 AI의 데이버 베이스에 존재하는지 여부를 파악하고 활용해야 함

* Fine Tuning(파인튜닝- 언어 모델에 좋은 예시를 넣는 것)

 

 

3) 알고리즘 (논리적 사고) 

내가 원하는 문제해결이나 목표를 먼저 알고리즘화하여 분석하고, 순서에 따라서 단계적으로 AI 모델이 생각하도록 유도하는 프롬프트를 작성해야 한다. 

- 분해, 추상화, 패턴인식, 알고리즘

* 명확성 & 수행 가능성 & 효율성 * 

 

 

4) Consistency/Continuous Learning - 일관적이고 지속적인 학습

지속적인 학습은 사용자 피드백을 기반으로 프롬프트를 정제하고 프롬프트 엔지니어링 과정에 개선 사항을 통합하는 것

=> 반복적인 접근 방식은 시간이 지남에 따라 모델의 성능을 지속적으로 향상시킴 

 

 

 

5) Role-Play / Persona Pattern - 롤플레잉

 

 

 

 

Reference

https://www.geeksforgeeks.org/chatgpt-prompt-engineering-principles/

https://metamind.kr/memory-note-view/?note=900&pid=2

https://www.geeksforgeeks.org/roadmap-of-becoming-a-prompt-engineer/

Comments