ChatGPT 最佳实践指南之:将复杂任务拆分为较简单的子任务

Split complex tasks into simpler subtasks

将复杂任务分解为较简单的子任务

Just as it is good practice in software engineering to decompose a complex system into a set of modular components, the same is true of tasks submitted to GPTs. Complex tasks tend to have higher error rates than simpler tasks. Furthermore, complex tasks can often be re-defined as a workflow of simpler tasks in which the outputs of earlier tasks are used to construct the inputs to later tasks.

与软件工程中将复杂系统分解为一组模块化组件的最佳实践相同,将任务提交给 GPT 时也是如此。与较简单的任务相比,复杂任务的错误率往往更高。此外,复杂任务通常可以重新定义为一系列较简单任务的工作流程,其中较早任务的输出被用于构建后续任务的输入。

Tactic: Use intent classification to identify the most relevant instructions for a user query

技巧:使用意图分类识别与用户查询最相关的指示

For tasks in which lots of independent sets of instructions are needed to handle different cases, it can be beneficial to first classify the type of query and to use that classification to determine which instructions are needed. This can be achieved by defining fixed categories and hardcoding instructions that are relevant for handling tasks in a given category. This process can also be applied recursively to decompose a task into a sequence of stages. The advantage of this approach is that each query will contain only those instructions that are required to perform the next stage of a task which can result in lower error rates compared to using a single query to perform the whole task. This can also result in lower costs since larger prompts cost more to run (see pricing information).

对于需要处理不同情况下的许多独立指令集的任务,首先对查询进行分类,并使用分类来确定所需的指令,这将是有益的。可以通过定义固定的类别并硬编码与给定类别下任务处理相关的指令来实现。这个过程也可以递归应用于将任务分解为一系列阶段。这种方法的优点是每个查询只包含执行任务的下一个阶段所需的指令,与使用单个查询执行整个任务相比,这可以降低错误率。这还可以降低成本,因为更大的提示需要更多的资源(请参阅定价信息)。

Suppose for example that for a customer service application, queries could be usefully classified as follows:

例如,假设对于客户服务应用程序,查询可以有以下有用的分类:

SYSTEM

系统

You will be provided with customer service queries. Classify each query into a primary category and a secondary category. Provide your output in json format with the keys: primary and secondary.

您将收到客户服务查询。将每个查询分类为主要类别和次要类别。使用 JSON 格式提供输出,键为:主要和次要。

Primary categories: Billing, Technical Support, Account Management, or General Inquiry.

主要类别:计费、技术支持、帐户管理或一般查询。

Billing secondary categories:

- Unsubscribe or upgrade

- Add a payment method

- Explanation for charge

- Dispute a charge

计费的次要类别:

- 退订或升级

- 添加付款方式

- 收费解释

- 争议收费

Technical Support secondary categories:

- Troubleshooting

- Device compatibility

- Software updates

技术支持的次要类别:

- 故障排除

- 设备兼容性

- 软件更新

Account Management secondary categories:

- Password reset

- Update personal information

- Close account

- Account security

帐户管理的次要类别:

- 密码重置

- 更新个人信息

- 关闭帐户

- 帐户安全

General Inquiry secondary categories:

- Product information

- Pricing

- Feedback

- Speak to a human

一般查询的次要类别:

- 产品信息

- 定价

- 反馈

- 联系人工客服

USER

用户

I need to get my internet working again.

我需要让我的互联网再次工作起来。

Based on the classification of the customer query, a set of more specific instructions can be provided to a GPT model to handle next steps. For example, suppose the customer requires help with "troubleshooting".

根据客户查询的分类,可以提供一组更具体的指令给 GPT 模型处理下一步操作。例如,假设客户需要帮助“故障排除”。

SYSTEM

系统

You will be provided with customer service inquiries that require troubleshooting in a technical support context. Help the user by:

您将收到需要在技术支持上下文中进行故障排除的客户服务查询。通过以下方式帮助用户:

