ส่วนก่อนหน้านี้ได้แนะนำตัวอย่างพื้นฐานของวิธีการแจ้ง LLM
ส่วนนี้จะให้ตัวอย่างเพิ่มเติมเกี่ยวกับวิธีใช้พร้อมท์เพื่อให้บรรลุงานต่างๆ และแนะนำแนวคิดหลักไปพร้อมกัน บ่อยครั้ง วิธีที่ดีที่สุดในการเรียนรู้แนวคิดคือการดูตัวอย่าง ตัวอย่างด้านล่างนี้แสดงให้เห็นว่าคุณสามารถใช้ข้อความแจ้งที่ได้รับการออกแบบมาอย่างดีเพื่อทำงานประเภทต่างๆ ได้อย่างไร
งานมาตรฐานอย่างหนึ่งในการสร้างภาษาธรรมชาติคือการสรุปข้อความ การสรุปข้อความอาจมีรสชาติและโดเมนที่แตกต่างกันมากมาย อันที่จริง หนึ่งในการประยุกต์ใช้โมเดลภาษาที่น่ามีแนวโน้มมากที่สุดก็คือความสามารถในการสรุปบทความและแนวคิดให้เป็นบทสรุปที่อ่านง่ายและรวดเร็ว มาลองงานสรุปพื้นฐานโดยใช้พร้อมท์กัน
สมมติว่าคุณสนใจที่จะเรียนรู้เกี่ยวกับยาปฏิชีวนะ คุณสามารถลองใช้ข้อความแจ้งดังนี้:
Prompt:
Explain antibiotics
A:
Output:
Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.
"A:" เป็นรูปแบบข้อความที่ชัดเจนที่คุณใช้ในการตอบคำถาม คุณใช้มันที่นี่เพื่อบอกโมเดลว่ามีคำตอบที่คาดหวังเพิ่มเติม ในตัวอย่างนี้ ยังไม่ชัดเจนว่าสิ่งนี้มีประโยชน์อย่างไรกับการไม่ใช้ แต่เราจะคงไว้เช่นนั้นไว้สำหรับตัวอย่างในภายหลัง สมมติว่านี่เป็นข้อมูลมากเกินไปและคุณต้องการสรุปเพิ่มเติม ที่จริงแล้ว คุณสามารถสั่งให้โมเดลสรุปเป็นประโยคเดียวได้ดังนี้:
Prompt:
Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.
Explain the above in one sentence:
Output:
Antibiotics are medications used to treat bacterial infections by either killing the bacteria or stopping them from reproducing, but they are not effective against viruses and overuse can lead to antibiotic resistance.
แบบจำลองพยายามสรุปย่อหน้าในประโยคเดียวโดยไม่ให้ความสำคัญกับความถูกต้องของผลลัพธ์ด้านบนมากเกินไป ซึ่งเป็นสิ่งที่เราจะกล่าวถึงในคำแนะนำในภายหลัง คุณสามารถฉลาดได้ด้วยคำแนะนำ แต่เราจะทิ้งไว้ในบทต่อ ๆ ไป อย่าลังเลที่จะหยุดที่นี่และทดลองเพื่อดูว่าคุณจะได้ผลลัพธ์ที่ดีขึ้นหรือไม่
แม้ว่าโมเดลภาษาจะได้รับการฝึกให้ดำเนินการสร้างภาษาธรรมชาติและงานที่เกี่ยวข้อง แต่ก็ยังสามารถดำเนินการจำแนกประเภทและงานการประมวลผลภาษาธรรมชาติ (NLP) อื่นๆ ได้อีกมากมาย
นี่คือตัวอย่างของพร้อมท์ที่ดึงข้อมูลจากย่อหน้าที่กำหนด
Prompt:
Author-contribution statements and acknowledgements in research papers should state clearly and specifically whether, and to what extent, the authors used AI technologies such as ChatGPT in the preparation of their manuscript and analysis. They should also indicate which LLMs were used. This will alert editors and reviewers to scrutinize manuscripts more carefully for potential biases, inaccuracies and improper source crediting. Likewise, scientific journals should be transparent about their use of LLMs, for example when selecting submitted manuscripts.
Mention the large language model based product mentioned in the paragraph above:
Output:
The large language model based product mentioned in the paragraph above is ChatGPT.
คุณสามารถปรับปรุงผลลัพธ์ข้างต้นได้หลายวิธี แต่วิธีนี้มีประโยชน์มากอยู่แล้ว
ถึงตอนนี้ ควรจะชัดเจนว่าคุณสามารถขอให้โมเดลทำงานต่างๆ ได้โดยเพียงแค่สั่งให้โมเดลทำอะไร นั่นคือความสามารถอันทรงพลังที่นักพัฒนาผลิตภัณฑ์ AI ใช้อยู่แล้วเพื่อสร้างผลิตภัณฑ์และประสบการณ์อันทรงพลัง
แหล่งที่มาของย่อหน้า: ChatGPT: ลำดับความสำคัญห้าประการสำหรับการวิจัย
หนึ่งในวิธีที่ดีที่สุดในการทำให้โมเดลตอบกลับด้วยคำตอบที่เฉพาะเจาะจงคือการปรับปรุงรูปแบบของพรอมต์ ตามที่กล่าวไว้ก่อนหน้านี้ พร้อมท์อาจรวมคำแนะนำ บริบท ตัวบ่งชี้อินพุตและเอาต์พุตเพื่อให้ได้ผลลัพธ์ที่ดีขึ้น แม้ว่าองค์ประกอบเหล่านี้จะไม่จำเป็น แต่ก็กลายเป็นแนวทางปฏิบัติที่ดีเพราะยิ่งคุณเจาะจงคำสั่งมากเท่าไร ผลลัพธ์ก็จะยิ่งดีขึ้นเท่านั้น ด้านล่างนี้คือตัวอย่างลักษณะที่ปรากฏหลังจากพร้อมท์ที่มีโครงสร้างมากขึ้น
Prompt:
Answer the question based on the context below. Keep the answer short and concise. Respond "Unsure about answer" if not sure about the answer.
Context: Teplizumab traces its roots to a New Jersey drug company called Ortho Pharmaceutical. There, scientists generated an early version of the antibody, dubbed OKT3. Originally sourced from mice, the molecule was able to bind to the surface of T cells and limit their cell-killing potential. In 1986, it was approved to help prevent organ rejection after kidney transplants, making it the first therapeutic antibody allowed for human use.
Question: What was OKT3 originally sourced from?
Answer:
Output:
Mice.
บริบทที่ได้รับจากธรรมชาติ
จนถึงตอนนี้ คุณได้ใช้คำแนะนำง่ายๆ ในการปฏิบัติงานแล้ว ในฐานะวิศวกรที่มีความพร้อม คุณจะต้องให้คำแนะนำที่ดีขึ้น แต่นั่นไม่ใช่ทั้งหมด! นอกจากนี้ คุณจะพบว่าสำหรับกรณีการใช้งานที่ยากขึ้น เพียงแค่ให้คำแนะนำไม่เพียงพอ ที่นี่คุณจะต้องคิดให้มากขึ้นเกี่ยวกับบริบทและองค์ประกอบต่างๆ ที่คุณสามารถใช้ในข้อความแจ้งได้ องค์ประกอบอื่นๆ ที่คุณสามารถระบุได้คือ input data หรือ examples
เรามาลองสาธิตสิ่งนี้โดยยกตัวอย่างการจัดหมวดหมู่ข้อความ
Prompt:
Classify the text into neutral, negative or positive.
Text: I think the food was okay.
Sentiment:
Output:
Neutral
คุณให้คำแนะนำในการจำแนกข้อความและโมเดลตอบกลับด้วย 'Neutral' ซึ่งถูกต้อง ไม่มีอะไรผิดปกติในเรื่องนี้ แต่สมมติว่าสิ่งที่คุณต้องการจริงๆ คือให้โมเดลติดป้ายกำกับในรูปแบบที่คุณต้องการ ดังนั้น แทนที่จะเป็น Neutral คุณต้องการให้กลับ neutral คุณบรรลุเป้าหมายนี้ได้อย่างไร? มีวิธีที่แตกต่างกันในการทำเช่นนี้ คุณใส่ใจกับความเฉพาะเจาะจงที่นี่ ดังนั้น ยิ่งคุณสามารถให้ข้อมูลพร้อมท์ได้มากเท่าไร ผลลัพธ์ก็จะยิ่งดีขึ้นเท่านั้น คุณสามารถลองยกตัวอย่างเพื่อระบุลักษณะการทำงานที่ถูกต้องได้ ลองอีกครั้ง:
Prompt:
Classify the text into neutral, negative or positive.
Text: I think the vacation is okay.
Sentiment: neutral
Text: I think the food was okay.
Sentiment:
Output:
neutral
สมบูรณ์แบบ! คราวนี้โมเดลส่งคืน neutral ซึ่งเป็นป้ายกำกับเฉพาะที่คุณกำลังมองหา ดูเหมือนว่าตัวอย่างที่ให้ไว้ในพรอมต์ช่วยให้โมเดลมีความเฉพาะเจาะจงในผลลัพธ์ของมัน
เพื่อเน้นย้ำว่าเหตุใดบางครั้งการระบุเจาะจงจึงมีความสำคัญ โปรดดูตัวอย่างด้านล่างและระบุปัญหา:
Prompt:
Classify the text into nutral, negative or positive.
Text: I think the vacation is okay.
Sentiment:
Output:
Neutral
ปัญหาที่นี่คืออะไร? โปรดทราบว่าแบบจำลองจะละเว้นป้ายกำกับ nutral ที่สร้างขึ้นโดยสมบูรณ์ แต่โมเดลจะส่งเอาต์พุต Neutral แทน เนื่องจากมีอคติต่อป้ายกำกับนั้น แต่สมมติว่าสิ่งที่คุณต้องการจริงๆ คือ nutral คุณจะแก้ไขปัญหานี้อย่างไร? บางทีคุณอาจลองเพิ่มคำอธิบายให้กับป้ายกำกับหรือเพิ่มตัวอย่างเพิ่มเติมในข้อความแจ้งได้ หากคุณไม่แน่ใจ เราจะหารือเกี่ยวกับแนวคิดบางประการในหัวข้อต่อๆ ไป
บางทีสิ่งที่น่าสนใจอย่างหนึ่งที่คุณสามารถทำได้ด้วยวิศวกรรมที่ทันท่วงทีก็คือการสอนระบบ LLM เกี่ยวกับวิธีการปฏิบัติตน เจตนา และเอกลักษณ์ของระบบ สิ่งนี้มีประโยชน์อย่างยิ่งเมื่อคุณสร้างระบบการสนทนา เช่น แชทบอทบริการลูกค้า
ตัวอย่างเช่น เรามาสร้างระบบการสนทนาที่สามารถสร้างการตอบคำถามทางเทคนิคและวิทยาศาสตร์ได้มากขึ้น สังเกตวิธีการที่คุณบอกอย่างชัดเจนถึงวิธีปฏิบัติตนผ่านคำแนะนำ บางครั้งเรียกว่า การแจ้งบทบาท
Prompt:
The following is a conversation with an AI research assistant. The assistant tone is technical and scientific.
Human: Hello, who are you?
AI: Greeting! I am an AI research assistant. How can I help you today?
Human: Can you tell me about the creation of blackholes?
AI:
Output:
Sure! Black holes are regions of spacetime where the gravitational force is so strong that nothing, not even light, can escape from it. They are created when a very massive star dies and its core collapses in on itself, forming a singularity of infinite density. The intense gravity of the singularity pulls in all the matter and radiation around it, creating the black hole.
ผู้ช่วยวิจัย AI ของเราฟังดูเทคนิคเกินไปใช่ไหม? เอาล่ะ เรามาเปลี่ยนพฤติกรรมนี้และสั่งให้ระบบให้คำตอบที่เข้าถึงได้มากขึ้น
Prompt:
The following is a conversation with an AI research assistant. The assistant answers should be easy to understand even by primary school students.
Human: Hello, who are you?
AI: Greeting! I am an AI research assistant. How can I help you today?
Human: Can you tell me about the creation of black holes?
AI:
Output:
Sure! Black holes are created when a very massive star runs out of fuel and collapses in on itself. The gravity of the star is so strong that nothing, not even light, can escape its pull. This creates a point in space-time with an intense gravitational force called a black hole.
คุณมีความก้าวหน้าบางอย่าง คุณสามารถปรับปรุงต่อไปได้ หากคุณเพิ่มตัวอย่างเพิ่มเติม คุณอาจได้รับผลลัพธ์ที่ดียิ่งขึ้น
แอปพลิเคชั่นหนึ่งที่ LLM ค่อนข้างมีประสิทธิภาพคือการสร้างโค้ด Copilot เป็นตัวอย่างที่ดีในเรื่องนี้ มีงานสร้างโค้ดมากมายที่คุณสามารถทำได้โดยใช้คำสั่งที่ชาญฉลาด ลองดูตัวอย่างด้านล่าง
ขั้นแรกเรามาลองใช้โปรแกรมง่ายๆ ที่ทักทายผู้ใช้กันก่อน
Prompt:
/*
Ask the user for their name and say "Hello"
*/
Output:
let name = prompt("What is your name?");
console.log(`Hello, ${name}!`);
โปรดสังเกตว่าคุณไม่จำเป็นต้องระบุภาษาที่จะใช้ด้วยซ้ำ
มาเปลี่ยนระดับกันหน่อย ตัวอย่างด้านล่างแสดงให้เห็นว่า LLM มีประสิทธิภาพเพียงใดโดยต้องอาศัยความพยายามเพิ่มขึ้นอีกเล็กน้อยในการออกแบบพร้อมท์
Prompt:
"""
Table departments, columns = [DepartmentId, DepartmentName]
Table students, columns = [DepartmentId, StudentId, StudentName]
Create a MySQL query for all students in the Computer Science Department
"""
Output:
SELECT StudentId, StudentName
FROM students
WHERE DepartmentId IN (SELECT DepartmentId FROM departments WHERE DepartmentName = 'Computer Science');
นี่เป็นสิ่งที่น่าประทับใจมาก ในกรณีนี้ คุณได้ให้ข้อมูลเกี่ยวกับสคีมาฐานข้อมูลและขอให้สร้างการสืบค้น MySQL ที่ถูกต้อง
บางทีงานที่ยากที่สุดงานหนึ่งสำหรับ LLM ในปัจจุบันก็คืองานที่ต้องใช้เหตุผลบางรูปแบบ การใช้เหตุผลเป็นหนึ่งในพื้นที่ที่น่าสนใจที่สุดเนื่องจากประเภทของแอปพลิเคชันที่ซับซ้อนที่อาจเกิดขึ้นจาก LLM
มีการปรับปรุงบางอย่างในงานที่เกี่ยวข้องกับความสามารถทางคณิตศาสตร์ ที่กล่าวมา สิ่งสำคัญคือต้องทราบว่า LLM ในปัจจุบันประสบปัญหาในการดำเนินการให้เหตุผล ดังนั้นสิ่งนี้จึงต้องใช้เทคนิคทางวิศวกรรมขั้นสูงขั้นสูงยิ่งขึ้น เราจะกล่าวถึงเทคนิคขั้นสูงเหล่านี้ในคำแนะนำถัดไป ในตอนนี้ เราจะกล่าวถึงตัวอย่างพื้นฐานบางส่วนเพื่อแสดงความสามารถทางคณิตศาสตร์
Prompt:
What is 9,000 * 9,000?
Output:
81,000,000
มาลองอะไรที่ยากกว่านี้กันดีกว่า
Prompt:
The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1.
A:
Output:
No, the odd numbers in this group add up to an odd number: 119.
นั่นไม่ถูกต้อง! มาลองปรับปรุงสิ่งนี้โดยการปรับปรุงพรอมต์
Prompt:
The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1.
Solve by breaking the problem into steps. First, identify the odd numbers, add them, and indicate whether the result is odd or even.
Output:
Odd numbers: 15, 5, 13, 7, 1
Sum: 41
41 is an odd number.
ดีขึ้นมากใช่ไหม? อย่างไรก็ตาม เราลองงานนี้มาสองสามครั้งแล้วและบางครั้งโมเดลก็ล้มเหลว หากคุณให้คำแนะนำที่ดีขึ้นพร้อมกับตัวอย่าง อาจช่วยให้ได้ผลลัพธ์ที่แม่นยำยิ่งขึ้น
ในหัวข้อที่กำลังจะมาถึง เราจะพูดถึงแนวคิดและเทคนิคทางวิศวกรรมที่รวดเร็วขั้นสูงยิ่งขึ้นสำหรับการปรับปรุงประสิทธิภาพในงานทั้งหมดนี้และงานที่ยากยิ่งขึ้น
หากคุณต้องการฝึกฝนพร้อมท์ข้างต้นโดยใช้ Python เราได้เตรียมสมุดบันทึกไว้เพื่อทดสอบพร้อมท์บางส่วนโดยใช้โมเดล OpenAI