หน้านี้จะแนะนำกลยุทธ์การออกแบบพรอมต์ทั่วไปที่คุณใช้ได้เมื่อออกแบบพรอมต์
โมเดลภาษาขนาดใหญ่ (LLM) ได้รับการฝึกด้วยข้อมูลข้อความจำนวนมากเพื่อเรียนรู้รูปแบบและความสัมพันธ์ระหว่างภาษา เมื่อได้รับข้อความ (พรอมต์) โมเดลภาษาจะคาดคะเนสิ่งที่มีแนวโน้มจะปรากฏขึ้นถัดไปได้ เช่น เครื่องมือเติมข้อความอัตโนมัติที่ซับซ้อน
Google AI Studio มีแกลเลอรีพรอมต์ที่เรียบง่ายซึ่งมีไว้เพื่อแสดงแนวคิดต่างๆ มากมายที่แชร์ในคู่มือนี้แบบอินเทอร์แอกทีฟ ในส่วนที่เหลือของคู่มือนี้ คุณจะได้เรียนรู้เกี่ยวกับกลยุทธ์การออกแบบพรอมต์ต่อไปนี้- ให้วิธีการที่ชัดเจนและเจาะจง
- ใส่ตัวอย่างแบบไม่กี่ช็อต
- เพิ่มข้อมูลตามบริบท
- เพิ่มคำนำหน้า
- ให้โมเดลป้อนข้อมูลบางส่วนให้เสร็จสมบูรณ์
ให้คําแนะนําที่ชัดเจนและเจาะจง
การให้วิธีการแก่โมเดลเกี่ยวกับสิ่งที่ต้องทําเป็นวิธีที่มีประสิทธิภาพและประสิทธิผลในการปรับแต่งลักษณะการทํางานของโมเดล ตรวจสอบว่าวิธีการที่คุณให้ไว้ชัดเจนและเฉพาะเจาะจง วิธีการอาจเรียบง่ายเพียงแสดงรายการวิธีการทีละขั้นตอน หรือซับซ้อนเท่ากับการระบุประสบการณ์และแนวคิดของผู้ใช้
กําหนดงานที่จะทํา
อธิบายงานที่ต้องการให้โมเดลทําอย่างละเอียด งานที่ต้องทำอาจง่ายเพียงแสดงวิธีการทีละขั้นตอน หรือซับซ้อนเท่ากับการวางแผนประสบการณ์และแนวคิดของผู้ใช้ พรอมต์ต่อไปนี้จะบอกให้โมเดลสรุปบล็อกข้อความ
Summarize this text: Text: A quantum computer exploits quantum mechanical phenomena to perform calculations exponentially faster than any modern traditional computer. At very tiny scales, physical matter acts as both particles and as waves, and quantum computing uses specialized hardware to leverage this behavior. The operating principles of quantum devices is beyond the scope of classical physics. When deployed at scale, quantum computers could be used in a wide variety of applications such as: in cybersecurity to break existing encryption methods while helping researchers create new ones, in meteorology to develop better weather forecasting etc. However, the current state of the art quantum computers are still largely experimental and impractical. Quantum computers leverage the wave-particle duality of matter at tiny scales to perform calculations exponentially faster than traditional computers. They harness quantum phenomena, which are beyond the scope of classical physics, to achieve this speed advantage. While promising for applications like cybersecurity, weather forecasting, and beyond, current quantum computers are still experimental and not yet practical for widespread use. |
ระบุข้อจำกัด
ระบุข้อจำกัดในการอ่านพรอมต์หรือสร้างคำตอบ คุณสามารถบอกให้โมเดลดำเนินการหรือไม่ดำเนินการใดๆ ก็ได้ จากตัวอย่างก่อนหน้านี้ ข้อความสรุปจะสั้นกว่าข้อความต้นฉบับ แต่คุณอาจต้องการให้สรุปสั้นกว่านี้ ในกรณีนี้ คุณสามารถระบุข้อจำกัดในพรอมต์เกี่ยวกับความยาวของข้อมูลสรุปที่ต้องการได้ ดังนี้
Summarize this text in two sentences: Text: A quantum computer exploits quantum mechanical phenomena to perform calculations exponentially faster than any modern traditional computer. At very tiny scales, physical matter acts as both particles and as waves, and quantum computing uses specialized hardware to leverage this behavior. The operating principles of quantum devices is beyond the scope of classical physics. When deployed at scale, quantum computers could be used in a wide variety of applications such as: in cybersecurity to break existing encryption methods while helping researchers create new ones, in meteorology to develop better weather forecasting etc. However, the current state of the art quantum computers are still largely experimental and impractical.
Quantum computers harness the wave-particle duality of matter at the quantum level to perform computations exponentially faster than traditional computers. While these machines hold immense potential for fields like cybersecurity and weather forecasting, they are currently in their early stages of development and not yet practical for widespread use. |
กำหนดรูปแบบของคำตอบ
นอกจากนี้ คุณยังระบุวิธีการที่ระบุรูปแบบของคำตอบได้ด้วย เช่น คุณสามารถขอให้คำตอบมีการจัดรูปแบบเป็นตาราง รายการหัวข้อ อีเลเวเตอร์พิทช์ คีย์เวิร์ด ประโยค หรือย่อหน้า ข้อความระบบต่อไปนี้จะสั่งให้โมเดลใช้ภาษาที่เหมือนการสนทนามากขึ้นในการตอบกลับ
All questions should be answered comprehensively with details, unless the user requests a concise response specifically. What is a smart way to make a business that sells DVD's in 2025? Okay, you're looking at a real uphill battle here. The DVD market is significantly diminished due to streaming services, digital downloads, and Blu-ray. However, that doesn't necessarily mean it's impossible to build a DVD-based business in 2025. It just requires a hyper-focused strategy and a deep understanding of the remaining market. Here's a breakdown of smart approaches: I. Understanding the Challenges and Opportunities Challenges: Dominance of Streaming: Netflix, Amazon Prime Video, Disney+, and countless other services offer vast libraries on-demand. Digital Downloads/Rentals: Platforms like iTunes, Google Play, and Vudu make purchasing or renting digital versions easy. Blu-ray & 4K Ultra HD: Offer superior picture and sound quality, often preferred by home theater enthusiasts. .... ..... |
All questions should be answered comprehensively with details, unless the user requests a concise response specifically. Respond in the same language as the query. What is a smart way to create a lemonade business? Launching a Successful Lemonade Stand: A Smart Approach Creating a lemonade business, whether a simple stand or a larger operation, requires strategic thinking. Here's a breakdown of how to approach it smartly: 1. Define Your Business: Scope: Are you aiming for a small, seasonal lemonade stand, a food truck, a delivery service, or something else entirely? Target Audience: Who are you selling to? Families, office workers, tourists? Unique Selling Proposition: What sets your lemonade apart? Special flavors, organic ingredients, a unique recipe? Pricing: Research competitor prices and determine a profitable pricing structure. Location: Consider foot traffic, accessibility, and regulations for your chosen location. ..... |
สรุป
- บอกผู้เข้าร่วมให้ทำตามสิ่งที่ต้องการ
- เขียนวิธีการให้ชัดเจนและเฉพาะเจาะจง
- ระบุข้อจำกัดหรือข้อกำหนดการจัดรูปแบบสำหรับเอาต์พุต
ใส่ตัวอย่างแบบไม่กี่ช็อต
คุณสามารถใส่ตัวอย่างในพรอมต์ที่แสดงลักษณะของการทำสิ่งต่างๆ ให้ถูกต้อง โมเดลจะพยายามระบุรูปแบบและความสัมพันธ์จากตัวอย่าง แล้วนําไปใช้เมื่อสร้างคําตอบ พรอมต์ที่มีตัวอย่างเพียงไม่กี่รายการเรียกว่าพรอมต์แบบไม่กี่ตัวอย่าง ส่วนพรอมต์ที่ไม่มีตัวอย่างเรียกว่าพรอมต์แบบไม่มีตัวอย่าง พรอมต์แบบไม่กี่ประโยคมักใช้เพื่อควบคุมการจัดรูปแบบ วลี ขอบเขต หรือรูปแบบทั่วไปของคำตอบของโมเดล ใช้ตัวอย่างที่เฉพาะเจาะจงและหลากหลายเพื่อช่วยให้โมเดลมุ่งเน้นที่สิ่งที่ต้องการมากขึ้นและสร้างผลลัพธ์ที่แม่นยำยิ่งขึ้น
เราขอแนะนำให้ใส่ตัวอย่างแบบไม่กี่ช็อตในพรอมต์เสมอ พรอมต์ที่ไม่มีตัวอย่างแบบไม่กี่ตัวอย่างมีแนวโน้มที่จะมีประสิทธิภาพน้อยลง อันที่จริงแล้ว คุณสามารถนำวิธีการออกจากพรอมต์ได้หากตัวอย่างแสดงงานที่ต้องทำอย่างชัดเจนเพียงพอ
พรอมต์แบบไม่ใช้ตัวอย่างกับพรอมต์แบบใช้ตัวอย่างน้อย
พรอมต์แบบไม่ใช้ข้อมูลพรอมต์ต่อไปนี้จะขอให้โมเดลเลือกคำอธิบายที่ดีที่สุด
Please choose the best explanation to the question: Question: How is snow formed? Explanation1: Snow is formed when water vapor in the air freezes into ice crystals in the atmosphere, which can combine and grow into snowflakes as they fall through the atmosphere and accumulate on the ground. Explanation2: Water vapor freezes into ice crystals forming snow. Answer: Explanation 1 is the best explanation. |
หาก Use Case กำหนดให้โมเดลสร้างคำตอบที่กระชับ คุณสามารถใส่ตัวอย่างในพรอมต์ที่ให้ความสำคัญกับคำตอบที่กระชับ
พรอมต์ต่อไปนี้แสดงตัวอย่าง 2 รายการที่แสดงให้เห็นว่าคำอธิบายแบบสั้นๆ นั้นเหมาะสมกว่า ในคําตอบ คุณจะเห็นว่าตัวอย่างช่วยให้โมเดลเลือกคำอธิบายที่สั้นกว่า (คำอธิบาย 2) แทนคำอธิบายที่ยาวกว่า (คำอธิบาย 1) ดังที่เคยทำก่อนหน้านี้
Below are some examples showing a question, explanation, and answer format: Question: Why is sky blue? Explanation1: The sky appears blue because of Rayleigh scattering, which causes shorter blue wavelengths of light to be scattered more easily than longer red wavelengths, making the sky look blue. Explanation2: Due to Rayleigh scattering effect. Answer: Explanation2 Question: What is the cause of earthquakes? Explanation1: Sudden release of energy in the Earth's crust. Explanation2: Earthquakes happen when tectonic plates suddenly slip or break apart, causing a release of energy that creates seismic waves that can shake the ground and cause damage. Answer: Explanation1 Now, Answer the following question given the example formats above: Question: How is snow formed? Explanation1: Snow is formed when water vapor in the air freezes into ice crystals in the atmosphere, which can combine and grow into snowflakes as they fall through the atmosphere and accumulate on the ground. Explanation2: Water vapor freezes into ice crystals forming snow. Answer: Answer: Explanation2 |
ค้นหาจำนวนตัวอย่างที่เหมาะสม
คุณสามารถทดสอบจำนวนตัวอย่างที่จะระบุในพรอมต์เพื่อให้ได้ผลลัพธ์ที่ต้องการมากที่สุด โมเดลอย่าง Gemini มักจะจับรูปแบบได้โดยใช้ตัวอย่างเพียงไม่กี่รายการ แต่คุณอาจต้องทดสอบจำนวนตัวอย่างที่ทำให้เกิดผลลัพธ์ที่ต้องการ ในขณะเดียวกัน หากคุณใส่ตัวอย่างมากเกินไป โมเดลอาจเริ่มปรับให้พอดีมากเกินไปกับการตอบสนองต่อตัวอย่าง
ใช้ตัวอย่างเพื่อแสดงรูปแบบแทนที่จะใช้รูปแบบที่ไม่แนะนำ
การใช้ตัวอย่างเพื่อแสดงรูปแบบที่ควรทำตามมีประสิทธิภาพมากกว่าการใช้ตัวอย่างเพื่อแสดงรูปแบบที่ควรหลีกเลี่ยง
⛔ รูปแบบเชิงลบ:
Don't end haikus with a question: Haiku are fun A short and simple poem Don't you enjoy them? |
✅ รูปแบบเชิงบวก
Always end haikus with an assertion: Haiku are fun A short and simple poem A joy to write |
ใช้การจัดรูปแบบที่สอดคล้องกันในตัวอย่าง
ตรวจสอบว่าโครงสร้างและการจัดรูปแบบของตัวอย่างแบบไม่กี่ช็อตเหมือนกันเพื่อหลีกเลี่ยงคำตอบที่มีรูปแบบที่ไม่ต้องการ วัตถุประสงค์หลักประการหนึ่งของการเพิ่มตัวอย่างแบบไม่กี่ช็อตในพรอมต์คือการแสดงให้เห็นรูปแบบคำตอบของโมเดล ดังนั้น คุณจึงต้องตรวจสอบว่าตัวอย่างทั้งหมดมีรูปแบบที่สอดคล้องกัน โดยเฉพาะอย่างยิ่งให้ใส่ใจกับแท็ก XML, เว้นวรรค, บรรทัดใหม่ และตัวแบ่งตัวอย่าง
สรุป
- การใส่ตัวอย่างคำตอบของพรอมต์ในพรอมต์จะช่วยให้โมเดลเรียนรู้วิธีตอบกลับ
- แสดงตัวอย่างรูปแบบที่ควรทำตามแทนตัวอย่างรูปแบบที่ควรหลีกเลี่ยง
- ทดสอบจำนวนพรอมต์ที่จะรวม ตัวอย่างจำนวนน้อยเกินไปจะทําให้การเปลี่ยนแปลงลักษณะการทํางานของโมเดลไม่มีประสิทธิภาพ ทั้งนี้ขึ้นอยู่กับโมเดล ตัวอย่างมากเกินไปทําให้โมเดล Overfit
- ใช้การจัดรูปแบบที่สอดคล้องกันในตัวอย่าง
เพิ่มข้อมูลตามบริบท
คุณสามารถใส่วิธีการและข้อมูลในพรอมต์ที่โมเดลจําเป็นต้องใช้เพื่อแก้ปัญหาแทนที่จะสมมติว่าโมเดลมีข้อมูลทั้งหมดที่จําเป็น ข้อมูลตามบริบทนี้ช่วยให้โมเดลเข้าใจข้อจำกัดและรายละเอียดของสิ่งที่คุณขอให้ทำ
ตัวอย่างต่อไปนี้จะขอให้โมเดลให้คำแนะนำในการแก้ปัญหาสำหรับเราเตอร์
What should I do to fix my disconnected wifi? The light on my Google Wifi router is yellow and blinking slowly. A yellow blinking light on your Google Wifi router usually indicates a problem with the internet connection. Here are some steps to troubleshoot and fix the issue: 1. Restart your router and modem: - Unplug your modem from the power outlet and wait for 30 seconds. - Plug your modem back in and wait for it to fully boot up. - Unplug your Google Wifi router and wait for 30 seconds. - Plug your Google Wifi router back in and wait for it to fully boot up. ..... |
Answer the question using the text below. Respond with only the text provided. Question: What should I do to fix my disconnected wifi? The light on my Google Wifi router is yellow and blinking slowly. Text: Color: Slowly pulsing yellow What it means: There is a network error. What to do: Check that the Ethernet cable is connected to both your router and your modem and both devices are turned on. You might need to unplug and plug in each device again. Color: Fast blinking yellow What it means: You are holding down the reset button and are factory resetting this device. What to do: If you keep holding down the reset button, after about 12 seconds, the light will turn solid yellow. Once it is solid yellow, let go of the factory reset button. Color: Solid yellow What it means: Router is factory resetting. What to do: This can take up to 10 minutes. When it's done, the device will reset itself and start pulsing white, letting you know it's ready for setup. Color: Solid red What it means: Something is wrong. What to do: Critical failure. Factory reset the router. If the light stays red, contact Wifi customer support. Check that the Ethernet cable is connected to both your router and your modem and both devices are turned on. You might need to unplug and plug in each device again. |
สรุป
- ใส่ข้อมูล (บริบท) ในพรอมต์ที่คุณต้องการให้โมเดลใช้เมื่อสร้างคำตอบ
- บอกวิธีการใช้ข้อมูลตามบริบทแก่โมเดล
เพิ่มคำนำหน้า
คำนำหน้าคือคำหรือวลีที่คุณเพิ่มลงในเนื้อหาพรอมต์เพื่อวัตถุประสงค์หลายอย่าง โดยขึ้นอยู่กับตำแหน่งที่คุณใส่คำนำหน้า
- คำนำหน้าอินพุต: การเพิ่มคำนำหน้าไปยังสัญญาณอินพุตที่สื่อความหมายของส่วนอินพุตในโมเดล เช่น ข้อความนำหน้า "ภาษาอังกฤษ:" และ "ฝรั่งเศส:" จะแบ่งภาษาออกเป็น 2 ภาษา
- คำนำหน้าเอาต์พุต: แม้ว่าเอาต์พุตจะสร้างขึ้นโดยโมเดล แต่คุณก็เพิ่มคำนำหน้าสำหรับเอาต์พุตในพรอมต์ได้ ส่วนคำนำหน้าเอาต์พุตจะให้ข้อมูลโมเดลเกี่ยวกับสิ่งที่คาดหวังไว้สำหรับคำตอบ เช่น คำนำหน้าเอาต์พุต "JSON:" จะส่งสัญญาณให้โมเดลทราบว่าเอาต์พุตควรอยู่ในรูปแบบ JSON
- คำนำหน้าตัวอย่าง: ในพรอมต์แบบไม่กี่ช็อต การเพิ่มคำนำหน้าให้กับตัวอย่างจะเป็นการสร้างป้ายกำกับที่โมเดลสามารถใช้เมื่อสร้างเอาต์พุต ซึ่งทำให้แยกวิเคราะห์เนื้อหาเอาต์พุตได้ง่ายขึ้น
ในตัวอย่างต่อไปนี้ "ข้อความ:" คือคำนำหน้าอินพุต และ "คำตอบคือ:" คือคำนำหน้าเอาต์พุต
Classify the text as one of the following categories. - large - small Text: Rhino The answer is: large Text: Mouse The answer is: small Text: Snail The answer is: small Text: Elephant The answer is: The answer is: large |
ปล่อยให้โมเดลป้อนข้อมูลบางส่วนให้เสร็จสมบูรณ์
โมเดลภาษาแบบ Generative ทํางานเหมือนเครื่องมือเติมข้อความอัตโนมัติขั้นสูง เมื่อคุณให้เนื้อหาเพียงบางส่วน โมเดลจะสร้างเนื้อหาที่เหลือหรือสิ่งที่คิดว่าเป็นเนื้อหาต่อจากเนื้อหานั้นเพื่อตอบกลับได้ เมื่อทําเช่นนั้น หากคุณใส่ตัวอย่างหรือบริบทใดๆ โมเดลจะพิจารณาตัวอย่างหรือบริบทเหล่านั้น
ตัวอย่างต่อไปนี้แสดงพรอมต์พร้อมคําแนะนําและอินพุตเอนทิตี
For the given order, return a JSON object that has the fields cheeseburger, hamburger, fries, or drink, with the value being the quantity. Order: A burger and a drink. ``` { "hamburger": 1, "drink": 1 } ``` |
แม้ว่าโมเดลจะทำตามพรอมต์ แต่การเขียนวิธีการเป็นภาษาที่เป็นธรรมชาติบางครั้งก็อาจเป็นเรื่องยากและทำให้โมเดลตีความได้หลายแบบ เช่น เมนูของร้านอาหารอาจมีหลายรายการ หากต้องการลดขนาดของคำตอบ JSON คุณอาจต้องละเว้นรายการที่ไม่ได้สั่งซื้อ ในกรณีนี้ คุณสามารถระบุตัวอย่างและคำนำหน้าคำตอบ แล้วปล่อยให้โมเดลดำเนินการต่อ
Valid fields are cheeseburger, hamburger, fries, and drink. Order: Give me a cheeseburger and fries Output: ``` { "cheeseburger": 1, "fries": 1 } ``` Order: I want two burgers, a drink, and fries. Output: ``` { "hamburger": 2, "drink": 1, "fries": 1 } ``` |
โปรดสังเกตว่า "ชีสเบอร์เกอร์" ถูกยกเว้นจากเอาต์พุตเนื่องจากไม่ได้เป็นส่วนหนึ่งของคำสั่งซื้อ
แจ้งให้โมเดลจัดรูปแบบคำตอบ
กลยุทธ์การทํางานให้เสร็จสมบูรณ์ยังช่วยจัดรูปแบบคําตอบได้ด้วย ตัวอย่างต่อไปนี้จะแจ้งให้รูปแบบสร้างเค้าโครงเรียงความ
Create an outline for an essay about hummingbirds. Hummingbirds: A Symphony of Speed and Color I. Introduction A. Hummingbirds are fascinating creatures known for their dazzling colors, lightning-fast flight, and unique feeding habits. B. Brief overview of the diversity of hummingbird species and their geographic distribution. C. Thesis statement: Hummingbirds are an embodiment of resilience, adaptation, and the wonders of the natural world. ..... |
พรอมต์ไม่ได้ระบุรูปแบบของเค้าโครง และโมเดลเลือกรูปแบบให้คุณ หากต้องการให้โมเดลแสดงผลเค้าโครงในรูปแบบที่เฉพาะเจาะจง คุณสามารถเพิ่มข้อความที่แสดงถึงจุดเริ่มต้นของเค้าโครง แล้วปล่อยให้โมเดลเขียนเค้าโครงให้เสร็จสมบูรณ์ตามรูปแบบที่คุณเริ่มต้น
Create an outline for an essay about hummingbirds. I. Introduction * Hummingbirds: Jewels of the Air **I. Introduction** * **Hook:** Begin with a captivating image or anecdote about hummingbirds, emphasizing their vibrant colors, rapid flight, and unique feeding habits. * **Background:** Briefly introduce hummingbirds as the smallest birds in the world and their fascinating adaptations for a nectar-rich diet. * **Thesis:** State the main argument or focus of the essay. Examples: * **The incredible adaptations of hummingbirds enable them to thrive in diverse ecosystems.** * **Hummingbirds play a crucial role in pollination and biodiversity.** * **The beauty and grace of hummingbirds make them captivating subjects for both scientific study and artistic appreciation.** |
สรุป
- หากคุณป้อนข้อมูลบางส่วน โมเดลจะเติมข้อมูลนั้นให้สมบูรณ์โดยอิงตามตัวอย่างหรือบริบทที่มีอยู่ในพรอมต์
- บางครั้งการให้โมเดลป้อนข้อมูลให้เสร็จสมบูรณ์อาจง่ายกว่าการอธิบายงานเป็นภาษาธรรมชาติ
- การเพิ่มคำตอบบางส่วนในพรอมต์จะช่วยแนะนําให้โมเดลทําตามรูปแบบหรือรูปแบบที่ต้องการ
แบ่งพรอมต์ออกเป็นองค์ประกอบง่ายๆ
สําหรับ Use Case ที่ต้องมีคําแนะนําที่ซับซ้อน คุณสามารถช่วยให้โมเดลจัดการกับความซับซ้อนนี้ได้ด้วยการแบ่งออกเป็นคอมโพเนนต์ที่ง่ายขึ้น
แจกแจงวิธีการ
สร้างพรอมต์ 1 รายการต่อวิธีการ แทนที่จะสร้างพรอมต์หลายรายการในพรอมต์เดียว คุณสามารถเลือกพรอมต์ที่จะประมวลผลตามอินพุตของผู้ใช้
ข้อความแจ้งเชน
สำหรับงานที่ซับซ้อนซึ่งเกี่ยวข้องกับขั้นตอนตามลำดับหลายขั้นตอน ให้สร้างพรอมต์สำหรับแต่ละขั้นตอน แล้วเชื่อมโยงพรอมต์เข้าด้วยกันเป็นลำดับ ในชุดข้อความแจ้งตามลำดับนี้ เอาต์พุตของพรอมต์รายการหนึ่งในลำดับจะกลายเป็นอินพุตของพรอมต์รายการถัดไป เอาต์พุตของพรอมต์สุดท้ายในลําดับคือเอาต์พุตสุดท้ายรวบรวมคำตอบ
การรวมข้อมูลคือเมื่อคุณต้องการทํางานแบบขนานกันหลายอย่างกับข้อมูลส่วนต่างๆ และรวมผลลัพธ์เพื่อให้ได้เอาต์พุตสุดท้าย เช่น คุณสามารถบอกให้โมเดลดำเนินการหนึ่งกับข้อมูลส่วนแรก ดำเนินการอื่นกับข้อมูลที่เหลือ และรวบรวมผลลัพธ์
สรุป
- แบ่งวิธีการที่ซับซ้อนออกเป็นพรอมต์สำหรับวิธีการแต่ละรายการ แล้วเลือกพรอมต์ที่จะใช้ตามข้อมูลที่ได้จากผู้ใช้
- แบ่งขั้นตอนตามลำดับหลายขั้นตอนออกเป็นพรอมต์แยกกันและเชื่อมโยงกันเพื่อให้เอาต์พุตในพรอมต์ก่อนหน้ากลายเป็นอินพุตของพรอมต์ถัดไป
- แจกแจงงานแบบขนานและรวบรวมคําตอบเพื่อสร้างเอาต์พุตสุดท้าย
ทดสอบด้วยค่าพารามิเตอร์ที่แตกต่างกัน
การเรียกแต่ละครั้งที่คุณส่งไปยังโมเดลจะมีค่าพารามิเตอร์ที่ควบคุมวิธีที่โมเดลสร้างคำตอบ โมเดลสามารถสร้างผลลัพธ์ที่แตกต่างกันสําหรับค่าพารามิเตอร์ที่แตกต่างกัน ทดสอบค่าพารามิเตอร์ต่างๆ เพื่อให้ได้ค่าที่ดีที่สุดสําหรับงาน พารามิเตอร์ที่ใช้ได้สำหรับรุ่นต่างๆ อาจแตกต่างกันไป พารามิเตอร์ที่พบบ่อยที่สุดมีดังนี้
- โทเค็นเอาต์พุตสูงสุด
- อุณหภูมิ
- Top-K
- Top-P
โทเค็นเอาต์พุตสูงสุด
จำนวนโทเค็นสูงสุดที่สามารถสร้างในการตอบกลับ โทเค็นมีความยาวประมาณ 4 อักขระ โทเค็น 100 รายการจะสอดคล้องกับคำประมาณ 20 คำระบุค่าที่ต่ำลงสำหรับคำตอบที่สั้นลง และค่าที่สูงขึ้นสำหรับคำตอบที่ยาวขึ้น
อุณหภูมิ
ระบบจะใช้อุณหภูมิในการสุ่มตัวอย่างระหว่างการสร้างคำตอบ ซึ่งจะเกิดขึ้นเมื่อใช้topP
และ topK
อุณหภูมิควบคุมระดับความสุ่มในการเลือกโทเค็น อุณหภูมิที่ต่ำเหมาะสำหรับพรอมต์ที่ต้องใช้คำตอบแบบกำหนดตายตัวมากขึ้นและคำตอบแบบเปิดหรือสร้างสรรค์น้อยลง ส่วนอุณหภูมิที่สูงอาจนำไปสู่ผลลัพธ์ที่หลากหลายหรือสร้างสรรค์มากขึ้น อุณหภูมิ 0
เป็นค่าที่แน่นอน ซึ่งหมายความว่าระบบจะเลือกคำตอบที่มีระดับความน่าจะเป็นสูงสุดเสมอ
สําหรับ Use Case ส่วนใหญ่ ให้ลองเริ่มต้นด้วยอุณหภูมิ 0.2
หากโมเดลแสดงผลลัพธ์ที่กว้างเกินไป สั้นเกินไป หรือแสดงผลลัพธ์สำรอง ให้ลองเพิ่มอุณหภูมิ
Top-K
Top-K จะเปลี่ยนวิธีเลือกโทเค็นสำหรับเอาต์พุตของโมเดล Top-K ของ1
หมายความว่าโทเค็นที่เลือกถัดไปมีแนวโน้มมากที่สุดในบรรทัดโทเค็นทั้งหมดในคลังคำของโมเดล (หรือที่เรียกว่าการถอดรหัสแบบละโมบ) ส่วน Top-K ของ 3
หมายความว่าระบบจะเลือกโทเค็นถัดไปจากโทเค็นที่มีแนวโน้มมากที่สุด 3 รายการโดยใช้อุณหภูมิ
สําหรับขั้นตอนการเลือกโทเค็นแต่ละขั้นตอน ระบบจะสุ่มตัวอย่างโทเค็น K อันดับแรกที่มีความน่าจะเป็นสูงสุด จากนั้นระบบจะกรองโทเค็นเพิ่มเติมตาม P สูงสุด โดยเลือกโทเค็นสุดท้ายโดยใช้การสุ่มตัวอย่างอุณหภูมิ
ระบุค่าที่ต่ำลงเพื่อให้คำตอบแบบสุ่มน้อยลง และค่าที่สูงขึ้นเพื่อให้คำตอบแบบสุ่มมากขึ้น ค่าเริ่มต้นของ top-K คือ 40
Top-P
Top-P จะเปลี่ยนวิธีที่โมเดลเลือกโทเค็นสําหรับเอาต์พุต ระบบจะเลือกโทเค็นจากที่มีแนวโน้มมากที่สุด (ดูที่ top-K) ไปจนถึงมีแนวโน้มน้อยที่สุดจนกว่าผลรวมของแนวโน้มจะเท่ากับค่า top-P เช่น หากโทเค็น A, B และ C มีความน่าจะเป็น 0.3, 0.2 และ 0.1 และค่า P สูงสุดคือ0.5
โมเดลจะเลือก A หรือ B เป็นโทเค็นถัดไปโดยใช้อุณหภูมิ และยกเว้น C ไม่ให้เป็นตัวเลือก
ระบุค่าที่ต่ำลงเพื่อให้คำตอบแบบสุ่มน้อยลง และค่าที่สูงขึ้นเพื่อให้คำตอบแบบสุ่มมากขึ้น ค่าเริ่มต้นของ top-P คือ 0.95
กลยุทธ์การปรับพรอมต์เพื่อถามซ้ำ
การออกแบบพรอมต์เป็นกระบวนการที่ต้องทำซ้ำหลายครั้ง ซึ่งมักจะต้องทําซ้ำ 2-3 ครั้งก่อนจึงจะได้รับคําตอบที่ต้องการอย่างสม่ำเสมอ ส่วนนี้จะให้คําแนะนําเกี่ยวกับสิ่งที่คุณลองทําได้เมื่อต้องแก้ไขพรอมต์
ใช้วลีอื่น
การใช้คำหรือวลีอื่นในพรอมต์มักจะทําให้โมเดลตอบกลับแตกต่างกัน แม้ว่าคำหรือวลีทั้งหมดจะมีความหมายเหมือนกัน หากไม่พบผลลัพธ์ที่ต้องการจากพรอมต์ ให้ลองเปลี่ยนรูปแบบการเขียน
Version 1: How do I bake a pie? Version 2: Suggest a recipe for a pie. Version 3: What's a good pie recipe? |
เปลี่ยนไปใช้งานที่คล้ายกัน
หากทำให้โมเดลทำตามวิธีการสำหรับงานไม่ได้ ให้ลองให้วิธีการสำหรับงานที่คล้ายกันซึ่งให้ผลลัพธ์เดียวกัน
พรอมต์นี้จะบอกให้โมเดลจัดหมวดหมู่หนังสือโดยใช้หมวดหมู่ที่กำหนดไว้ล่วงหน้า
Which category does The Odyssey belong to: thriller sci-fi mythology biography The Odyssey belongs to the category of **mythology**. Here's why: * **Mythology:** The Odyssey tells the story of Odysseus, a hero from Greek mythology, and his journey home after the Trojan War. It features gods, monsters, and supernatural events common to Greek mythology. ..... |
คำตอบถูกต้อง แต่โมเดลไม่ได้อยู่ภายในขอบเขตของตัวเลือก นอกจากนี้ คุณยังควรแสดงตัวอย่างการตอบกลับด้วยตัวเลือกใดตัวเลือกหนึ่งแทนที่จะตอบเป็นประโยคเต็ม ในกรณีนี้ คุณสามารถเปลี่ยนคำสั่งเป็นคำถามแบบหลายตัวเลือกและขอให้โมเดลเลือกตัวเลือก
Multiple choice problem: Which of the following options describes the book The Odyssey? Options: - thriller - sci-fi - mythology - biography The correct answer is **mythology**. |
เปลี่ยนลําดับของเนื้อหาพรอมต์
บางครั้งลําดับของเนื้อหาในพรอมต์อาจส่งผลต่อการตอบกลับ ลองเปลี่ยนลำดับเนื้อหาและดูว่าส่งผลต่อคําตอบอย่างไร
Version 1: [examples] [context] [input] Version 2: [input] [examples] [context] Version 3: [examples] [input] [context]
คำตอบสำรอง
คำตอบสำรองคือคำตอบที่โมเดลแสดงเมื่อพรอมต์หรือคำตอบทริกเกอร์ตัวกรองความปลอดภัย ตัวอย่างคำตอบสำรอง เช่น "ฉันไม่สามารถให้ความช่วยเหลือในเรื่องนั้นได้เนื่องจากฉันเป็นเพียงโมเดลภาษา"
หากโมเดลตอบกลับด้วยคำตอบสำรอง ให้ลองเพิ่มอุณหภูมิ
สิ่งที่ควรหลีกเลี่ยง
- หลีกเลี่ยงการพึ่งพาโมเดลในการสร้างข้อมูลข้อเท็จจริง
- ใช้ด้วยความระมัดระวังกับโจทย์คณิตศาสตร์และตรรกะ
ขั้นตอนถัดไป
- เมื่อคุณเข้าใจการออกแบบพรอมต์มากขึ้นแล้ว ลองเขียนพรอมต์ของคุณเองโดยใช้ Google AI Studio
- ดูข้อมูลเกี่ยวกับการแจ้งแบบหลายสื่อได้ที่หัวข้อการแจ้งด้วยไฟล์สื่อ