- Ask them to check that all cables to/from the router are connected. Note that it is common for cables to come loose over time.

- 要求他们检查与路由器相连的所有电缆是否连接。请注意,随着时间的推移,电缆常常会松动。

- If all cables are connected and the issue persists, ask them which router model they are using

- 如果所有电缆连接正常且问题仍然存在,请询问他们使用的路由器型号。

- Now you will advise them how to restart their device:

- 现在,请告诉他们如何重新启动设备:

-- If the model number is MTD-327J, advise them to push the red button and hold it for 5 seconds, then wait 5 minutes before testing the connection.

- 如果型号是 MTD-327J,请建议他们按下红色按钮并保持按压 5 秒钟,然后等待 5 分钟后测试连接。

-- If the model number is MTD-327S, advise them to unplug and replug it, then wait 5 minutes before testing the connection.

如果型号是 MTD-327S,请建议他们拔下插头并重新插上,然后等待 5 分钟后测试连接。

- If the customer's issue persists after restarting the device and waiting 5 minutes, connect them to IT support by outputting {"IT support requested"}.

如果客户在重新启动设备并等待 5 分钟问题仍然存在,则通过输出 {"IT support requested"} 将他们连接到 IT 支持。

- If the user starts asking questions that are unrelated to this topic then confirm if they would like to end the current chat about troubleshooting and classify their request according to the following scheme:

- 如果用户开始询问与此主题无关的问题,则确认他们是否想结束当前有关故障排除的聊天,并根据以下方案对其请求进行分类:

USER

用户

<insert primary/secondary classification scheme from above here>

<在上面插入主要/次要分类方案>

I need to get my internet working again.

我需要让我的互联网再次工作起来。

Notice that the model has been instructed to emit special strings to indicate when the state of the conversation changes. This enables us to turn our system into a state machine where the state determines which instructions are injected. By keeping track of state, what instructions are relevant at that state, and also optionally what state transitions are allowed from that state, we can put guardrails around the user experience that would be hard to achieve with a less structured approach.

请注意,已指示模型发出特殊字符串以指示会话状态何时发生变化。这使我们能够将系统转变为一个状态机,其中状态确定注入哪些指令。通过跟踪状态、确定在该状态下哪些指令相关,以及可选地确定从该状态允许的状态转换,我们可以为用户体验设置防护措施,这对于使用不太结构化的方法很难实现。

Tactic: For dialogue applications that require very long conversations, summarize or filter previous dialogue

技巧:对于需要非常长对话的对话应用,总结或过滤先前的对话

Since GPTs have a fixed context length, dialogue between a user and an assistant in which the entire conversation is included in the context window cannot continue indefinitely.

由于 GPT 模型有固定的上下文长度,在用户与助手之间的对话中,如果整个对话都包含在上下文窗口中,对话不能无限继续下去。

There are various workarounds to this problem, one of which is to summarize previous turns in the conversation. Once the size of the input reaches a predetermined threshold length, this could trigger a query that summarizes part of the conversation and the summary of the prior conversation could be included as part of the system message. Alternatively, prior conversation could be summarized asynchronously in the background throughout the entire conversation.

有多种解决这个问题的方法,方法之一是对先前的对话进行总结。一旦输入的大小达到预定的阈值长度,这可能会触发一个查询,对对话的一部分进行总结,先前对话的总结可以作为系统消息的一部分包含在其中。或者,可以在整个对话过程中异步地对先前的对话进行总结。

An alternative solution is to dynamically select previous parts of the conversation that are most relevant to the current query. See the tactic "Use embeddings-based search to implement efficient knowledge retrieval".

另一种解决方案是动态选择与当前查询最相关的先前对话部分。请参阅策略“使用基于嵌入的搜索来实现高效的知识检索”。

Tactic: Summarize long documents piecewise and construct a full summary recursively

策略:逐段总结长文档并递归构建完整总结

