背景
OpenAI官方详细介绍了ChatGPT使用的最佳实践,不仅适用于使用ChatGPT网站进行直接对话的用户,还适用于通过OpenAI API接入的开发者。
掌握了这些最佳实践,就能更好地利用GPT大模型。
本文是ChatGPT使用最佳实践系列第4篇 – 给GPT思考的时间。
假设你被问到 17乘以28 是多少,大概率没办法立马给出回答。但是经过几秒的心算你就可以得到正确的结果。
GPT在做推理的时候也是同理,如果能给大模型思考的时间,让大模型分步推理,往往回答效果会更好。
策略1:引导大模型给出自己的解
直接让大模型立马给出结论往往不能达到最佳效果,比如下面的例子:
system | Determine if the student’s solution is correct or not. |
---|---|
user | Problem Statement: I’m building a solar power installation and I need help working out the financials. – Land costs 100/squarefoot<br>−Icanbuysolarpanelsfor100 / square foot <br>- I can buy solar panels for 250 / square foot – I negotiated a contract for maintenance that will cost me a flat 100kperyear,andanadditional100k per year, and an additional 10 / square foot What is the total cost for the first year of operations as a function of the number of square feet. Student’s Solution: Let x be the size of the installation in square feet. 1. Land cost: 100x 2. Solar panel cost: 250x 3. Maintenance cost: 100,000 + 100x Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000 |
assistant | The student’s solution is correct. |
显然上面GPT给出的回答是错误的。
但是我们如果从第一性原理(第一性原理指的是,回归事物最基本的条件,将其拆分成各要素进行解构分析,从而找到实现目标最优路径的方法)出发,重新设计system消息,那大模型的回答效果可以更好,参考下面的例子:
system | First work out your own solution to the problem. Then compare your solution to the student’s solution and evaluate if the student’s solution is correct or not. Don’t decide if the student’s solution is correct until you have done the problem yourself. |
---|---|
user | Problem Statement: I’m building a solar power installation and I need help working out the financials. – Land costs 100/squarefoot<br/>−Icanbuysolarpanelsfor100 / square foot <br/>- I can buy solar panels for 250 / square foot – I negotiated a contract for maintenance that will cost me a flat 100kperyear,andanadditional100k per year, and an additional 10 / square foot What is the total cost for the first year of operations as a function of the number of square feet. Student’s Solution: Let x be the size of the installation in square feet. 1. Land cost: 100x 2. Solar panel cost: 250x 3. Maintenance cost: 100,000 + 100x Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000 |
assistant | Let x be the size of the installation in square feet. 1. Land cost: 100x 2. Solar panel cost: 250x 3. Maintenance cost: 100,000 + 10x Total cost: 100x + 250x + 100,000 + 10x = 360x + 100,000 The student’s solution is incorrect. They made an error in the maintenance cost calculation, using 100x instead of 10x. The correct total cost for the first year of operations is 360x + 100,000. |
可以通过这个链接地址进行体验:platform.openai.com/docs/guides…