Large model intention reasoning method and device based on reasoning template, equipment and medium
Through the agent autonomous system, the use of inference templates and prompt word sets for intention recognition and process reasoning in large language models, the hallucination problem in the LLM reasoning process is solved, the accuracy and user experience of inference conclusions are improved, the calculation cost is reduced, and the calculation cost is enhanced. Perceived new environments.
Patent Information
- Application Number
- CN202411009030.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-11-22
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
There are hallucinations in the inference process based on the LLM large language model, and the inability to output accurate inference conclusions, resulting in high computing costs, inability to synchronously perceive the new computing power network environment, data privacy issues and poor user experience.
Using a large-model intention reasoning method based on inference templates, through the collaborative cooperation between the main control agent, intent arrangement agent and professional agent in the agent's autonomous system, intent recognition, process reasoning, process arrangement and process processing are carried out, and in advance The set of inference templates and prompt word sets combine historical cases and labeling rules to generate training data sets and train them to improve the accuracy of inference conclusions.
It solves the hallucination problem during the reasoning process, improves the accuracy of the reasoning conclusions, reduces the computational cost, enhances the perception of the new environment, solves the data privacy problem, and improves the user experience.
Smart Images

Figure CN119005153A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a large model intention reasoning method, device, equipment and medium based on reasoning templates. Background Art
[0002] The technology of building application systems based on the LLM large language model refers to using the pre-trained large language model LLM (Large Language Model) as the core component of the artificial intelligence system to achieve the understanding and generation of natural language, thereby completing various application tasks such as question and answer, dialogue, summary, translation, writing, etc.
[0003] The technology of building application systems based on LLM large language models has been widely used in the industry. However, in related technologies, the hallucination problem that occurs during the reasoning process has not been effectively solved, and accurate reasoning conclusions cannot be output. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a large model intention reasoning method, device, equipment and medium based on reasoning template to solve the hallucination problem occurring in the reasoning process and improve the accuracy of the reasoning conclusion.
[0005] In the first aspect, an embodiment of the present invention provides a large-model intention reasoning method based on reasoning templates, which is applied to a large language model. The large language model is deployed with a pre-built intelligent agent autonomous system, and the intelligent agent autonomous system includes a master intelligent agent, an intention orchestration intelligent agent and a professional intelligent agent; the method includes: obtaining a natural language to be processed; inputting the natural language to be processed into a pre-trained large language model, and the master intelligent agent performs intention recognition and process reasoning on the natural language to be processed based on historical cases in the large language model, pre-set reasoning templates and pre-generated prompt word sets to obtain reasoning results; the intention orchestration intelligent agent performs process orchestration based on the reasoning results to obtain a processing process; the professional intelligent agent performs process processing based on the processing process to obtain a processing result; the master intelligent agent performs intention reasoning based on the processing result to obtain a reasoning conclusion; and the large language model outputs the reasoning conclusion.
[0006] In a preferred embodiment of the present invention, the main control agent performs intent recognition and process reasoning on the natural language to be processed based on historical cases in the large language model, pre-set reasoning templates and pre-generated prompt word sets to obtain reasoning results, including: executing the basic outline defined by the pre-set reasoning template to obtain the reasoning result; the basic outline defined by the pre-set reasoning template includes: recognizing the intent of the task description in the natural language to be processed to obtain the task intention; performing process reasoning based on the task intention, historical cases and a pre-generated prompt word set to obtain the reasoning result; the reasoning result includes: associated actions corresponding to the task intention, processing tools associated with the task intention, processing key points prompts corresponding to the task intention, and precautions prompts corresponding to the task intention; the pre-generated prompt word set is used to provide prompt words to the main control agent to guide the main control agent to obtain the reasoning result.
[0007] In a preferred embodiment of the present invention, the basic outline defined by the pre-set reasoning template also includes: determining whether the reasoning result is wrong; if the reasoning result is wrong, adjusting the specific process of intent recognition and process reasoning, and updating the reasoning result according to the adjusted specific process of intent recognition and process reasoning.
[0008] In a preferred embodiment of the present invention, the master control agent performs intent recognition and process reasoning on the natural language to be processed based on historical cases in a large language model, pre-set reasoning templates and pre-generated prompt word sets, and after obtaining the reasoning results, it also includes: if the master control agent receives prompt information from external input, the master control agent updates the reasoning results based on the prompt information.
[0009] In a preferred embodiment of the present invention, the training method of the above-mentioned pre-trained large language model is: obtaining historical cases and labeling rules corresponding to the historical cases; generating a training data set based on the historical cases and the labeling rules; and training the large language model based on the training data set.
[0010] In a preferred embodiment of the present invention, the above-mentioned pre-generated prompt word set is generated in the following manner: obtaining newly added historical cases, prompt rules and prompt templates of a large language model; wherein the newly added historical cases do not participate in the training of the large language model; and generating a prompt word set based on historical cases, prompt rules and prompt templates.
[0011] In a preferred embodiment of the present invention, historical cases include at least one of historical expert cases and historical tool application cases; historical expert cases include: expert case application scenarios, expert case reasoning rules and expert case practice examples; tool application cases include: tool usage scenarios, tool usage rules and tool usage cases.
[0012] In the second aspect, an embodiment of the present invention also provides a large-model intention reasoning device based on reasoning templates, which is applied to a large language model. The large language model is deployed with a pre-built intelligent agent autonomous system, and the intelligent agent autonomous system includes a master intelligent agent, an intention orchestration intelligent agent and a professional intelligent agent; the device includes: a natural language acquisition module to be processed, which is used to acquire the natural language to be processed; a natural language input module to be processed, which is used to input the natural language to be processed into a pre-trained large language model, and the master intelligent agent performs intention recognition and process reasoning on the natural language to be processed based on historical cases in the large language model, pre-set reasoning templates and pre-generated prompt word sets to obtain reasoning results; a process orchestration module, which is used for the intention orchestration intelligent agent to perform process orchestration based on the reasoning results to obtain a processing process; a process processing module, which is used for the professional intelligent agent to perform process processing based on the processing process to obtain a processing result; an intention reasoning module, which is used for the master intelligent agent to perform intention reasoning based on the processing result to obtain a reasoning conclusion; and a reasoning conclusion output module, which is used for the large language model to output the reasoning conclusion.
[0013] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the large model intention reasoning method based on reasoning template of the first aspect mentioned above.
[0014] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the large model intention reasoning method based on reasoning template of the first aspect mentioned above.
[0015] The embodiments of the present invention bring the following beneficial effects:
[0016] The embodiment of the present invention provides a large-model intention reasoning method, device, equipment and medium based on reasoning template, which is applied to a large language model. The large language model is deployed with a pre-built intelligent agent autonomous system, and the intelligent agent autonomous system includes a master intelligent agent, an intention orchestration intelligent agent and a professional intelligent agent. By obtaining the natural language to be processed, the natural language to be processed is input into the pre-trained large language model. The master intelligent agent performs intention recognition and process reasoning on the natural language to be processed based on historical cases, pre-set reasoning templates and pre-generated prompt word sets in the large language model to obtain the reasoning result. The intention orchestration intelligent agent performs process orchestration based on the reasoning result to obtain the processing process. The professional intelligent agent performs process processing based on the processing process to obtain the processing result. The master intelligent agent performs intention reasoning based on the processing result to obtain the reasoning conclusion; the large language model outputs the reasoning conclusion. In this method, through the collaborative cooperation of the master intelligent agent, the intention orchestration intelligent agent and the professional intelligent agent in the intelligent agent autonomous system, the intention recognition, process reasoning, process orchestration and process processing of the natural language to be processed are realized, the hallucination problem in the reasoning process is solved, and the accuracy of the reasoning conclusion is improved.
[0017] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.
[0018] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 A flowchart of a large model intention reasoning method based on reasoning template provided in an embodiment of the present invention;
[0021] Figure 2 An overall logic diagram of intention reasoning provided by an embodiment of the present invention;
[0022] Figure 3 A logic diagram for intention reasoning of an intelligent agent autonomous system provided by an embodiment of the present invention;
[0023] Figure 4A schematic diagram of the structure of a large model intention reasoning device based on reasoning template provided by an embodiment of the present invention;
[0024] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] The technology of building application systems based on the LLM large language model refers to using the pre-trained large language model LLM (Large Language Model) as the core component of the artificial intelligence system to achieve the understanding and generation of natural language, thereby completing various application tasks such as question and answer, dialogue, summary, translation, writing, etc.
[0027] The technology of building application systems based on LLM large language models has been widely used in the industry. However, in related technologies, the hallucination problem that occurs during the reasoning process has not been effectively solved, and accurate reasoning conclusions cannot be output.
[0028] Specifically, the patent with the patent announcement number CN113321362A does not propose a targeted solution to the hallucination problem that occurs in the LLM AI large model reasoning. When receiving untrained new queries and new requirements from users, it is unable to generate accurate deterministic network optimization tasks and network operations, which brings great uncertainty and reliability risks to the optimization effect of the network.
[0029] Specifically, in the computing network operation and maintenance solution based on the LLM large model, it is used in the cloud fault root cause analysis RCA task. The GPT model is fine-tuned to generate text from event summaries to root causes and mitigation measures (processing measures) without collecting data in the production environment. The specific problems are as follows:
[0030] (1) In actual system application work, the above technical solutions rely heavily on the computationally expensive fine-tuning of LLM to adapt to cloud system tasks, and do not fully utilize the generalization and reasoning capabilities of LLM.
[0031] (2) The above technical solution cannot synchronously perceive the changes in the new computing power network environment and comprehensively consider them in reasoning.
[0032] (3) The above technical solutions are all based on Microsoft's internal GPT series and solutions, and do not address the data privacy issues associated with using LLM with cloud system data. Specifically, the potential security risks of transferring data from cloud production environments to external APIs such as ChatGPT may cause problems for many ICT companies. In addition, none of the above solutions fully utilize the autonomous capabilities of LLM for information collection, decision-making, and environmental interaction.
[0033] (4) Existing language agent frameworks rely only on brief task descriptions and completely depend on the planning and action capabilities of LLMs. This can lead to significant randomness and inconsistency between different runs, providing an unsatisfactory user experience and making it difficult to adjust task planning and actions in a timely manner according to unexpected situations.
[0034] Based on this, the embodiments of the present invention provide a large-model intention reasoning method, device, equipment and medium based on reasoning templates. Through the collaborative cooperation of the master intelligent agent, the intention orchestration intelligent agent and the professional intelligent agent in the intelligent agent autonomous system, it realizes the intention recognition, process reasoning, process orchestration and process processing of the natural language to be processed, solves the hallucination problem that occurs in the reasoning process, and improves the accuracy of the reasoning conclusion.
[0035] To facilitate understanding of this embodiment, a large model intention reasoning method based on reasoning template disclosed in an embodiment of the present invention is first introduced in detail.
[0036] Example 1
[0037] The embodiment of the present invention provides a large model intention reasoning method based on reasoning template, which is applied to a large language model. The large language model is deployed with a pre-built intelligent agent autonomous system, and the intelligent agent autonomous system includes a master intelligent agent, an intention orchestration intelligent agent and a professional intelligent agent. Figure 1 A flowchart of a large model intention reasoning method based on reasoning templates provided by an embodiment of the present invention. Figure 1 As shown, the large model intention reasoning method based on reasoning template may include the following steps:
[0038] Step S101, obtaining natural language to be processed.
[0039] Among them, natural language is a conventional language formed by human society after long-term development. The natural language to be processed can be the natural language actively input by the user according to his own intentions and needs, that is, the natural language to be processed can contain the user's intentions and needs.
[0040] Step S102, input the natural language to be processed into a pre-trained large language model, and the main control agent performs intent recognition and process reasoning on the natural language to be processed based on historical cases in the large language model, pre-set reasoning templates and pre-generated prompt word sets to obtain reasoning results.
[0041] Among them, since the master intelligent agent bears more important computing power responsibilities, the master intelligent agent is a large-scale intelligent agent, which has a large demand for computing resources and data storage. Specifically, in terms of computing resource requirements, more computing resources are usually required to support its operation, which may include high-performance processors, large amounts of memory, high-speed storage devices, etc. In terms of data storage, the master intelligent agent will generate a large amount of data, which needs to be effectively stored and managed for subsequent analysis, learning and optimization. Therefore, a larger storage space is required to accommodate this data. Of course, the master intelligent agent has higher processing power, can process information, make decisions and execute actions faster, can cope with more complex environments and tasks, and improve the overall performance and response speed of the system.
[0042] Among them, the main control agent performs intent recognition and process reasoning on the natural language to be processed based on its own performance and functions through historical cases in the large language model, pre-set reasoning templates and pre-generated prompt word sets to obtain reasoning results.
[0043] In addition to describing the framework rules of the reasoning thinking-action (movement)-observation cycle, this application innovatively introduces reasoning templates as the basic outline for the main control agent to perform reasoning thinking, such as first identifying the intention of the target or task description, then analyzing the observation data, analyzing the historical data, referring to expert cases, referring to the tool usage documents, etc., thinking and reasoning again, and giving priority to error reports and outputting reasoning results. It can ensure that the output completes the traceable reasoning process and conclusions.
[0044] Among them, the reasoning result may include the user's intention of the natural language representation to be processed, the associated action corresponding to the intention, the processing tool associated with the intention, the processing key points corresponding to the intention, and the precautions corresponding to the intention, etc.
[0045] Among them, the pre-set reasoning template is the basic outline provided to the main control intelligent agent for intention reasoning. The limited basic outline can be: intention recognition of task description in the natural language to be processed to obtain task intention, and then analysis of observation data, historical cases, reference prompt word sets, expert cases, reference tools, etc. are performed according to the task intention for thinking and reasoning, and error reports are given priority when the main control intelligent agent receives them, so as to ensure that the output completes the traceable reasoning process and reasoning conclusion.
[0046] Figure 2 An overall logic diagram of intention reasoning provided by an embodiment of the present invention, such as Figure 2 As shown, an embodiment of the present application also provides a method for training a pre-trained large language model. The method for training a pre-trained large language model is: obtaining historical cases and labeling rules corresponding to the historical cases; generating a training data set based on the historical cases and the labeling rules; and training the large language model based on the training data set.
[0047] Among them, historical cases can be obtained from existing expert case library documents, and historical cases include at least one of historical expert cases and historical tool application cases; historical expert cases include: expert case application scenarios, expert case reasoning rules and expert case practice examples; tool application cases include: tool usage scenarios, tool usage rules and tool usage cases.
[0048] Among them, the annotation rules can characterize the corresponding relationship between the thresholds reached by some indicators in the historical cases and the processing rules. The historical cases can be annotated by the annotation rules to clarify the corresponding processing rules of some indicators in the case processing flow of the historical cases in some cases, so as to organize the training data set. The training data set may include multiple training data, each of which includes a complete case processing flow and the processing rules corresponding to the indicators involved in the case processing flow.
[0049] like Figure 2 As shown, an embodiment of the present application also provides a method for generating a pre-generated prompt word set, and the pre-generated prompt word set is used to provide prompt words for the main control intelligent agent to guide the main control intelligent agent to obtain reasoning results. The method for generating the pre-generated prompt word set is: obtaining newly added historical cases, prompt rules and prompt templates of large language models; generating a prompt word set based on the newly added historical cases, prompt rules and prompt templates.
[0050] Among them, the newly added historical cases did not participate in the training of the large language model. The newly added historical cases were historical cases newly added to the existing expert case library documents. Since the cost of model training is high, the method of constructing prompt words by adding historical cases not only ensures the reasoning ability of the large language model, but also saves the training cost.
[0051] Among them, the newly added historical cases include tool usage scenarios, tool usage rules and tool usage cases. The newly added historical cases can be annotated using prompt rules, and then sorted to obtain natural language cases and prompt contents based on prompt templates, that is, to obtain prompt words, and multiple prompt words form a prompt word set.
[0052] Step S103: the intention orchestration agent performs process orchestration based on the reasoning result to obtain a processing flow.
[0053] Among them, the intent-orchestrated intelligent agent does not need to bear too much computing power responsibility, but only needs to complete its work. Therefore, the intent-orchestrated intelligent agent can be a small or medium-sized intelligent agent, reducing the burden on the server and the burden on storage space.
[0054] Among them, the intention orchestration agent can perform process orchestration through associated actions, processing tools, etc. in the reasoning results to obtain the processing flow.
[0055] Step S104, the professional agent performs process processing based on the processing flow to obtain a processing result.
[0056] Among them, professional intelligent agents also do not need to bear too much computing power responsibility, they only need to complete their work. Therefore, professional intelligent agents can be small and medium-sized intelligent agents, reducing the burden on the server and storage space.
[0057] Step S105: The master intelligent agent performs intention reasoning based on the processing results to obtain a reasoning conclusion.
[0058] The master agent performs intention reasoning based on its own performance and function reference processing results to obtain a reasoning conclusion. The processing result can be, for example, the problem analysis result corresponding to the natural language to be processed. The reasoning conclusion is the problem solution obtained by reasoning based on the problem analysis result.
[0059] Step S106: the large language model outputs the inference conclusion.
[0060] like Figure 2 As shown, the expert case application scenarios, expert case reasoning rules and expert case practice examples included in the historical cases can be annotated by pre-set annotation rules to generate a training data set, and then the large language model is trained by the training data set. After that, the pre-built intelligent agent autonomous system is deployed in the large language model, and the natural language to be processed input by the user is inferred in conjunction with the reasoning template and the prompt words selected from the pre-generated prompt word set to obtain the reasoning conclusion. Among them, the pre-generated prompt word set can annotate the tool usage scenarios, tool usage rules and tool usage cases included in the newly added historical cases by pre-set prompt rules, and then organize the natural language cases and prompt contents based on the prompt template, that is, organize the prompt words, and multiple prompt words constitute the prompt word set.
[0061] Among them, after the intelligent agent autonomous system is deployed in the large-scale language model, for new historical cases, combined with the calling of multiple intelligent agents, reasoning templates, prompt word sets and result feedback in the associated intelligent agent autonomous system, it is organized into natural language cases and prompt content based on the optimized prompt word set, which is used to improve the reasoning of the large-scale language model deployed with the intelligent agent autonomous system, and simultaneously improve the professionalism and accuracy of the reasoning, so that the large-scale language model deployed with the intelligent agent autonomous system does not need to be frequently trained and deployed, and can have the professional and accurate reasoning ability of "keeping pace with the times".
[0062] The large-model intention reasoning method based on reasoning templates provided in the embodiment of the present invention can realize intention recognition, process reasoning, process orchestration and process processing of the natural language to be processed through the collaborative cooperation of the main control agent, intention orchestration agent and professional agent in the intelligent agent autonomous system, solve the hallucination problem occurring in the reasoning process and improve the accuracy of the reasoning conclusion.
[0063] Example 2
[0064] The embodiment of the present invention also provides another large model intention reasoning method based on reasoning template; this method is implemented on the basis of the above embodiment method. The large model intention reasoning method based on reasoning template may include the following steps:
[0065] Step S201, obtaining natural language to be processed.
[0066] Step S202 , identifying the intent of the task description in the natural language to be processed according to a preset reasoning template to obtain the task intent.
[0067] Step S203, performing process reasoning based on the task intention, historical cases and a pre-generated prompt word set to obtain a reasoning result.
[0068] Among them, the reasoning results may include: associated actions corresponding to the task intent, processing tools associated with the task intent, processing key points prompts corresponding to the task intent, and precautions prompts corresponding to the task intent.
[0069] Among them, intention reasoning is performed through the associated actions, processing tools, processing key points prompts, precautions prompts, etc. corresponding to the task intention, so that the intention orchestration agent can arrange the task process, which improves the accuracy of task orchestration, and then makes the professional agent more in line with the processing process, improving the accuracy of intention reasoning.
[0070] Since errors may occur during intent recognition and process reasoning, which may lead to errors in reasoning results, the basic outline defined by the pre-set reasoning template may also include:
[0071] Step S204, determine whether the reasoning result is wrong; if the reasoning result is wrong, adjust the specific process of intention recognition and process reasoning, and update the reasoning result according to the adjusted specific process of intention recognition and process reasoning.
[0072] Among them, the specific process of intent recognition and process reasoning can be adjusted through the error report generated when the reasoning result is wrong, and then the reasoning result can be updated, thereby improving the accuracy of intent reasoning.
[0073] Furthermore, in the process of intention reasoning, the user can input some relevant information to guide the intention reasoning to improve the accuracy of intention reasoning. Therefore, after the main control agent performs intention recognition and process reasoning on the natural language to be processed based on historical cases in the large language model, pre-set reasoning templates and pre-generated prompt word sets, and obtains the reasoning results, the method can also include:
[0074] Step S205: If the master agent receives external prompt information, the master agent updates the inference result based on the prompt information.
[0075] Step S206: the intention orchestration agent performs process orchestration based on the reasoning result to obtain a processing flow.
[0076] Among them, there may be actions in the reasoning results that cannot be implemented in the professional agents in the agent autonomous system. In this case, errors may occur in the process orchestration. Therefore, when the intention-orchestration agent performs process orchestration based on the reasoning results to obtain the processing flow, the method also includes: if the intention-orchestration agent encounters an error in the process of process orchestration, or the generated processing flow encounters an error, a first error report is generated and the first error report is fed back to the main control agent; the main control agent performs process reasoning again based on the first error report, historical cases, reasoning templates and prompt word sets to obtain a first revised reasoning result, so that the intention-orchestration agent can perform process orchestration again based on the first revised reasoning result.
[0077] Among them, the first error report may include an action that cannot be implemented in the reasoning result. The main control intelligent agent can use the unfeasible action as a reference, and perform process reasoning in conjunction with historical cases, reasoning templates and prompt word sets to obtain a new reasoning result, namely the first corrected reasoning result.
[0078] Step S207, the professional intelligent agent performs process processing based on the processing flow to obtain a processing result.
[0079] The processing flow includes reasoning tasks. If there are reasoning tasks that cannot be solved by the professional agent, the professional agent processes the unsolvable reasoning subtasks based on a preset external information library to obtain processing results.
[0080] Among them, the external information library may include: real-time perception data, rule library, template library, knowledge graph, database, code library and plug-in library, etc. Professional intelligent agents can directly search through the external information library to solve the corresponding reasoning tasks.
[0081] Furthermore, professional agents can perform self-learning through external information bases to solve corresponding reasoning tasks.
[0082] Step S208: The master intelligent agent performs intention reasoning based on the processing results to obtain a reasoning conclusion.
[0083] Furthermore, the agent autonomous system further includes: an observation head, and the main control agent performs intention reasoning based on the processing results, and the reasoning conclusions obtained may include:
[0084] Among them, the observation head receives the processing result and determines whether the data form of the processing result is a format that can be recognized and understood by the main control intelligent body through the environmental information required by the main control intelligent body. When it is determined that the main control intelligent body cannot recognize and understand it, the processing result can be normalized and then feature extracted to obtain the result feature. The result feature is the processing result that can be recognized and understood by the main control intelligent body.
[0085] Step S209: The master intelligent agent performs intention reasoning based on the result features to obtain a reasoning conclusion.
[0086] Among them, the main control agent performs intention reasoning based on its own performance and functional reference result characteristics to obtain reasoning conclusions.
[0087] Step S210: the large language model outputs the inference conclusion.
[0088] For ease of understanding, Figure 3 A logic diagram of an agent autonomous system performing intention reasoning provided by an embodiment of the present invention. Figure 3 As shown, the master agent uses reasoning templates, prompt word sets, and historical cases to perform intent recognition and process reasoning on the natural language to be processed to obtain reasoning results; the intention arrangement agent uses the reasoning results to perform process arrangement to obtain the processing process; the professional agent performs process processing based on the processing process to obtain the processing result. When the professional agent cannot perform process processing based on the processing process to obtain the processing result, the professional agent processes through the external information library to obtain the processing result. The observation head receives the processing result and determines whether the data form of the processing result is a format that the master agent can recognize and understand through the environmental information required by the master agent. When it is determined that the master agent cannot recognize and understand it, the processing result is processed to obtain the result feature and sent to the master agent for the master agent to perform intention reasoning.
[0089] The large-model intention reasoning method based on reasoning templates provided in the embodiment of the present invention realizes intention recognition, process reasoning, process orchestration and process processing of the natural language to be processed through the collaborative cooperation of multiple intelligent agents, solves the hallucination problem that occurs during the reasoning process, and improves the accuracy of the reasoning conclusions.
[0090] Example 3
[0091] Corresponding to the above method embodiments, an embodiment of the present invention provides a large-model intention reasoning device based on reasoning templates, which is applied to a large language model. The large language model is deployed with a pre-built intelligent agent autonomous system, and the intelligent agent autonomous system includes a master intelligent agent, an intention orchestration intelligent agent and a professional intelligent agent. Figure 4 A schematic diagram of the structure of an intention inference device provided by an embodiment of the present invention is shown in FIG. Figure 4 As shown, the intention reasoning device may include:
[0092] The natural language to be processed acquisition module 401 is used to acquire the natural language to be processed.
[0093] The natural language input module 402 to be processed is used to input the natural language to be processed into a pre-trained large language model. The main control agent performs intent recognition and process reasoning on the natural language to be processed based on historical cases in the large language model, pre-set reasoning templates and pre-generated prompt word sets to obtain reasoning results.
[0094] The process orchestration module 403 is used for the intention orchestration agent to perform process orchestration based on the reasoning result to obtain the processing flow.
[0095] The process processing module 404 is used for the professional intelligent agent to perform process processing based on the processing process to obtain the processing result.
[0096] The intention reasoning module 405 is used for the master intelligent agent to perform intention reasoning based on the processing results and obtain the reasoning conclusion.
[0097] The reasoning conclusion output module 406 is used for outputting reasoning conclusions of a large language model.
[0098] The large-model intention reasoning device based on reasoning templates provided in the embodiment of the present invention can realize intention recognition, process reasoning, process orchestration and process processing of the natural language to be processed through the collaborative cooperation of the main control agent, intention orchestration agent and professional agent in the intelligent agent autonomous system, solve the hallucination problem occurring in the reasoning process and improve the accuracy of the reasoning conclusion.
[0099] In some embodiments, the natural language input module to be processed is also used to execute the basic outline defined by a preset reasoning template to obtain a reasoning result; the basic outline defined by the preset reasoning template includes: identifying the intention of the task description of the natural language to be processed to obtain the task intention; performing process reasoning based on the task intention, historical cases and a pre-generated prompt word set to obtain a reasoning result; the reasoning result includes: associated actions corresponding to the task intention, processing tools associated with the task intention, processing key points prompts corresponding to the task intention, and precautions prompts corresponding to the task intention; the pre-generated prompt word set is used to provide prompt words to the main control intelligent agent to guide the main control intelligent agent to obtain the reasoning result.
[0100] In some embodiments, the natural language input module to be processed is also used to determine whether the reasoning result is wrong; if the reasoning result is wrong, the specific process of intent recognition and process reasoning is adjusted, and the reasoning result is updated according to the adjusted specific process of intent recognition and process reasoning.
[0101] In some embodiments, the natural language input module to be processed is also used for updating the reasoning result based on the prompt information if the main control agent receives prompt information from external input.
[0102] In some embodiments, the natural language input module to be processed is also used to obtain historical cases and labeling rules corresponding to the historical cases; generate a training data set based on the historical cases and the labeling rules; and train a large language model based on the training data set.
[0103] In some embodiments, the natural language input module to be processed is also used to obtain new historical cases, prompt rules and prompt templates of a large language model; wherein the new historical cases do not participate in the training of the large language model; and generate a prompt word set based on historical cases, prompt rules and prompt templates.
[0104] In some embodiments, historical cases include at least one of historical expert cases and historical tool application cases; historical expert cases include: expert case application scenarios, expert case reasoning rules and expert case practice examples; tool application cases include: tool usage scenarios, tool usage rules and tool usage cases.
[0105] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0106] Example 4
[0107] The embodiment of the present invention also provides an electronic device for running the above-mentioned large model intention reasoning method based on reasoning template; see Figure 5A structural schematic diagram of an electronic device is shown, which includes a memory 500 and a processor 501, wherein the memory 500 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 501 to implement the above-mentioned large model intention reasoning method based on reasoning template.
[0108] Further, Figure 5 The electronic device shown further includes a bus 502 and a communication interface 503 , and the processor 501 , the communication interface 503 and the memory 500 are connected via the bus 502 .
[0109] The memory 500 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 503 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 502 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0110] The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 501. The above processor 501 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 500, and the processor 501 reads the information in the memory 500 and completes the steps of the method of the above embodiment in combination with its hardware.
[0111] An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned large model intention reasoning method based on reasoning template. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0112] The computer program product for performing a large model intention reasoning method based on an inference template provided in an embodiment of the present invention includes a computer-readable storage medium storing a non-volatile program code executable by a processor. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0113] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0114] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0115] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0116] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0117] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0118] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A large model intention reasoning method based on reasoning template, characterized in that: Applied to a large language model, the large language model is deployed with a pre-built agent autonomous system, the agent autonomous system includes a master agent, an intent orchestration agent and a professional agent; the method includes: Obtaining natural language to be processed; The natural language to be processed is input into a pre-trained large language model, and the master control agent performs intention recognition and process reasoning on the natural language to be processed based on historical cases, pre-set reasoning templates and pre-generated prompt word sets in the large language model to obtain reasoning results; The intention orchestration agent performs process orchestration based on the reasoning result to obtain a processing process; The professional agent performs process processing based on the processing process to obtain a processing result; The master control agent performs intention reasoning based on the processing result to obtain a reasoning conclusion; The large language model outputs the inference conclusion.
2. The method according to claim 1, characterized in that The master control agent performs intention recognition and process reasoning on the natural language to be processed based on historical cases in the large language model, pre-set reasoning templates and pre-generated prompt word sets, and obtains reasoning results, including: Execute the basic outline defined by the preset reasoning template to obtain the reasoning result; the basic outline defined by the preset reasoning template includes: Performing task description intent recognition on the natural language to be processed to obtain task intent; Based on the task intent, the historical cases and a pre-generated prompt word set, process reasoning is performed to obtain a reasoning result; the reasoning result includes: associated actions corresponding to the task intent, processing tools associated with the task intent, prompt instructions for processing key points corresponding to the task intent, and prompt instructions for precautions corresponding to the task intent; the pre-generated prompt word set is used to provide prompt words for the main control intelligent agent to guide the main control intelligent agent to obtain the reasoning result.
3. The method according to claim 2, characterized in that The basic outline defined by the preset reasoning template also includes: determining whether the inference result is wrong; If the reasoning result is wrong, the specific process of the intention recognition and the process reasoning is adjusted, and the reasoning result is updated according to the adjusted specific process of the intention recognition and process reasoning.
4. The method according to claim 1, characterized in that: The master control agent performs intention recognition and process reasoning on the natural language to be processed based on historical cases in the large language model, pre-set reasoning templates and pre-generated prompt word sets, and after obtaining the reasoning results, further includes: If the master control agent receives external prompt information, the master control agent updates the inference result based on the prompt information.
5. The method according to claim 1, characterized in that The pre-trained large language model is trained as follows: Obtaining historical cases and annotation rules corresponding to the historical cases; Generate a training data set based on the historical cases and the annotation rules; The large language model is trained based on the training data set.
6. The method according to claim 1, characterized in that The pre-generated prompt word set is generated in the following manner: Acquire newly added historical cases, prompt rules and prompt templates of the large language model; wherein the newly added historical cases do not participate in the training of the large language model; The prompt word set is generated based on the historical cases, the prompt rules and the prompt template.
7. The method according to claim 5 or 6, characterized in that: The historical cases include at least one of historical expert cases and historical tool application cases; The historical expert cases include: expert case application scenarios, expert case reasoning rules and expert case practice examples; the tool application cases include: tool usage scenarios, tool usage rules and tool usage cases.
8. A large model intention reasoning device based on reasoning template, characterized in that: Applied to a large language model, the large language model is deployed with a pre-built agent autonomous system, the agent autonomous system includes a master agent, an intent orchestration agent and a professional agent; the device includes: A module for obtaining natural language to be processed, used for obtaining natural language to be processed; A natural language input module to be processed, used to input the natural language to be processed into a pre-trained large language model, and the master control agent performs intention recognition and process reasoning on the natural language to be processed based on historical cases, pre-set reasoning templates and pre-generated prompt word sets in the large language model to obtain reasoning results; A process orchestration module, used for the intention orchestration agent to perform process orchestration based on the reasoning result to obtain a processing process; A process processing module, used for the professional agent to perform process processing based on the processing process to obtain a processing result; An intention reasoning module, used for the master intelligent agent to perform intention reasoning based on the processing result to obtain a reasoning conclusion; The inference conclusion output module is used for the large language model to output the inference conclusion.
9. An electronic device, characterized in that: It includes a processor and a memory, the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the large model intention reasoning method based on reasoning template as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by the processor, the computer-executable instructions prompt the processor to implement the large model intention reasoning method based on reasoning template as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method suitable for treating lake pollution in cold and arid regions
CN113321362A
Intention recognition method and device, electronic equipment and storage medium
CN116863495A
Information processing method and device, robot and storage medium
CN117033598A
Model reasoning method and device based on rule accumulation and electronic equipment
CN117057430A
Lamp screen equipment, lamp effect intelligent control method, corresponding device and medium
CN117500117A
Cited By
Open type problem implicit intention recognition method and system based on multi-agent reasoning
CN119621916A
Method and system for identifying implicit intentions in open-ended questions based on multi-agent reasoning
CN119621916B
Power supply service command system decision recommendation method and system based on intelligent agent
CN119721750A
Large model application evaluation method and device based on multi-agent cooperation
CN120338122A
Method and system for realizing AI processing capability of operating system
CN120821469A
