openAI 공식 프롬프트 엔지니어링 가이드
Six strategies for getting better results
1. Write clear instructions
- Tactic: Include details in your query to get more relevant answers
- Tactic: Ask the model to adopt a persona
role 기능 쓰면 되는 ㄷㅡㅅ
- Tactic: Use delimiters to clearly indicate distinct parts of the input
triple quotation marks, XML tags, section titles, etc.
- Tactic: Specify the steps required to complete a task
step 1, blahblah
step2, blah
cot 차근차근생각해보세
- Tactic: Provide examples
퓨샷~
- Tactic: Specify the desired length of the output
~in about 50 words.
~in 2 paragraphs.
~in 3 bullet points.
2. Provide reference text
Confidently invent fake answers!!
할루시네이션 해결
providing reference text to these models can help in answering with fewer fabrications
rag 기본 원리인듯
- Tactic: Instruct the model to answer using a reference text
Use the provided articles~~<article>
- Tactic: Instruct the model to answer with citations from a reference text
Use the following format for to cite relevant passages ({"citation": …}).
3. Split complex tasks into simpler subtasks
- Tactic: Use intent classification to identify the most relevant instructions for a user query
For tasks in which lots of independent sets of instructions are needed to handle different cases\
=> defining fixed categories and hardcoding instructions
=> each query will contain only those instructions
- Tactic: For dialogue applications that require very long conversations, summarize or filter previous dialogue
컨텍스트 윈도우 제한 고려 서머라이즈 진행하기
- Tactic: Summarize long documents piecewise and construct a full summary recursively
재귀적 진행
https://openai.com/index/summarizing-books/
책의 특정 지점 앞의 텍스트에 대한 실행 요약을 포함하면서 해당 지점의 내용을 요약
4. Give the model time to "think"
Asking for a "chain of thought" before an answer can help the model reason its way toward correct answers more reliably.
cot 기본 원리
신기.. AI도 급하게 생각하면 정확도 떨어짐
- Tactic: Instruct the model to work out its own solution before rushing to a conclusion
=> Determine if the student's solution is correct or not. (틀림)
=> First work out your own solution to the problem. Then compare your solution to the student's solution and evaluate if the student's solution is correct or not. Don't decide if the student's solution is correct until you have done the problem yourself. (맞음)
- Tactic: Use inner monologue or a sequence of queries to hide the model's reasoning process
important for the model to reason in detail about a problem before answering a specific question!!(이전 택틱)
그런데 이거 inappropriate to share with the user일 수 있음
=> Inner monologue is a tactic that can be used to mitigate this
와 이거 좋다 맨날 백준 문제 모르겠을 때 힌트만 얻고 싶어서 힌트만 달라고 하면 줄줄 답 불어서 실눈뜨고 읽었는데(소용없다이제 내적 독백 프엔링 쓴다
- Tactic: Ask the model if it missed anything on previous passes
내용이 길어서 모델이 일찍 중지하는 경우
prompting the model with followup queries to find any excerpts it missed on previous passes
마지막 부분에 놓친거없냐?있으면안됨 같은 거
5. Use external tools
- Tactic: Use embeddings-based search to implement efficient knowledge retrieval
= RAG 써라
external sources of information
임베딩~ 벡터 디비 써서 추가검색진행하라
- Tactic: Use code execution to perform more accurate calculations or call external APIs
모델은 arithmetic or long calculations 잘 못해
파이썬 쓰라고 하거나~
- Tactic: Give the model access to specific functions
function calling 기능?
https://platform.openai.com/docs/guides/function-calling
써보기
6. Test changes systematically
어떤 변경사항이 시스템을 더 나아지게 만드는지 또는 더 나빠지게 만드는지를 판단하기가 어렵
어떻게 하란 거죠
- Tactic: Evaluate model outputs with reference to gold-standard answers
gold-standard answers(모범 답안) 참고하기
모델 품질 평가 예시
일단 오키
프롬프트 예시
공식 문서에서 제공하는 프롬프트 예시
다양한 예시가 있고..
랩 배틀 예시로 앨런 튜닝과 클로드 섀넌의 벌스가 주어져 있다.
?
openai 재밌게 노네..
'🤖 AI > AI' 카테고리의 다른 글
🔬말 잘 듣는 모델 만들기 1 : 미세 조정 (0) | 2025.01.10 |
---|---|
✍️ OpenAI Cookbook : Prompting libraries & tools & guides 구경 (0) | 2025.01.09 |
🔣 openai api 인자 : logprobs (0) | 2025.01.09 |
🔬트랜스포머 모델을 다루기 위한 허깅페이스 트랜스포머 라이브러리 3 (0) | 2025.01.07 |
🔬트랜스포머 모델을 다루기 위한 허깅페이스 트랜스포머 라이브러리 2 (0) | 2025.01.07 |