ChatGPT เป็น LLM ระดับ Advance มันจะพยายามอย่างที่สุดที่จะตอบคำถามที่เราป้อนให้ จากข้อมูลมหาศาลที่มันถูกเทรนมา อย่างไรก็ตามมันไม่มีข้อมูลความรู้จากโลกความเป็นจริงที่เป็นปัจจุบัน ไม่สามารถเข้าใจบริบทอื่น ๆ นอกจากที่อยู่ในใน Training Data ดังนั้นเมื่อเราถามคำถาม หรือสั่งอะไรที่เป็นไปไม่ได้ บางทีมันจะสร้างคำตอบที่ฟังดูดี แต่อาจจะไม่เป็นความจริง ตอบกลับมาให้เราได้ ทางแก้ก็คือเราควรรู้เท่าทัน เข้าใจว่ามันคือ โปรแกรมคอมพิวเตอร์โปรแกรมหนึ่ง ซึ่งมีข้อจำกัด ไม่สามารถรู้ทุกอย่าง ไม่สามารถทำได้ทุกอย่าง ไม่สามารถทำสิ่งที่เป็นไปไม่ได้ให้เป็นไปได้ และสั่งให้มันตรวจเช็คเงื่อนไขที่จำเป็นก่อนทำงาน ไม่ได้ก็ตอบว่าไม่ได้ตรง ๆ

เทคนิคที่ 3 สั่งให้ AI ตรวจเช็คเงื่อนไขที่จำเป็น ก่อนทำงาน

ใน Prompt Engineering การสั่งให้โมเดลตรวจสอบเงื่อนไขที่จำเป็นก่อนเริ่มงาน มีวัตถุประสงค์ 2 ประการ คือ ประการแรก ช่วยให้เราแน่ใจว่าโมเดล LLM จะโฟกัสที่ข้อมูลที่เกี่ยวข้องกับเงื่อนไขเท่านั้น และใช้ข้อมูลเหล่านั้นมาตัดสินใจ สร้างคำตอบ

In Spotlight. Gegenlicht Credits to “marfis75 on flickr”

ด้วยการสั่งการให้โมเดลเช็ค Precondition เงื่อนไขที่จำเป็น เราสามารถ Prompt ให้โมเดล คิด วิเคราะห์ แยกแยะ ปัจจัยที่มีผลต่อคำตอบ เป็นการช่วยลดความผิดพลาดและหลีกเลี่ยงการที่โมเดล Bias ไปเอาข้อมูลอะไรก็ไม่รู้ แต่อาจจะมี Pattern บางอย่างคล้ายกันมาตอบ ยิ่งไปกว่านั้น ใส่การเช็คเงื่อนไขไว้ใน Prompt ทำให้เราได้ผลลัพท์ที่แม่นยำ และเชื่อถือได้มากขึ้น

ประการที่สอง การสั่งให้โมเดล LLM เช็คสมมติฐาน และพิจารณาเงื่อนไขที่เกี่ยวข้อง ช่วยให้เราเข้าใจการทำงานของโมเดลมากขึ้น ในสถานะการณ์ต่าง ๆ โดยทั่วไปโมเดล LLM ให้คำตอบจากสมมติฐานที่มันตั้งขึ้น และการ Generalization ด้วยการ Pattern Matching กับเคสต่าง ๆ ในข้อมูลใน Training Set มหาศาลที่มันถูกเทรนมา แต่สมมติฐานเหล่านั้นก็ไม่ได้เป็นจริงเสมอไป

ตัวอย่างการสั่ง แบบไม่ได้เช็ค

เราสั่งให้ลิสต์ ชื่อทีมฟุตบอล 10 ทีมที่อยู่ในข่าว โมเดลก็จะตั้งสมมุติฐานว่า ในข้อความข่าว ที่คั่นด้วย backtick ต้องมี 10 ทีม แน่ ๆ

List the names of 10 soccer teams mentioned in the text. The text is delimited by triple backticks.

```
Real Madrid are in advanced talks with Borussia Dortmund to sign England midfielder Jude Bellingham for more than 100m euros.

The 19-year-old, who joined Dortmund from Birmingham City in July 2020, was one of England's top performers at last year's World Cup.

Real are willing to pay around 100m euros for Bellingham but Dortmund are understood to want 150m euros.

Bellingham has been linked with some of Europe's top sides.

Real are confident the midfielder - who has turned down a contract offer to stay at Dortmund - wants to join them but Manchester City are still interested too.

Bellingham has played 40 times for his club this season - scoring 11 goals and registering seven assists.
```

ระบบตอบมา 10 ทีม แต่ทีมท้าย ๆ เป็นทีมชื่อแปลก ๆ

1. Real Madrid
2. Borussia Dortmund
3. Birmingham City
4. England
5. World Cup
6. Europe
7. Manchester City
8. Dortmund
9. midfielder
10. club

ตัวอย่างการสั่ง แบบเช็คเงื่อนไข

คราวนี้เราจะสั่งให้เช็คก่อน ถ้ามีไม่ถึง 10 ก็เอาเท่าที่ได้ก็พอ

List the names of 10 teams mentioned in the text. The text is delimited by triple backticks.
Check if there are fewer than 10 teams, just respond with what we have.

```
Real Madrid are in advanced talks with Borussia Dortmund to sign England midfielder Jude Bellingham for more than 100m euros.

The 19-year-old, who joined Dortmund from Birmingham City in July 2020, was one of England's top performers at last year's World Cup.

Real are willing to pay around 100m euros for Bellingham but Dortmund are understood to want 150m euros.

Bellingham has been linked with some of Europe's top sides.

Real are confident the midfielder - who has turned down a contract offer to stay at Dortmund - wants to join them but Manchester City are still interested too.

Bellingham has played 40 times for his club this season - scoring 11 goals and registering seven assists.
```


โมเดลจะทำงานได้ถูกต้อง

1. Real Madrid
2. Borussia Dortmund
3. Birmingham City
4. England national team
5. Manchester City
6. Europe's top sides (not a specific team)
7.
Engine check light on a VW Bora indicating a fault in the engine management system. Credit: https://commons.wikimedia.org/wiki/File:Vw_engine_check.jpg
Engine check light on a VW Bora indicating a fault in the engine management system. Credit: https://commons.wikimedia.org/wiki/File:Vw_engine_check.jpg

ด้วยการสั่งให้ตรวจสอบสมมติฐานเหล่านี้ก่อนนำมาใช้ หมายถึงเรากำลัง Prompt Engineering ให้โมเดลคำนึงถึงข้อจำกัด และขอบเขตของปัญหา ซึ่งจะนำไปสู่ความเข้าใจปัญหาที่ลึกซึ้งมากขึ้น เปิดโอกาสให้โมเดลรับมือกับสถานการณ์ปัญหาต่าง ๆ ได้อย่างมีประสิทธิภาพ ตัดสินใจได้แฟร์มากขึ้น

เรามาเริ่มกันเลยดีกว่า

Open In Colab

Credit

แชร์ให้เพื่อน:

Surapong Kanoktipsatharporn on FacebookSurapong Kanoktipsatharporn on LinkedinSurapong Kanoktipsatharporn on Rss
Surapong Kanoktipsatharporn
Solutions Architect at Bua Labs
The ultimate test of your knowledge is your capacity to convey it to another.

Published by Surapong Kanoktipsatharporn

The ultimate test of your knowledge is your capacity to convey it to another.