대화형 생성 AI 모델 설명

Python으로 배우는 Explainable AI

Fouad Trad

Machine Learning Engineer

대화형 생성 AI 모델

  • 텍스트 생성에 사용됨
  • 문맥과 지식에 기반해 예측함

 

사용자가 생성 AI 모델에 프롬프트를 보내고 응답을 받는 장면을 보여주는 이미지.

Python으로 배우는 Explainable AI

연쇄적 사고(Chain-of-thought) 프롬프트

  • 모델이 추론 과정을 서술하도록 유도

연쇄적 사고 프롬프트가 문제를 단계별로 풀도록 요청하고, 출력에 각 단계의 추론이 포함됨을 보여주는 이미지.

Python으로 배우는 Explainable AI

연쇄적 사고 프롬프트 만들기

prompt = """A shop starts with 20 apples. It sells 5 apples and then receives 8 more. 
How many apples does the shop have now? Show your reasoning step-by-step."""

response = get_response(prompt)
print(response)
To find out how many apples the shop has now, let's follow the transactions step-by-step:

1- The shop begins with 20 apples.
2- The shop sells 5 apples. We subtract this number from the starting quantity: 20 - 5 = 15
3- The shop receives 8 apples. We add this number to the remaining apples: 15 + 8 = 23
So, after these transactions, the shop has 23 apples.
Python으로 배우는 Explainable AI

자기 일관성

생성 답변의 신뢰도를 평가함

동일한 프롬프트를 여러 번 보내 각기 응답을 받아 자기 일관성을 확인하는 과정을 보여주는 이미지.

Python으로 배우는 Explainable AI

텍스트 분류에서의 자기 일관성

텍스트 분류 작업에 유용함

모델이 사용자 리뷰를 긍정/부정으로 분류하며 여러 응답을 제공하는 자기 일관성 예시 이미지.

Python으로 배우는 Explainable AI

텍스트 분류에서의 자기 일관성

텍스트 분류 작업에 유용함

모델이 사용자 리뷰를 긍정/부정으로 분류하고 여러 응답을 제공하는 자기 일관성 예시 이미지. 신뢰도는 각 범주 응답 수를 전체 응답 수로 나눈 비율로 계산됨.

Python으로 배우는 Explainable AI

자기 일관성 프롬프트 만들기

prompt = """Classify the following review as positive or negative. 
You should reply with either "positive" or "negative", nothing else.
Review: 'The customer service was great, but the product itself did not meet my expectations.'"""

responses = []
for i in range(5): sentiment = get_response(review)
responses.append(sentiment.lower())
confidence = { 'positive': responses.count('positive') / len(responses), 'negative': responses.count('negative') / len(responses) }
Python으로 배우는 Explainable AI

자기 일관성 프롬프트 만들기

print(confidence)
{
    'positive': 0.6,
    'negative': 0.4
}
Python으로 배우는 Explainable AI

연습해 봅시다!

Python으로 배우는 Explainable AI

Preparing Video For Download...