Since GPTs have a fixed context length, they cannot be used to summarize a text longer than the context length minus the length of the generated summary in a single query.

由于 GPT 模型有固定的上下文长度,无法在单个查询中对超出上下文长度减去生成总结长度的文本进行总结。

To summarize a very long document such as a book we can use a sequence of queries to summarize each section of the document. Section summaries can be concatenated and summarized producing summaries of summaries. This process can proceed recursively until an entire document is summarized. If it’s necessary to use information about earlier sections in order to make sense of later sections, then a further trick that can be useful is to include a running summary of the text that precedes any given point in the book while summarizing content at that point. The effectiveness of this procedure for summarizing books has been studied in previous research by OpenAI using variants of GPT-3.

要对非常长的文档(如书籍)进行总结,可以使用一系列查询来逐段总结文档的每个部分。可以将各个段落的总结连接并进行总结,生成总结的总结。这个过程可以递归进行,直到对整个文档进行总结。如果需要使用先前部分的信息才能理解后续部分,则可以在总结内容时,在给定点之前包含文本的运行总结。这个过程在以往的 OpenAI 研究中使用 GPT-3 的变体研究了对书籍进行总结的效果。

79fafbf1d2bd6183d724e2f6e96d6383.jpeg

“点赞有美意,赞赏是鼓励”

【资源说明】 1.项目代码功能经验证ok,确保稳定可靠运行。欢迎下载使用!在使用过程中,如有问题或建议,请及时私信沟通。 2.主要针对各个计算机相关专业,包括计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网等领域的在校学生、专业教师或企业员工使用。 3.项目具有丰富的拓展空间,不仅可作为入门进阶,也可直接作为毕设、课程设计、大作业、初期项目立项演示等用途。 4.当然也鼓励大家基于此进行二次开发。 5.期待你能在项目中找到乐趣和灵感,也欢迎你的分享和反馈! 本文介绍了基于QEM(Quadric Error Metrics,二次误差度量)的优化网格简化算法的C和C++实现源码及其相关文档。这一算法主要应用于计算机图形学领域,用于优化三维模型的多边形数量,使之在保持原有模型特征的前提下实现简化。简化的目的是为了提高渲染速度,减少计算资源消耗,以及便于网络传输等。 本项目的核心是网格简化算法的实现,而QEM作为该算法的核心,是一种衡量简化误差的数学方法。通过计算每个顶点的二次误差矩阵来评估简化操作的误差,并以此来指导网格简化过程。QEM算法因其高效性和准确性在计算机图形学中广泛应用,尤其在实时渲染和三维打印领域。 项目代码包含C和C++两种语言版本,这意味着它可以在多种开发环境中运行,增加了其适用范围。对于计算机相关专业的学生、教师和行业从业者来说,这个项目提供了丰富的学习和实践机会。无论是作为学习编程的入门材料,还是作为深入研究计算机图形学的项目,该项目都具有实用价值。 此外,项目包含的论文文档为理解网格简化算法提供了理论基础。论文详细介绍了QEM算法的原理、实施步骤以及与其他算法的对比分析。这不仅有助于加深对算法的理解,也为那些希望将算法应用于自己研究领域的人员提供了参考资料。 资源说明文档强调了项目的稳定性和可靠性,并鼓励用户在使用过程中提出问题或建议,以便不断地优化和完善项目。文档还提醒用户注意查看,以获取使用该项目的所有必要信息。 项目的文件名称列表中包含了加水印的论文文档、资源说明文件和实际的项目代码目录,后者位于名为Mesh-Simplification-master的目录下。用户可以将这些资源用于多种教学和研究目的,包括课程设计、毕业设计、项目立项演示等。 这个项目是一个宝贵的资源,它不仅提供了一个成熟的技术实现,而且为进一步的研究和学习提供了坚实的基础。它鼓励用户探索和扩展,以期在计算机图形学领域中取得更深入的研究成果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值