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

这篇具有很好参考价值的文章主要介绍了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 的变体研究了对书籍进行总结的效果。

“点赞有美意,赞赏是鼓励”文章来源地址https://www.toymoban.com/news/detail-556543.html

到了这里,关于ChatGPT 最佳实践指南之:将复杂任务拆分为较简单的子任务的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • MySQL 安全最佳实践指南

    MySQL 以其可靠性和效率在各种可用的数据库系统中脱颖而出。然而,与任何保存有价值数据的技术一样,MySQL 数据库是网络犯罪分子利润丰厚的目标。 这使得 MySQL 安全不仅是一种选择,而且是一种必需。这份综合指南将深入探讨保护 MySQL 数据库的最佳实践。 从初始设置到高

    2024年01月16日
    浏览(33)
  • 【译】MongoDB 性能最佳实践指南

    原文地址:Best Practices Guide for MongoDB Performance MongoDB 是面向开发高性能应用程序的现代开发人员的主要 NoSQL 文档数据库。MongoDB 采用类似 JSON 的文档,以水平扩展和负载平衡著称,为开发人员提供了定制化和可扩展性之间的绝佳平衡。 但是,与其他高性能工具一样,MongoDB 在

    2024年02月03日
    浏览(37)
  • 技术写作最佳实践与策略指南

    作为一名技术写作者,遵守既定的最佳实践有助于确保您的工作的一致性、清晰性和整体质量。一些常见的最佳实践包括: 始终考虑受众: 牢记用户视角编写内容。确保技术术语、语言和复杂程度与您的目标读者相匹配。 逻辑地组织内容: 将材料分为章节、子章节、项目符号

    2024年02月04日
    浏览(49)
  • 项目管理软件选择指南:最佳实践与避坑指南

    当今企业中,协作工具是必不可少的,每个企业都会寻找最适合自己的协作工具来提高工作效率。在这些协作工具中,Zoho Projects项目协作工具是最常用的一种,因为它能够为团队提供一个集任务、项目、文档、IM、目标、日历、甘特图、工时、审批等多个功能于一体的协作环

    2024年02月16日
    浏览(34)
  • 掌握Spring缓存-全面指南与最佳实践

    第1章:引言 大家好,我是小黑,咱们今天来聊聊缓存,在Java和Spring里,缓存可是个大角色。咱们在网上购物,每次查看商品详情时,如果服务器都要去数据库里翻箱倒柜,那速度得慢成什么样?这就是缓存发光发热的时刻。缓存就像是服务器的“小抽屉”,把经常用到的数

    2024年01月17日
    浏览(33)
  • 电子文件管理系统的最佳实践指南分享

    电子文件管理系统 是一种专门用于管理电子文件的软件工具,可以帮助组织更有效地管理、存储、检索和共享文件。 首先,在选择适合自己组织的电子文件管理系统时,需要考虑以下几个关键因素。首先,系统的易用性和用户界面是否友好,是否能够满足您组织的需求。其

    2024年02月14日
    浏览(38)
  • 小程序安全指南:保护用户数据的最佳实践

      第一章:引言 近年来,小程序已成为移动应用开发的重要组成部分。它们为用户提供了方便的功能和个性化的体验,然而,与此同时,小程序安全问题也引起了广泛的关注。保护用户数据是开发者应该高度重视的问题。在本指南中,我们将介绍保护小程序用户数据的最佳实

    2024年02月15日
    浏览(40)
  • Flink:处理大规模复杂数据集的最佳实践深入探究Flink的数据处理和性能优化技术

    作者:禅与计算机程序设计艺术 随着互联网、移动互联网、物联网等新型网络技术的不断发展,企业对海量数据的处理日益依赖,而大数据分析、决策支持、风险控制等领域都需要海量的数据处理能力。如何高效、快速地处理海量数据、提升处理效率、降低成本,是当下处理

    2024年02月13日
    浏览(46)
  • ChatGPT初学者最佳实践

    2022年11月底,ChatGPT引爆了新一轮AI的革命,也让人们意识到AI真的能够大幅度提高人们的工作效率,甚至有人担心自己的工作会因为AI不保。这种居安思危的意识是正确的,但是正如锛凿斧锯的出现,并没有让木匠这个行业消失,而是让这个行业以更高效的方式工作。所以作为

    2024年02月05日
    浏览(45)
  • 性能测试的指南:测试类型、性能测试步骤、最佳实践等

    近期公司为了节省成本搞了一波机房迁移,整合了一些南美部署架构。有一些上google云和有些下阿里云等大的调整。 在做机房迁移项目当中就需要思考如何进行性能测试,这种大的机房迁移SRE(运维)会针对组件会做一些单组件的性能测试,但是整个迁移之后性能上面会不会

    2024年02月03日
    浏览(89)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包