GPT-3 Parameters and Prompt Design

하나·2023년 3월 10일
1

TIL

목록 보기
14/14
post-thumbnail

Engine

예측에 사용될 인공지능 모델

Max tokens

모델이 생성할 수 있는 최대 토큰 수 (일반적으로 1개의 토큰은 약 4자)

Temperature

확률로 매핑되기 전 모델은 정규화되지 않은 값 (logit)을 출력. 로짓은 일반적으로 소프트맥스와 같은 함수와 함께 사용되어 확률로 변환 됨.

소프트 맥스 함수 적용 전에 열역학에 영감을 받은 트릭을 사용하여 temperature 매개변수로 로짓을 조정할 수 있음. 즉 softmax(logits/temperature).

temperature 가 1에 가까우면 로짓은 수정 없이 소프트 맥스를 통과하고 0에 가까울수록 다른 토큰에 비해 가장 확률이 높은 토큰이 매우 가능해지며, 모델은 더 결정론적이고 일련의 단어 시퀀스 후 항상 같은 토큰 집합을 출력.

0과 1 사이로 조절하여 모델의 예측의 무작위성과 창의성을 제어할 수 있음.

top p

추론 시 샘플링 임계값을 지정. top p sampling (nucleus sampling 이라고도함) 모델의 가능한 결과를 샘플링하는데 사용.

“나는 먹고 싶다”라는 문장 다음 토큰을 예측해야 한다고 가정하면

당근 (2% likely)

오이 (1.5% likely)

가지 (1% likely)

이 단어 집합의 확률 분포는 “P( Word | “I want to eat“)”을 형성하여 누적분포함수(CDF)는

당근 (2%)

당근과 오이 (3.5%)

당근,오이,가지 (4.5%)

만약 우리가 top p 변수를 3.5 로 설정하면 모델은 당근과 오이 사이에서 무작위로 선택하고 그들의 가능성에 따라 샘플링한다. Top p 가 4.5%인 경우, 모델은 당근, 오이, 가지 중 하나를 무작위로 선택함.

temperature 와 마찬가지로, top p 매개 변수는 모델의 무작위성과 독창성을 조절

OpenAI 문서는 둘 중 하나의 매개 변수를 사용하거나 사용하지 않는 매개 변수를 중립적인 상황(즉, 1.0)으로 설정하는 것을 권장함.

Frequency penalty

Frequency penalty 매개 변수는 모델이 예측을 반복하는 경향을 제어. 이미 생성된 단어의 확률을 낮춤. penalty는 예측에서 단어가 이미 몇 번 발생했는지에 따라 달라짐.

Presence penalty

Presence penalty 매개 변수는 모델이 새로운 예측을 만들도록 유도. 이미 예측된 텍스트에 단어가 나타난 경우 해당 단어의 확률을 낮춤. Frequency penalty와 달리, presence penalty는 과거 예측에서 단어가 나타난 빈도에 따라 달라지지 않음.

Grammar correction

Engine: text-davinci-002
Max tokens: 60
Temperature: 0
Top p: 1.0
Frequency penalty: 0.0
Presence penalty: 0.0

### prompt
Correct this to standard English: I’m looking forward to see you

### response
I’m looking forward to seeing you.

Idea generator

Engine: text-davinci-002
Max tokens: 150
Temperature: 0.6
Top p: 1.0
Frequency penalty: 1
Presence penalty: 1

### prompt
come up with ideas for a new product that is environmentally friendly:

### response
1. A reusable water bottle that can be refilled from the tap. 
2. A reusable shopping bag made from recycled materials. 
3. A solar-powered cell phone charger. 
4. An LED light bulb that lasts for years and consumes very little energy.

### prompt
brainstorm solutions to increase sales at your store:

### response
1. Offer discounts or coupons. 
2. Host a sale or clearance event. 
3. Create an attractive window display. 
4. Place items on end caps or near the register. 
5. Train staff to upsell and cross-sell products. 
6. Implement a loyalty program. 
7. Send out direct mailers or emails. 
8. Place ads in local publications. 
9. Sponsor a community event. 
10. Get involved with social media marketing

summarization

Engine: text-davinci-002
Max tokens: 60
Temperature: 0.7
Top p: 1.0
Frequency penalty: 0.0
Presence penalty: 0.0

### prompt

Technology has always been a boon for writers and students struggling with grammar. In the past, we had spell checkers and grammar checkers to help us catch mistakes. But now, even GPT-3 can do the work and catch errors.
This can be especially helpful for those who are non-native English speakers or who have difficulty with grammar.
Tl;dr

### response
If you’re struggling with your grammar, consider using an AI-powered grammar checker to help you improve your writing.

### prompt
Technology has always been a boon for writers and students struggling with grammar. In the past, we had spell checkers and grammar checkers to help us catch mistakes. But now, even GPT-3 can do the work and catch errors. This can be especially helpful for those who are non-native English speakers or who have difficulty with grammar. 
Summary:

### response
Technology has always been a boon for writers and students struggling with grammar. In the past, we had spell checkers and grammar checkers to help us catch mistakes. But now, even GPT-3 can do the work and catch errors.

reference : https://towardsdatascience.com/gpt-3-parameters-and-prompt-design-1a595dc5b405

0개의 댓글