การอธิบายโมเดล AI เชิงสร้างสรรค์แบบแชท

Explainable AI ด้วย Python

Fouad Trad

Machine Learning Engineer

โมเดล AI เชิงสร้างสรรค์แบบแชท

  • ใช้สำหรับสร้างข้อความ
  • ทำนายผลจากบริบทและความรู้

 

ภาพแสดงผู้ใช้ส่ง prompt ให้โมเดล AI เชิงสร้างสรรค์และรับการตอบกลับ

Explainable AI ด้วย Python

Chain-of-thought prompt

  • กระตุ้นให้โมเดลอธิบายกระบวนการคิดทีละขั้นตอน

ภาพแสดงวิธีที่ chain-of-thought prompt ให้โมเดลแก้ปัญหาทีละขั้น และผลลัพธ์ประกอบด้วยเหตุผลของแต่ละขั้นตอน

Explainable AI ด้วย Python

การสร้าง chain-of-thought prompt

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.
Explainable AI ด้วย Python

Self-consistency

ประเมินความมั่นใจของโมเดลในคำตอบที่สร้างขึ้น

ภาพแสดงว่า self-consistency prompt คือการส่ง prompt เดิมซ้ำหลายครั้ง โดยแต่ละครั้งโมเดลจะให้คำตอบ

Explainable AI ด้วย Python

Self-consistency ในการจำแนกประเภทข้อความ

เหมาะสำหรับงานจำแนกประเภทข้อความ

ภาพแสดงตัวอย่าง self-consistency ที่โมเดลต้องจำแนกรีวิวของผู้ใช้ว่าเป็นเชิงบวกหรือเชิงลบ และโมเดลให้คำตอบหลายรายการ

Explainable AI ด้วย Python

Self-consistency ในการจำแนกประเภทข้อความ

เหมาะสำหรับงานจำแนกประเภทข้อความ

ภาพแสดงตัวอย่าง self-consistency ที่โมเดลต้องจำแนกรีวิวว่าเป็นเชิงบวกหรือเชิงลบ โดยคำนวณค่าความมั่นใจเป็นสัดส่วนของแต่ละหมวดหมู่ต่อจำนวนคำตอบทั้งหมด

Explainable AI ด้วย Python

การสร้าง self-consistency prompt

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) }
Explainable AI ด้วย Python

การสร้าง self-consistency prompt

print(confidence)
{
    'positive': 0.6,
    'negative': 0.4
}
Explainable AI ด้วย Python

มาฝึกกันเถอะ!

Explainable AI ด้วย Python

Preparing Video For Download...